bettersight-statement-extra.../backend/services
JasonFraser 326b43ba11 Add layout-mapper backend contract: fingerprinting + forced-mapping extraction (L.2)
Lays the backend groundwork for the layout mapper (no UI/PocketBase yet): when both
the keyword detector and the layout_quirks fallback fail on every page,
extraction_service.run() now raises LayoutMappingRequired with a computed fingerprint
instead of a dead-end error; routes/extraction.py returns this as a 422 with
{needs_mapping, fingerprint, fingerprintHash}. run()/pipeline_service.run() gained a
forced_mapping parameter that extracts directly from given column positions, bypassing
auto-detection entirely - the entry point a future manual mapping screen will use.

Two real gaps surfaced by testing against the actual problem statement, not assumed:
header_candidate_geometry() scans every page for the best candidate rather than just
page 1 (this statement's own page 1 is a pure cover page); a forced mapping had no
page-boundary concept, so a cover page's own letterhead merged into the first real
transaction - fixed with a new start_page field.

Verified: a synthetic unrecognizable PDF correctly triggers the 422 contract through
the real running container; the real problem statement, forced through a hand-built
mapping, now extracts 36/36 transactions with every check passing, matching the
auto-detected L.1 result exactly; measure.py byte-identical on HSBC/RBC throughout.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-14 08:09:34 -04:00
..
extraction Add layout-mapper backend contract: fingerprinting + forced-mapping extraction (L.2) 2026-10-14 08:09:34 -04:00
__init__.py Fix edit-icon color, description autogrow, and add image zoom controls 2026-10-11 23:44:06 -04:00
checks_service.py Fix edit-icon color, description autogrow, and add image zoom controls 2026-10-11 23:44:06 -04:00
excel_service.py Add review screen R.5: edit log, acknowledge/accept workflow, Excel Edits sheet 2026-10-13 20:41:13 -04:00
extraction_service.py Add layout-mapper backend contract: fingerprinting + forced-mapping extraction (L.2) 2026-10-14 08:09:34 -04:00
pipeline_service.py Add layout-mapper backend contract: fingerprinting + forced-mapping extraction (L.2) 2026-10-14 08:09:34 -04:00
suggested_fixes_service.py Add the suggested-fix engine for running-balance mismatches (R.3) 2026-10-13 16:09:16 -04:00