refactor(parser): extract bill detectors and engine #93

Closed
opened 2026-07-07 09:26:21 +01:00 by TimCane · 0 comments
TimCane commented 2026-07-07 09:26:21 +01:00 (Migrated from github.com)

Parent: #77 (Phase A, step 5). Invariants live in the epic.

Extract bill-field detection into detectors behind an engine. Completes Phase A.

Anchors

  • Grand-total detection: ReceiptParser.cs:117-134 (lowest Box.Y TOTAL row,
    same-row tie takes the larger amount).
  • Above-total classification: ReceiptParser.cs:139-195 - tax, tip, service,
    category-rollup, payment-noise, and the split-label case.
  • Helpers: LoneServiceLabel (290-291), ServiceLabel (48), ToMinor (215),
    GuessCurrency (219-235), MoneyAtEnd (25).

Steps

  1. Add bill detectors in Parsing for total, tax, tip, service,
    category-rollup, payment-noise, lone-service-label.
  2. Add a bill engine that preserves the positional logic: locate the grand total
    first, then classify only rows above it.

Done

  • Corpus 100% green, byte-identical output.
  • The old monolith is fully decomposed; ReceiptParser is a thin facade.
Parent: #77 (Phase A, step 5). Invariants live in the epic. Extract bill-field detection into detectors behind an engine. Completes Phase A. ## Anchors - Grand-total detection: `ReceiptParser.cs:117-134` (lowest `Box.Y` TOTAL row, same-row tie takes the larger amount). - Above-total classification: `ReceiptParser.cs:139-195` - tax, tip, service, category-rollup, payment-noise, and the split-label case. - Helpers: `LoneServiceLabel` (290-291), `ServiceLabel` (48), `ToMinor` (215), `GuessCurrency` (219-235), `MoneyAtEnd` (25). ## Steps 1. Add bill detectors in `Parsing` for total, tax, tip, service, category-rollup, payment-noise, lone-service-label. 2. Add a bill engine that preserves the positional logic: locate the grand total first, then classify only rows above it. ## Done - [ ] Corpus 100% green, byte-identical output. - [ ] The old monolith is fully decomposed; `ReceiptParser` is a thin facade.
Sign in to join this conversation.
No description provided.