Skip to content

v0.5.0

Choose a tag to compare

@oldantique oldantique released this 29 Jul 09:59

zotkit enrich — complete existing items, in place

Incomplete library items — missing abstracts, missing DOIs, author lists truncated at import time, preprints that have since been published — could previously only be fixed by delete-and-recreate (unacceptable: the item key changes, and keys are the stable handle downstream manifests reference) or hand-written pyzotero scripts. Now it's a first-class command:

zotkit enrich --key K [K …]              # dry-run: per-item list of what would be filled
zotkit enrich --key K --apply
zotkit enrich --key K --rebuild-record --apply   # preprint → journal record, same item

The item key never changes. Every write is an in-place fetch→modify→update carrying the item version — a concurrent edit fails that one item with 412 (reported, batch continues) instead of clobbering.

What it does

  • Finds the authoritative identifier (DOI field, or arXiv id from archiveID / arXiv: Extra line / arxiv.org URL / arXiv's DataCite DOI; journal DOI wins per the v0.4.2 version-of-record rule) and pulls the record through the same rate-limited fetchers create uses. No identifier → skipped as needs-identifier.
  • Fills empty fields only — abstract, date, url, volume/issue/pages, ISSN, journal abbreviation, DOI, … Existing non-empty values are never overwritten.
  • Creators: extended only when the current list is a same-order prefix of the authoritative one (the classic 4-of-227 truncation); any other difference is reported and left alone.
  • Stale-stamp rule: an abstract-source: stamp with no abstract means an owner deliberately removed it — enrich refuses to re-add and reports NEEDS OWNER. Every abstract it writes is stamped with its true origin.
  • Extra only gains lines; tags, collections, relations, and attachments are never touched.
  • --rebuild-record: a preprint with a journal DOI is upgraded to the journal record in the same item — itemType, published title/date/venue/volume/pages — with arXiv: <id> preserved in Extra and the child-item count asserted unchanged.
  • Summary + exit code: enriched N / skipped M (needs-identifier, stale-stamp, up-to-date) / failed K; non-zero exit only when something failed.

Also

  • The CrossRef polite-pool contact is now configurable: export ZOTKIT_MAILTO=you@example.com (it should be a reachable address — distributors of zotkit-based tools, please set your own).

Install/upgrade: pipx upgrade zotkit