enrich_affiliations_author_search¶
src.enrichers.enrich_affiliations_author_search
¶
Affiliation enrichment via co-author bridge in OpenAlex.
Strategy
- For an unaffiliated author X, find their co-authors from our dataset.
- Search each co-author in OpenAlex to get their OpenAlex author ID.
- Scan that co-author's works for any paper listing X by name → extract X's OpenAlex author ID.
- Validate the matched ID: check that X's OpenAlex works contain at least one paper title from our dataset (confirms correct disambiguation).
- Fetch X's own works sorted by publication_year desc and return the institution from their most recent paper that has one.
This avoids false positives from common names (e.g. "Kai Ye" matching a medical researcher) by requiring the found author's profile to overlap with our known paper titles.
Usage
python -m src.enrichers.enrich_affiliations_author_search --authors_file output/staging/_data/authors.yml --papers_file output/staging/assets/data/paper_authors_map.json [--output_file output/staging/_data/authors.yml] [--max_authors 100][--verbose] [--dry_run]
resolve_via_coauthor_bridge(session: requests.Session, target_name: str, coauthor_names: list[str], verbose: bool = False) -> Optional[str]
¶
For an unaffiliated author, find their OpenAlex ID via multiple co-authors' works. Require consensus: the same OpenAlex ID must be found via at least 2 independent co-authors (or 1 if the author has fewer than 2 co-authors in our dataset). Then return the most recent affiliation from that profile.
Source code in src/enrichers/enrich_affiliations_author_search.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
enrich(authors_file: str, papers_file: str, output_file: Optional[str] = None, max_authors: Optional[int] = None, verbose: bool = False, dry_run: bool = False, data_dir: Optional[str] = None) -> dict
¶
Main entry point. Returns stats dict.
Source code in src/enrichers/enrich_affiliations_author_search.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |