bettersight-statement-extra.../backend/services/extraction
JasonFraser 92ba5f4386 Wire frontend fingerprint-lookup orchestration for the layout mapper (L.4)
useBatchExtraction.js now reacts to a needs_mapping:true response: looks up an
exact or near-match layout mapping (layoutMappingsService.js), applies it silently
on an exact match, asks for confirmation on a stale exact match or a near match via
a real ConfirmModal wired through ExtractorView.vue (not a placeholder), and falls
through to reason:'no_match' when nothing matches (the manual mapping screen's own
entry point, not built yet). A used mapping's usage is recorded for drift detection
and persisted onto the saved document record.

Found and fixed two real bugs in the near-match comparator by testing it against
the spec's own documented example (Debit/Credit renamed to Withdrawals/Deposits):
compute_fingerprint was building header_labels from whole header LINES instead of
per-field label text, making a two-word rename indistinguishable from a totally
different layout; added a field_labels map so the comparison is per-field. Even
after that, the first 70% overlap threshold still failed the documented example
itself (a 4-field rename of 2 fields is exactly 50%) - corrected to 50%, derived
from the example's own real numbers.

Verified: 18 assertions against the real layoutMappingsService/useLayoutMapping
(hard gates, the corrected per-field overlap, real PocketBase ownership/sharing
rules, stale-mapping decline/accept, no-match reporting); the real rebuilt
container's /api/process response now carries the fixed field_labels shape;
measure.py byte-identical throughout; npm run build passes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-14 19:51:42 -04:00
..
__init__.py Fix edit-icon color, description autogrow, and add image zoom controls 2026-10-11 23:44:06 -04:00
docling_parser.py Fix edit-icon color, description autogrow, and add image zoom controls 2026-10-11 23:44:06 -04:00
layout_fingerprint.py Wire frontend fingerprint-lookup orchestration for the layout mapper (L.4) 2026-10-14 19:51:42 -04:00
layout_quirks.py Add modular layout-quirks tier; fix a new statement's wrapped header, $-prefixed amounts, and ISO dates 2026-10-14 01:09:43 -04:00
layout_rules.py Add modular layout-quirks tier; fix a new statement's wrapped header, $-prefixed amounts, and ISO dates 2026-10-14 01:09:43 -04:00
raw_ocr_extract.py Add modular layout-quirks tier; fix a new statement's wrapped header, $-prefixed amounts, and ISO dates 2026-10-14 01:09:43 -04:00
table_extract.py Add layout-mapper backend contract: fingerprinting + forced-mapping extraction (L.2) 2026-10-14 08:09:34 -04:00