adsfolio.pdf.upgrade_utils

Utility models and helpers for arXiv upgrade workflow.

class adsfolio.pdf.upgrade_utils.PublishedMatch(bibcode, document)[source]

Bases: object

Published bibcode resolution result.

Parameters:
bibcode: str
document: dict[str, Any]
class adsfolio.pdf.upgrade_utils.UpgradeResult(original_filename, current_filename, old_bibcode, new_bibcode, status, message, downloaded_path=None, backup_path=None, annotations_ported=0, annotations_failed=0, unported_annotations_file=None)[source]

Bases: object

Result for one sidecar-entry upgrade attempt.

Parameters:
  • original_filename (str)

  • current_filename (str)

  • old_bibcode (str)

  • new_bibcode (str | None)

  • status (str)

  • message (str)

  • downloaded_path (str | None)

  • backup_path (str | None)

  • annotations_ported (int)

  • annotations_failed (int)

  • unported_annotations_file (str | None)

annotations_failed: int = 0
annotations_ported: int = 0
backup_path: str | None = None
current_filename: str
downloaded_path: str | None = None
message: str
new_bibcode: str | None
old_bibcode: str
original_filename: str
status: str
unported_annotations_file: str | None = None
adsfolio.pdf.upgrade_utils.check_published_version(client, bibcode)[source]

Check whether arXiv bibcode has a published counterpart in ADS.

Returns published bibcode + doc if found, else None.

Parameters:
Return type:

PublishedMatch | None

adsfolio.pdf.upgrade_utils.check_published_versions(client, bibcodes)[source]

Check published counterparts for many arXiv bibcodes with batched queries.

Returns a mapping arxiv_bibcode -> PublishedMatch | None.

Parameters:
Return type:

dict[str, PublishedMatch | None]

adsfolio.pdf.upgrade_utils.detect_arxiv_entries(sidecar)[source]

Return sidecar keys that are identified as arXiv entries.

Parameters:

sidecar (Any)

Return type:

list[str]

adsfolio.pdf.upgrade_utils.is_arxiv_bibcode(bibcode)[source]

Return True if bibcode appears to be arXiv-derived.

Parameters:

bibcode (str)

Return type:

bool

adsfolio.pdf.upgrade_utils.is_arxiv_doi(doi)[source]

Return True if DOI is arXiv DOI namespace.

Parameters:

doi (str)

Return type:

bool

adsfolio.pdf.upgrade_utils.is_arxiv_entry(entry)[source]

Detect whether sidecar metadata corresponds to arXiv source.

Parameters:

entry (dict[str, Any])

Return type:

bool