author_index¶
src.utils.author_index
¶
Utilities for reading and updating the canonical author index.
The author index (author_index.json) is the single source of truth for
author identity (stable integer IDs) and affiliation data. Enrichers call
update_author_affiliation() to write back discovered affiliations with
proper source tracking and history.
load_author_index(data_dir: str) -> tuple[list, dict[str, dict]]
¶
Load author_index.json and return (entries, name→entry dict).
data_dir is the website repo root (contains assets/data/).
Source code in src/utils/author_index.py
16 17 18 19 20 21 22 23 24 25 26 27 | |
build_name_to_id(data_dir: str) -> dict[str, int]
¶
Return a {name: author_id} dict. Returns empty dict if no index.
Source code in src/utils/author_index.py
30 31 32 33 | |
save_author_index(data_dir: str, entries: list[dict]) -> str
¶
Write author_index.json back to disk. Returns the file path.
Source code in src/utils/author_index.py
36 37 38 39 40 41 42 | |
update_author_affiliation(entry: dict, new_affiliation: str, source: str, *, external_id_key: Optional[str] = None, external_id_value: Optional[str] = None) -> bool
¶
Update an index entry's affiliation if it changed.
Sets affiliation, affiliation_source, affiliation_updated
and appends the old value to affiliation_history when the affiliation
actually changes.
Optionally records an external ID (e.g. dblp_pid, openalex_id).
Returns True if the entry was modified.
Source code in src/utils/author_index.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |