bettersight-statement-extra.../backend/services
JasonFraser 4764023d87 Add the manual layout mapping screen - the core deliverable of the layout mapper (L.6)
New /map-layout route (ManualMappingView.vue): draw a box over each column on the
source document, assign it a role, set date format/sign convention/ignored rows,
Preview (required before Save) runs the real forced-mapping extraction and shows
the first ten rows plus the balance check outcome, Save Mapping persists the
mapping + an initial version + the document. A real File can't survive a router
navigation, so a new layoutMapperStore holds the one pending file + fingerprint in
memory; ExtractorView.vue shows a banner linking to the mapper while one is set.

Two real bugs found by actually wiring this up and testing it end to end:
useBatchExtraction.js was reading fingerprintHash from the wrong (post-reassignment)
response, which never carries that field - would have silently left
documents.layoutFingerprintHash unset for every mapping-applied extraction. More
consequential: forced-mapping column zones were completely unpadded, so a word
landing a fraction of a point past a raw boundary (or a human's own imprecise drag)
could silently exclude a whole transaction with no error - fixed with a new
_FORCED_ZONE_PADDING in table_extract.py, the same discipline the auto-detected
path's own zones already use.

Verified end to end against a hand-built synthetic statement (unmatchable gibberish
headers, 3 real transaction rows at known coordinates) through the real rebuilt
container: Preview correctly extracts all 3 transactions with a passing balance
check; Save persists correctly (confirmed on the re-fetched document record, not
the create response); a second, independent upload of the identical file then
silently auto-applies the saved mapping with zero further input, producing
byte-identical results to the manual Preview - the actual proof this feature
exists for. measure.py byte-identical throughout; a regression re-run of the
earlier Equals Money forced-mapping test confirmed the zone-padding fix changed
nothing there. npm run build passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-14 21:48:20 -04:00
..
extraction Add the manual layout mapping screen - the core deliverable of the layout mapper (L.6) 2026-10-14 21:48:20 -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