Picking/dropping a file replaced whatever was already staged (reported: "I select one document and start again to select another, the first one is replaced"). setFiles now appends instead, deduping exact name+size repeats, so a batch can be built up across several separate picks/drops, not just one multi-select dialog. Each staged file gets an x to remove it before Extract is clicked. The staging list is cleared the moment Extract runs (not after it resolves), so an already-handed-off file can't linger and get re-processed - and duplicated, since extractionStore.documents has no dedup of its own - by a later click. Also resets the native file input after each pick so re-selecting the same file (e.g. after removing it) still fires a change event. |
||
|---|---|---|
| backend | ||
| docs | ||
| frontend | ||
| outputs | ||
| uploads | ||
| zexample | ||
| .gitignore | ||
| CLAUDE.md | ||
| Dockerfile | ||
| ENTERPRISE_STANDARDS.md | ||
| README.md | ||
| UI_DESIGN_THEME.md | ||
| UI_DESIGN_THEME_ENTERPRISE.md | ||
| docker-compose.yml | ||
| requirements.txt | ||
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.