mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
fix(labs): treat a PDF's text layer as a fenced hint and keep the day's counter current
The text layer went to the model as the authority for digits. It is not one: a scanned PDF often carries an invisible OCR layer with its own mistakes, a subset font can map to the wrong characters, and a crafted PDF can carry invisible text that differs from what the reviewer sees. The prompt now calls it a hint only, makes the image authoritative, forbids adding a value the image does not show, and asks for a low value confidence where the two disagree. The layer is fenced with the document text markers, which it cannot close, and so is text mode's OCR'd text. Each page's layer is capped while it is collected, and a read shares its text budget out per page, cut at a line and marked, so a long first page no longer pushes the later ones out. A further read now first books what the reads so far cost beyond their reservation, then its own ceiling, both against the cap of the owner the route judged the first read by, so the counter the next read is judged against never lags. The wire is re-checked before every read, the first included. A re-check or reservation that itself fails stops the scan with the pages read rather than failing it, and a scan stopped before any row answers with the stop's reason (budget, or the wire's own refusal) instead of an unreadable page.
This commit is contained in:
1 parent
79d905f089
commit
bfc7991935
9 files changed
+478
-93
No files matched your search
@@ -71351,11 +71351,12 @@ components:
|
||||
- rows
|
||||
additionalProperties: false
|
||||
description: The proposed rows for the human review screen, served by `GET /api/ai-runs/{id}` for a `LABS_OCR_EXTRACT`
|
||||
run. A PDF of more than one page is read a page at a time, each rendered page sent with its text layer, and the
|
||||
pages merged in order, a reading an earlier page already listed listed once. Never written to the person's
|
||||
record; the commit route is the only write. A run in which no read produced a single complete row fails with 422
|
||||
`labs.ocr.outputLimit` when the reads stopped at the provider's output limit, else `labs.ocr.extractFailed`;
|
||||
OCR'd text too long for the reads the deadline allows is refused up front with 422 `labs.ocr.tooLarge`.
|
||||
run. A PDF of more than one page is read a page at a time, each rendered page sent with its text layer as a hint
|
||||
the image overrules, and the pages merged in order, a reading an earlier page already listed listed once. Never
|
||||
written to the person's record; the commit route is the only write. A run in which no read produced a single
|
||||
complete row fails with 422 `labs.ocr.outputLimit` when the reads stopped at the provider's output limit, else
|
||||
`labs.ocr.extractFailed`; OCR'd text too long for the reads the deadline allows is refused up front with 422
|
||||
`labs.ocr.tooLarge`.
|
||||
OcrExtractedRow:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
Reference in new issue
Block a user