Skip to content

fix(receipt): detect subtotal/total when OCR splits label and amount - #46

Merged
slaveofcode merged 2 commits into
developfrom
fix/receipt-row-grouping
Jul 30, 2026
Merged

fix(receipt): detect subtotal/total when OCR splits label and amount#46
slaveofcode merged 2 commits into
developfrom
fix/receipt-row-grouping

Conversation

@slaveofcode

Copy link
Copy Markdown
Owner

Bug: on real receipts, subtotal/total/tax fields came back empty even when the raw text clearly showed Subtotal $100.00.

Cause: PP-OCR detects the label and the amount as two separate boxes on the same row. The parser required the keyword and the amount on the same line, so Subtotal (no number) and $100.00 (no keyword) each failed.

Fix: groupRows() merges same-row detections (by vertical overlap) into one line before the finders run — mirroring how the display text is already assembled. Fixes both the OCR Parse as receipt mode and the Receipt Scanner tool (shared parseReceipt).

Reproduced with a split-segment test; 470 tests pass, lint clean, build green.

slaveofcode and others added 2 commits July 31, 2026 06:08
Promote to production: Image OCR + Receipt Scanner
PP-OCR emits a label and its amount as separate boxes on the same visual row,
so 'Subtotal'/'$100.00' never matched (keyword and amount were on different
lines) — subtotal/total/tax came back empty. Group detections into rows by
vertical overlap first, then run the finders. Fixes both the OCR 'Parse as
receipt' mode and the Receipt Scanner tool.

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

cloudflare-workers-and-pages Bot commented Jul 30, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
goodwebtools c25201e Jul 30 2026, 11:30 PM

@slaveofcode
slaveofcode merged commit b766de1 into develop Jul 30, 2026
1 of 2 checks passed
@slaveofcode
slaveofcode deleted the fix/receipt-row-grouping branch July 30, 2026 23:30
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