adsfolio.pdf.identify
Cached PDF identification workflow.
- class adsfolio.pdf.identify.IdentifyWorkflowHelpers(parallel_map_paths, to_sidecar_key, format_elapsed, profile_sync_payload, estimate_ads_queries_for_targets, should_prompt_ads_permission, confirm_ads_queries, progress_reporter_factory, build_progress, parallel_extract_first_page_previews, write_unresolved_csv, print_unresolved_ai_prompt, resolve_from_ai_csv, ads_block_risk_threshold)[source]
Bases:
objectCallbacks retained by the PDF CLI while its commands share them.
- Parameters:
parallel_map_paths (collections.abc.Callable[[...], dict[pathlib.Path, Any]])
to_sidecar_key (collections.abc.Callable[[pathlib.Path, pathlib.Path], str])
format_elapsed (collections.abc.Callable[[float], str])
profile_sync_payload (collections.abc.Callable[[Any], dict[str, Any]])
estimate_ads_queries_for_targets (collections.abc.Callable[[...], dict[str, Any]])
should_prompt_ads_permission (collections.abc.Callable[[], bool])
confirm_ads_queries (collections.abc.Callable[[...], tuple[str, int]])
progress_reporter_factory (collections.abc.Callable[[], Any])
build_progress (collections.abc.Callable[[...], Any | None])
parallel_extract_first_page_previews (collections.abc.Callable[[...], dict[pathlib.Path, str]])
write_unresolved_csv (collections.abc.Callable[[...], pathlib.Path | None])
print_unresolved_ai_prompt (collections.abc.Callable[[pathlib.Path], None])
resolve_from_ai_csv (collections.abc.Callable[[...], dict[pathlib.Path, dict[str, Any]]])
ads_block_risk_threshold (int)
- build_progress: collections.abc.Callable[[...], Any | None]
- confirm_ads_queries: collections.abc.Callable[[...], tuple[str, int]]
- estimate_ads_queries_for_targets: collections.abc.Callable[[...], dict[str, Any]]
- format_elapsed: collections.abc.Callable[[float], str]
- parallel_extract_first_page_previews: collections.abc.Callable[[...], dict[pathlib.Path, str]]
- parallel_map_paths: collections.abc.Callable[[...], dict[pathlib.Path, Any]]
- print_unresolved_ai_prompt: collections.abc.Callable[[pathlib.Path], None]
- profile_sync_payload: collections.abc.Callable[[Any], dict[str, Any]]
- progress_reporter_factory: collections.abc.Callable[[], Any]
- resolve_from_ai_csv: collections.abc.Callable[[...], dict[pathlib.Path, dict[str, Any]]]
- should_prompt_ads_permission: collections.abc.Callable[[], bool]
- to_sidecar_key: collections.abc.Callable[[pathlib.Path, pathlib.Path], str]
- write_unresolved_csv: collections.abc.Callable[[...], pathlib.Path | None]
- adsfolio.pdf.identify.build_cached_candidate_lookup(identifier, registry, documents)[source]
Build a unique cached-document lookup for every strategy candidate kind.
- adsfolio.pdf.identify.build_checked_record(identifier, document, path, sha256)[source]
Build a record, or note why the PDF does not prove document.
- adsfolio.pdf.identify.cached_ads_record(registry, identifier, path, doi='', bibcode='', sha256='')[source]
Return cache-hit status and a unique folder-cache identify record.
A cached document that the PDF does not prove is reported as a cache hit without a record, and the reason is kept in
identifier.identity_failures.
- adsfolio.pdf.identify.print_cache_status(cached)[source]
Print cache age and document count for an identify run.
- Parameters:
cached (adsfolio.pubcache.CachedPublications | None)
- Return type:
None
- adsfolio.pdf.identify.run_identify(client, directory, *, helpers, recursive, debut_year, end_year, refresh_cache, output_unresolved, skip_unresolved_directory, apply, verbose_parser, strategies, allow_ads, ai_csv, verbose, profile=None, prompt_for_ai_csv=True, providers=(DoiProvider.ADS, DoiProvider.CROSSREF, DoiProvider.DATACITE), paths=None)[source]
Identify PDFs and persist their ADS metadata.
paths, when given, are the PDFs to identify in place of a scan of directory. They must lie inside directory. The unresolved directory is not skipped for them, because the user chose them.
- Parameters:
client (Any)
directory (pathlib.Path)
recursive (bool)
debut_year (int | None)
end_year (int | None)
refresh_cache (bool)
output_unresolved (pathlib.Path | None)
skip_unresolved_directory (bool)
apply (bool)
verbose_parser (bool)
strategies (tuple[adsfolio.pdf.identify_settings.IdentifyStrategy, ...])
allow_ads (bool)
ai_csv (pathlib.Path | None)
verbose (int)
profile (adsfolio.pdf.prefetch.PublicationProfile | None)
prompt_for_ai_csv (bool)
providers (tuple[adsfolio.pdf.doi_providers.DoiProvider, ...])
paths (collections.abc.Sequence[pathlib.Path] | None)
- Return type:
None