Skip to main content

resolve_links_for_doi

Function resolve_links_for_doi 

Source
pub async fn resolve_links_for_doi(
    base: &Url,
    contact_email: &str,
    doi: &str,
    ctx: &FetchContext,
) -> Result<PaperLinks, FetchError>
Expand description

Resolve the PaperLinks identity cluster for a DOI via OpenAlex (/works?filter=doi:<doi>), in particular whether the work has an arXiv preprint.

base / contact_email / ctx are used exactly as in paper_search (Tier-1 OA metadata, always-on; a single bounded /works query; HttpClient::fetch_bytes, never a PDF). The arXiv id is extracted from the work’s locations[] / primary_location / best_oa_location URLs (arxiv.org/abs/<id>), reusing the same logic as discovery search.

§Errors

FetchError::NotFound when no OpenAlex work matches the DOI, FetchError::SourceSchema when the response is not a JSON object with a results array — or when the matched work carries no id, FetchError::Http for transport failures, and propagates a provenance-log append failure (fail-closed).