zettelkasten.openalex¶
zettelkasten.openalex ¶
Lightweight OpenAlex client for citation-graph expansion.
OpenAlex (https://openalex.org) is a free, open scholarly catalog with no API key required. We use it to resolve a work by DOI and to walk its citation graph: backward (the works it references) and forward (the works that cite it).
Set OPENALEX_MAILTO to join the polite pool (faster, more reliable). No authentication is needed otherwise.
simplify ¶
Reduce a raw OpenAlex work object to the fields we store.
Source code in zettelkasten/openalex.py
get_work_by_doi ¶
Resolve a single work by DOI. Returns the raw OpenAlex work or None.
Source code in zettelkasten/openalex.py
extract_arxiv_id ¶
Pull a bare modern arXiv id (e.g. 1706.03762) from free text, or ''.
Scans each argument in order (a dedicated arxiv field, then a messy
venue like "NeurIPS 2017; arXiv:1706.03762") and returns the first
match without its version suffix.
Source code in zettelkasten/openalex.py
get_work_by_arxiv ¶
Resolve a work by arXiv id via the DataCite DOI arXiv mints
(10.48550/arXiv.<id>). Returns the raw OpenAlex work or None.
This is an exact-identifier path (no fuzzy matching), so a hit is safe to trust. Many older preprints are not linked under this DOI in OpenAlex yet, in which case this returns None and the caller falls back to a strict title match.
Source code in zettelkasten/openalex.py
find_work_by_title ¶
find_work_by_title(title: str, *, year: int | None = None, first_author: str = '', year_tol: int = 1) -> dict[str, Any] | None
STRICT title resolution for DOI-less works. Returns the raw OpenAlex work
only when a candidate's title matches exactly (normalized) AND it agrees on
year (within year_tol) AND, when first_author is given, on the first
author's surname. Returns None on any near-miss.
The strictness is deliberate: OpenAlex title search readily returns unrelated same-title papers (e.g. a recent paper reusing a famous title), so a loose "top hit" match would assign the wrong paper's citation count. Rejecting a near-miss (leaving the work unenriched / influence "unknown") is the safe failure mode.
Source code in zettelkasten/openalex.py
get_citing_works ¶
Forward edges: works that cite the given work (most-cited first).
Source code in zettelkasten/openalex.py
get_referenced_works ¶
Backward edges: works referenced by the given work.
work is a raw OpenAlex object (from get_work_by_doi). The referenced
ids are batch-resolved to metadata in a single request.