Go to file
JasonFraser 5cc1fe1ca7 Close the three Phase-1 loose ends: README, stray fixture, check findings
Add README.md - what the product is, docker compose up, project
layout, measure.py usage, pointer to CLAUDE.md for the deeper record.

Delete fixtures/ground_truth_sep_reference.xlsx - a bank-description
to accounting-category mapping from the separate bank_statement_
categorizer tool, not this product's own extraction ground truth, and
referenced nowhere in this repo. Nothing to repurpose it into, since
this product deliberately doesn't categorize transactions at all.

Investigate HSBC-Aug's running_balance failure and both fixtures'
engine_agreement findings - confirmed not extraction bugs. Built and
hand-verified fixtures/HSBC-USD-August2026_ground_truth.xlsx (all 31
transactions checked against the rendered PDF, including the Cancelled
wire and its two blank-balance rows) to prove it: 1.0 field accuracy.
The running_balance break is the Cancelled wire's -22,386.00 genuinely
not applying to the real balance chain - the check correctly flagging
that, not smoothing it over. engine_agreement on both fixtures is
Docling missing a table and pdfplumber's result being used instead,
exactly as designed, correctly flagged for lower confidence rather
than silently trusted.
2026-10-12 19:54:03 -04:00
backend Fix RBC's last transaction absorbing the Account Fees footer line 2026-10-12 19:31:54 -04:00
docs Initial commit: Phase 1 extraction, dual-engine checks, measurement harness 2026-10-11 07:56:19 -04:00
frontend Remove the seam between the header row and the filter row 2026-10-12 18:13:11 -04:00
outputs Initial commit: Phase 1 extraction, dual-engine checks, measurement harness 2026-10-11 07:56:19 -04:00
uploads Initial commit: Phase 1 extraction, dual-engine checks, measurement harness 2026-10-11 07:56:19 -04:00
zexample Initial commit: Phase 1 extraction, dual-engine checks, measurement harness 2026-10-11 07:56:19 -04:00
.gitignore Route scanned/photographed statements through Docling OCR 2026-10-11 09:04:24 -04:00
CLAUDE.md Close the three Phase-1 loose ends: README, stray fixture, check findings 2026-10-12 19:54:03 -04:00
Dockerfile Restructure frontend to Vue 3 + Vite (Stage 2 of 2) 2026-10-12 06:32:49 -04:00
ENTERPRISE_STANDARDS.md Fix edit-icon color, description autogrow, and add image zoom controls 2026-10-11 23:44:06 -04:00
README.md Close the three Phase-1 loose ends: README, stray fixture, check findings 2026-10-12 19:54:03 -04:00
UI_DESIGN_THEME.md Initial commit: Phase 1 extraction, dual-engine checks, measurement harness 2026-10-11 07:56:19 -04:00
UI_DESIGN_THEME_ENTERPRISE.md Initial commit: Phase 1 extraction, dual-engine checks, measurement harness 2026-10-11 07:56:19 -04:00
docker-compose.yml Initial commit: Phase 1 extraction, dual-engine checks, measurement harness 2026-10-11 07:56:19 -04:00
requirements.txt Add raw-OCR-word-box fallback for Docling table-structure failures 2026-10-11 17:22:34 -04:00

README.md

Bettersight Statement Extractor

Turns a bank statement PDF (or a scanned/photographed one) into clean, structured transaction rows, proves the arithmetic against seven automated checks, and exports to Excel. Supports HSBC and RBC statement layouts today, auto-detected rather than hardcoded per bank.

This is Phase 1 of the planned Bettersight product line - extraction + checks + export only. It deliberately does not categorize transactions (bank description → accounting description). See CLAUDE.md for the full architecture, the phase roadmap, and the reasoning behind most of the non-obvious decisions in this codebase.

Running it

docker compose up --build         # start everything (app + Docling), foreground
docker compose up --build -d app  # rebuild + restart just the app after a code change
docker compose down                # stop and remove both containers

Then open http://localhost:8091.

For frontend development with hot reload: cd frontend && npm run dev (Vite, proxies /api to the backend container) alongside docker compose up for the backend/Docling containers.

Project layout

backend/     Flask API - routes -> services -> repositories -> schemas
frontend/    Vue 3 + Vite SPA - views -> components -> composables -> services
fixtures/    Real statement PDFs + hand-verified ground truth, for measure.py
docs/        Reference material and test files not part of the measured corpus
results/     measure.py's own dated JSON reports (gitignored)

Measuring accuracy

python3 backend/measure.py

Runs every fixtures/*.pdf with a matching <name>_ground_truth.xlsx through the real extraction pipeline and reports two numbers: the untouched pass rate (statements that reach "Verified" with zero edits) and field accuracy (date/description/amount/balance, compared row-by-row against hand-verified ground truth). A fixture without ground truth is still run and reported, just without a field-accuracy score. Works with or without the Docling container up - degrades to pdfplumber-only per page if Docling is unreachable, the same fallback behavior the live app has.

A fixture's statement can legitimately land on "Failed" or "Needs review" even with 100% field accuracy - that's a check correctly flagging something real about the statement itself (a cancelled transaction, disagreement between the two extraction engines on a given page), not an extraction error. measure.py's field accuracy is what tells you whether the data is actually right; the pipeline status is a separate signal about how much automated confidence that statement earned.