Skip to content

feat(batch): write a CSV manifest of each file, as a beta - #23

Merged
stephen-masters merged 1 commit into
mainfrom
feat/batch-manifest
Oct 16, 2026
Merged

stephen-masters merged 1 commit into
mainfrom
feat/batch-manifest

Conversation

@stephen-masters

Copy link
Copy Markdown
Contributor

tetrak-ocr batch --manifest [PATH] appends one row per file to workspace/manifest.csv. It's for the spreadsheets small archives keep their catalogues in, and for collections systems that import a CSV, such as Omeka S's CSV Import. This is the roadmap's CSV manifest item.

Columns

Column What it holds
file The scan's file name, as it was in scans/
status processed, triage or error
backend The backend the run asked for
engine The engine whose transcript was kept or rejected; under auto-local, the one that won
quality The transcript's quality score, when it was scored
quality_gate passed, failed, skipped (not Latin script, so not scoreable) or off
transcript The full transcript; empty for a triaged file
outputs The files written for it, relative to workspace/, separated by ;
location Where the scan is now, relative to workspace/
note Why a file went to triage, or what went wrong
run The run's id in the telemetry log
finished_at When the file finished, in UTC
tetrak_version The Tetrak release that read it

Decisions worth reviewing

  • Opt-in, and marked beta in the help text, the docs and the module. The columns are a first proposal, to change after review by people who'll import it.
  • Appended across runs, with the header written once, as workspace/processed/ grows. A manifest whose header differs from this version's is refused before any scan moves, so its rows can't end up misaligned.
  • A triaged file gets a row with no transcript. Importing the manifest therefore never takes in a reading the gate rejected. The triage report beside the scan still has the excerpts.
  • auto-local reports its chosen engine through a module-level last_choice. ocr_image returns only a transcript, under the fixed backend contract, so the choice had no other way out. It's process-global, like the telemetry sink.
  • UTF-8 without a BOM, which is what import tools expect. The docs tell Excel users to open the file with Data > From Text/CSV so non-Latin transcripts survive.

Checked

  • pytest -m "not slow": 378 passed, including 19 new tests in tests/ocr/test_manifest.py. They cover every status, the gate's four verdicts, auto-local's engine on success and on triage, appending, a named path, the header refusal, the run id and the CLI forwarding.
  • ruff, plus sphinx-build -W.
  • A real run with auto-local --pdf --manifest on seven scans. The rows in the guide are from that run.

Found on the way, not fixed here

  • auto-local sends Armenian pages to triage. Its own gate uses the English-only score, without the non-Latin skip that --quality-gate has. In the real run, an Armenian page scored 0.0502 and was triaged. That bug predates this branch.
  • tetrak-ocr ocr img --format pdf --output x.pdf writes the plain-text transcript to x.pdf, and the real PDF next to the source image. --pdf PATH works.

🤖 Generated with Claude Code

`tetrak-ocr batch --manifest [PATH]` appends a row per file to
workspace/manifest.csv: file, status, backend, the engine that read it,
quality and the gate's verdict, the transcript, the outputs, where the
scan is now, a note, the run id, the time and the Tetrak release. It is
for the spreadsheets small archives keep and for CSV imports such as
Omeka S's CSV Import, and it doubles as the record of what still needs a
person: triaged and failed files get rows too, with no transcript, so an
import never takes a reading the gate rejected.

Opt-in and marked beta, so the columns can change after the first
review. A manifest with another header is refused before any scan moves.
auto-local records the engine it chose in a module-level last_choice,
since ocr_image returns a transcript alone.

Roadmap item (CSV manifest), for brief 006's scenes 1 and 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying tetrak with  Cloudflare Pages  Cloudflare Pages

Latest commit: 873cebd
Status: ✅  Deploy successful!
Preview URL: https://1249e9fd.tetrak.pages.dev
Branch Preview URL: https://feat-batch-manifest.tetrak.pages.dev

View logs

@stephen-masters
stephen-masters merged commit 77154b4 into main Oct 16, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant