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> |
||
|---|---|---|
| .. | ||
| repositories | ||
| routes | ||
| schemas | ||
| services | ||
| app.py | ||
| dependencies.py | ||
| measure.py | ||