T
Sign in

GAP-EXPECTATION.md — what the docs promise vs what is shipped (owner-alignment)

GAP-EXPECTATION.md — what the docs promise vs what is shipped (owner-alignment)

Written after the owner said: "I have already said in other sessions while building the form that there will be handwritten text. There is so much OCR discussion before and you still had deployed just for number plate… Let's work on that. Read all the docs and tell me what you think I have to build." This file records the expectation (cited) and the honest deltas.

1. What the docs commit to (the expectation)

  1. Scan is the default floor input mode — PLANNING §2/§3: every floor screen is auto/select/scan/number; labour screens end zero free-text; floor notes are photos, not text. Lots, beams, rolls and bales carry QR/barcodes (rolls/lots/beams already have barcodes in the schema).
  2. OCR + photo is the intake mechanism for handwritten paper — PLANNING §12 (C2): "mtrs/fields entered later by planning; OCR prefills with manual check (handwritten GPs → learn)"; PLANNING §13/#2 + §12: handwritten hishob slips to OCR (same intake pattern as gatepasses — the slips are "still pending" receiver input); D3: fabric-in slip OCR + per-roll confirm; C2 sizing-receipt photos.
  3. Rate lists & broker contracts (+forwards) enter via WhatsApp photo/PDF → OCR — PLANNING §16: rate-list images → OCR → today's rates with clarification prompts; broker contract photo/PDF; copied text; an /upload + OCR pipeline.
  4. Template / layout learning — PLANNING §12 "handwritten GPs → learn", §16 per-sender template learning, §15 A1 capture with a11y floating capture; ROADMAP Phases 3–4: checking-report and physical paper enters via photo/OCR+confirm; the Android companion (Trading Capture APK, already scaffolded) exists to grab WhatsApp forwards and screenshots.

2. What is shipped today (the reality)

  • OCR = local tesseract, English printed text: vehicle plates (camera buttons on gatepass/dispatch/guard) and /capture photo/PDF → draft (forward text also parses). PSM retry added.
  • QR/barcodes exist on lots/rolls/beams/GPs but there is no camera scanner UI anywhere — no scan mode; everything is selects/typing.
  • Handwritten text: not supported. Tesseract does not read handwriting; no template/layout mapping exists for the fixed paper forms.
  • The "pending" owner samples that the docs require for handwriting tuning (GP photos, hishob slips, sizing receipts, rate lists) are still in the shel.

3. The gap (your expectation − my shipment)

Doc promise Shipped Delta
Scan-first floor (QR everywhere, zero typing) No scanner UI Missing — a camera scanner is a first-class screen
OCR-first intake: handwritten GPs, hishob slips, sizing receipts, fabric-in slips Printed-text OCR only Handwriting + form templates not built
Template/layout learning per document type None Missing — needs per-form field templates
Rate-list OCR → rates with clarification Manual rate entry only Rate OCR ingestion missing
Capture pipeline: photo → OCR → draft fields → CONFIRM → record Photo → free-text draft → confirm Field-level draft + confirm flow partial
Android companion grabs forwards/screenshots APK scaffolded, unbuilt Build + ship the APK

4. What I think has to be built (the plan)

  1. Capture OCR pipeline (core): photo/PDF → preprocess (deskew, binarize) → OCR → per-form template (fixed layout of the paper formats: gatepass, hishob slip, sizing receipt, rate list, fabric-in slip) → field-level draft (each OCR'd value in its labeled field with a confidence) → confirm screen (tap-fix per field, then create the record). This is the docs' intake design made real.
  2. Handwriting: two honest routes — (a) template-position OCR: the printed forms have FIXED boxes/tables → crop each field box, OCR the box (digit whitelists for numbers) — works for handwriting in fixed fields without any cloud; (b) cloud handwriting OCR (Vision/ Textract) for free-hand notes — needs the owner's API keys/budget. Start with (a), add (b) only if the owner agrees.
  3. Scanner UI: camera QR/barcode scan for rolls/lots/beams/GPs into every screen where the docs say "scan" (guard inward code, godown receipts, checking rolls, weft issue, stock take, dispatch).
  4. Rate-list OCR ingestion wired into /rates.
  5. Ship the Android Trading Capture APK (forwards + screenshots + scanner) once built.
  6. Owner inputs that unblock the handwriting half: the blank + filled samples already named in the shelf — yarn/sizing-return gatepass photos, hishob slips, sizing receipts, rate-list images, and one broker contract photo. Without real samples, tuned handwriting OCR cannot be verified.

5. Decision needed from the owner

  • Handwriting route: local template-position OCR now (free, offline) vs cloud handwriting OCR (needs API keys + cost) — or both.
  • Priority order of the six items above (my recommendation: 1 → 3 → 2 → 4 → 5).