From 97f62d7cc8a06a61f5ccae98e42e93b6bb1c4974 Mon Sep 17 00:00:00 2001 From: DEls Date: Mon, 19 Oct 2026 21:24:15 +0200 Subject: [PATCH] fix(deliveries): reader must not invent lines on rotated or cluttered photos Co-Authored-By: Claude Sonnet 5.5 --- src/lib/dn-pipeline/extract.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/dn-pipeline/extract.ts b/src/lib/dn-pipeline/extract.ts index 6d85743..28e36f4 100644 --- a/src/lib/dn-pipeline/extract.ts +++ b/src/lib/dn-pipeline/extract.ts @@ -134,6 +134,15 @@ Rules: or "Reg No" block (weighbridge tickets) names the lorry company, never the supplier. A Raumix, Drift or similar ticket stays that quarry's even when a haulier such as Herlendir or HC Sand is printed lower down. +- Photos may be rotated, sideways, upside down, blurred or taken on top of a + site drawing or map. Turn the paper the right way round in your head and read + only the slip itself; the drawing underneath is never part of the document. + Every item line, quantity, rate, date and number must be something you can + actually see printed or handwritten on the slip. If you cannot read a field + return null (and receiving_status unreadable for a quantity); if you cannot + read the item table at all return an empty items array and describe what you + see in raw_text. Never invent plausible lines, products, rates or numbers, + and never use a different slip's content as a guess. - po_number_raw: the customer order number exactly as printed (ours look like MEGCPO9476). Copy every letter and digit; never drop, add or swap a digit. - doc_number: the reference appropriate to that type - the delivery note