tetrak_ocr.triageΒΆ

The triage queue: what was held, why, and a local page that lists it.

batch diverts a file whose best transcript falls below the quality floor into workspace/triage/, with a Markdown manifest a person can read. That manifest carried a 500-character excerpt of each candidate transcript and the rest was discarded, so a decision about a page was often made on a fragment, and a view of the queue could not show what had never been saved (brief 001, the triage dashboard).

A held item is now three kinds of file, side by side:

<stem>.md                 the manifest, exactly as before
<stem>.json               the record: every candidate's score, the
                          reason the file was held, and where each
                          full transcript is
<stem>.<backend>.txt      each candidate's transcript, whole

The record is what a view loads; the manifest stays for anyone who reads the directory directly. Nothing here edits a transcript or moves a file: triage is passive by design, and this module reads what batch wrote.

tetrak-ocr triage prints the queue; tetrak-ocr triage --serve serves it as a page. The server binds to the loopback address and nothing else, takes no option to bind elsewhere, answers GET for one page and refuses everything else. It reads a local directory for the person sitting at the machine, so there is nothing to authenticate and nothing remote.

Functions

describe(items, triage_dir)

The queue as a table for the terminal.

hold(triage_dir, image, scores, transcripts, ...)

Write the record and every full transcript for a file being held.

make_server(triage_dir[, port])

A server for the queue page, bound to the loopback address.

queue(triage_dir)

Every held item in triage_dir, by name.

render(items, triage_dir)

The queue as one HTML page: every item, its best score and why it was held.

serve(triage_dir[, port])

Serve the queue page until interrupted.

transcript_name(stem, backend)

Where a candidate's full transcript goes, beside the manifest.

Classes

Candidate(backend, score, transcript)

One backend's attempt at a held file.

Item(stem, file, reason, held_at, backend, ...)

One held file, as the queue lists it.