adsfolio.pdf.prefetch

Publication prefetch helpers to reduce first-run ADS query volume.

class adsfolio.pdf.prefetch.PublicationIndex(documents, by_doi, by_filename_key)[source]

Bases: object

In-memory lookup index built from prefetched ADS docs.

Parameters:
by_doi: dict[str, list[dict[str, Any]]]
by_filename_key: dict[tuple[str, str, str, str, str], list[dict[str, Any]]]
documents: list[dict[str, Any]]
class adsfolio.pdf.prefetch.PublicationProfile(orcid='', query_names=<factory>, debut_year=None, retire_year=None, library_ids=<factory>, end_year=None)[source]

Bases: object

Saved setup profile for low-query identify bootstrap.

Parameters:
  • orcid (str)

  • query_names (list[str])

  • debut_year (int | None)

  • retire_year (int | None)

  • library_ids (list[str])

  • end_year (int | None)

debut_year: int | None = None
end_year: int | None = None
property has_identity: bool[source]
library_ids: list[str]
orcid: str = ''
query_names: list[str]
retire_year: int | None = None
adsfolio.pdf.prefetch.build_publication_index(documents)[source]

Build DOI and filename-derived lookup indexes.

Parameters:

documents (list[dict[str, Any]])

Return type:

adsfolio.pdf.prefetch.PublicationIndex

adsfolio.pdf.prefetch.estimated_query_budget(unmatched_file_count, strategies_per_file=4)[source]

Rough upper bound estimate for ADS query count during fallback phase.

Parameters:
  • unmatched_file_count (int)

  • strategies_per_file (int)

Return type:

int

adsfolio.pdf.prefetch.load_profile()[source]

Load setup profile from config storage.

Return type:

adsfolio.pdf.prefetch.PublicationProfile

adsfolio.pdf.prefetch.match_pdf_from_prefetch(pdf_path, identifier, index)[source]

Match PDF against prefetched docs without performing ADS query.

Parameters:
Return type:

dict[str, Any] | None

adsfolio.pdf.prefetch.match_prefetch_from_doi_candidates(metadata_doi, text_doi, index)[source]

Match prefetched doc using pre-extracted DOI candidates.

Parameters:
Return type:

dict[str, Any] | None

adsfolio.pdf.prefetch.query_publications(client, profile)[source]

Query ADS publications for profile identity (ORCID + optional names).

Parameters:
Return type:

list[dict[str, Any]]