torchcell.literature

The literature capture subsystem. It reads papers and supplementary files from Zotero (zotero), OCRs or extracts them into markdown (ocr, extract, scanned), fetches supplementary data (si_data), and records a sha256 provenance manifest for every stored artifact (manifest, provenance) in the on-disk mirror. server is the read-only HTTP endpoint (tc-lit-server) that serves the mirrored artifacts, and sync reconciles the mirror against a Zotero collection.

Classes

BackfillReport

Summary of a mirror-wide backfill run.

Manifest

Provenance + integrity record for one paper's captured artifact.

LiteratureServerConfig

Runtime configuration for the literature endpoint.

LiteratureKeys

The shared ApiKeys model bound to the TC_LIT_* variables.

ZoteroConfig

Credentials for a single Zotero library.

ZoteroLibrary

Synchronous handle to one Zotero library.

Functions

backfill_key

Regularize one citation-key directory to a manifest.json.

backfill_mirror

Backfill manifests for every citation-key directory under root.

capture_by_doi

Capture a paper's full artifact from Zotero + external SI data.

generate_citation_key

Generate a Better BibTeX-style citation key from paper metadata.

build_manifest

Scan an artifact directory and build its manifest.

write_manifest

Write manifest.json into the artifact directory; return its path.

ocr_artifact

OCR every PDF in an artifact directory: paper.pdf and each si/si*.pdf.

ocr_pdf

OCR one PDF to markdown next to it (<stem>.pdf -> <stem>.md).

create_app

Build the FastAPI app bound to config (config stored on app.state).

create_app_from_env

Factory for uvicorn --factory torchcell.literature.server:create_app_from_env.

dryad_files

Resolve a DRYAD dataset DOI to [(filename, download_url), ...].

fetch_si_data

Download SI data files into <artifact_dir>/si/si_data/.

make_zotero_client

Construct a pyzotero client from a ZoteroConfig.

with_zotero_retry

Run a zero-arg Zotero call with bounded exponential-backoff retry.