Update CLAUDE.md to reflect measure.py, RBC fixture, and git init
Marks the three items done in the previous commit as complete in the outstanding checklist, with detail on what was verified and how; flags the two things that surfaced in the process but are still open: the mismatched (categorization, not extraction) ground_truth_sep_reference.xlsx, and the pre-existing HSBC-Aug/RBC check failures measure.py now makes visible. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
0b0960769b
commit
84302e28b3
87
CLAUDE.md
87
CLAUDE.md
|
|
@ -61,18 +61,15 @@ are intentional scope decisions, not drift.
|
|||
"not the full review screen" scope decision) is built and has had extensive
|
||||
layout/theme polish — see "Frontend / UI state" below.
|
||||
|
||||
**What Phase 1 still doesn't have (confirmed by checking the actual repo, not assumed):**
|
||||
- **No `measure.py`.** The plan's step 10 — a lightweight harness that runs both HSBC
|
||||
fixtures through the pipeline, diffs against ground truth, and logs a dated JSON result
|
||||
under `results/` — was never written. `results/` exists but is empty. Any accuracy
|
||||
validation done so far was ad hoc (manual comparison during the build), not a
|
||||
reproducible, re-runnable measurement.
|
||||
- **No RBC fixture/ground truth**, as above — the RBC generalization work is real and
|
||||
live in `table_extract.py`, but not regression-protected by a committed fixture.
|
||||
- **Not a git repository.** A `.gitignore` exists but `git init` was never run — there is
|
||||
no commit history, no way to diff/revert changes, and nothing is backed up anywhere
|
||||
beyond the local filesystem. This was flagged, not yet acted on.
|
||||
- No `README.md`.
|
||||
**As of 2026-10-11, the measurement harness, RBC fixture, and git init from the gaps
|
||||
below are done — see "Outstanding before Phase 1 can be called done" for current detail.
|
||||
Kept here as the historical record of what this section originally found missing:**
|
||||
- ~~No `measure.py`~~ — now `app/measure.py`, run and verified against the real
|
||||
dual-engine pipeline.
|
||||
- ~~No RBC fixture/ground truth~~ — now `fixtures/RBC-CAD-Aug26.pdf` +
|
||||
`..._ground_truth.xlsx`, hand-verified.
|
||||
- ~~Not a git repository~~ — `git init` done, initial commit `16f74f7`.
|
||||
- No `README.md` — still undecided.
|
||||
|
||||
**Docling spike finding (why the extractor is dual-engine, not Docling-primary):** a real
|
||||
4-page HSBC statement was run through Docling requesting `to_formats=[md, json]`. Docling's
|
||||
|
|
@ -103,9 +100,14 @@ docker compose down # stop and remove both containers
|
|||
|
||||
- App: http://localhost:8091
|
||||
- No hot reload — template/code edits require a rebuild to show up.
|
||||
- There is no test suite and no `measure.py` yet (see "Build scope & status" above) —
|
||||
`python3 -m py_compile <file>` is the fastest available sanity check after editing a
|
||||
`.py` file.
|
||||
- There is still no test suite, but the measurement harness now exists:
|
||||
`python3 app/measure.py` (from the repo root; needs `openpyxl`, `pdfplumber` on
|
||||
PATH/venv — the same `requirements.txt` the app itself uses) runs every
|
||||
`fixtures/*.pdf` with a matching `*_ground_truth.xlsx` through the real pipeline and
|
||||
reports untouched pass rate + field accuracy. Works with or without the Docling
|
||||
container up (degrades to pdfplumber-only per page if unreachable — same behavior as
|
||||
the live app). `python3 -m py_compile <file>` is still the fastest sanity check after
|
||||
editing a `.py` file that doesn't have fixture coverage.
|
||||
|
||||
## Architecture
|
||||
|
||||
|
|
@ -139,6 +141,14 @@ docker compose down # stop and remove both containers
|
|||
is "not available." Running-balance and date-ordering checks try both directions and
|
||||
pick whichever has fewer violations, rather than assuming one.
|
||||
- `app/excel_export.py` — Transactions + Summary sheet export.
|
||||
- `app/measure.py` — the measurement harness. Auto-discovers its corpus from
|
||||
`fixtures/*.pdf` with a matching `*_ground_truth.xlsx` sibling (each ground-truth file
|
||||
is a `Transactions` sheet of date/status/description/amount/balance rows in the same
|
||||
canonical, newest-first order as pipeline output, plus a `Summary` sheet with
|
||||
opening_balance/closing_balance), runs each through the real `pipeline.run`, and
|
||||
reports/logs both of the spec's section-11 measures. Position-matched field comparison
|
||||
(not matched by value), so a swapped-order bug shows up as a mismatch rather than being
|
||||
silently absorbed.
|
||||
- `templates/index.html` — the entire frontend: a single vanilla-JS page, no framework,
|
||||
no build step. See "Frontend / UI state" below — it has been through many rounds of
|
||||
layout and theme iteration and the current state is not obvious from a first read.
|
||||
|
|
@ -222,11 +232,50 @@ Key current UI behaviors, each the result of an explicit, specific user request
|
|||
|
||||
## Outstanding before Phase 1 can be called done
|
||||
|
||||
- [ ] Write `measure.py` (the harness from the plan's step 10) and actually run it.
|
||||
- [ ] Commit an RBC fixture + hand-derived ground truth, so the RBC generalization work
|
||||
is regression-protected like the HSBC work already is.
|
||||
- [ ] `git init` this repo (currently has zero version control).
|
||||
- [x] Write `measure.py` (the harness from the plan's step 10) and actually run it. Lives
|
||||
at `app/measure.py`, run as `python3 app/measure.py` from the repo root (or inside
|
||||
the `app` container). Auto-discovers its corpus: every `fixtures/*.pdf` with a
|
||||
matching `<name>_ground_truth.xlsx` sibling is measured for both of section 11's
|
||||
measures (untouched pass rate, field accuracy on date/description/amount/balance,
|
||||
position-matched); a fixture with no ground truth still gets an untouched-pass
|
||||
reading but is reported as "no ground truth" for field accuracy, never silently
|
||||
skipped. Writes a dated JSON report to `results/` (gitignored — each run produces a
|
||||
new file, not meant to be committed) and prints a console summary. Confirmed
|
||||
working against the real dual-engine pipeline (Docling + pdfplumber, not a fallback
|
||||
stub) as of 2026-10-11.
|
||||
- [x] Commit an RBC fixture + hand-derived ground truth — `fixtures/RBC-CAD-Aug26.pdf`
|
||||
(copied from `docs/RBC-CAD-Aug26.pdf`, which the user had placed there) plus
|
||||
`fixtures/RBC-CAD-Aug26_ground_truth.xlsx`, hand-verified by reading all 4 statement
|
||||
pages visually (via `pdftoppm`/poppler) against the extractor's own output — all 108
|
||||
transactions, the opening balance ($66,857.70), and the closing balance ($90,569.13)
|
||||
matched exactly. One real extraction bug was caught in the process and is now a
|
||||
permanent regression case: the last transaction on page 4 absorbs the page's
|
||||
trailing `Account Fees: $48.75` footer line into its own description (not yet
|
||||
fixed in `table_extract.py` — ground truth encodes the correct value, so
|
||||
`measure.py` reports this row's description as a mismatch every run until it's
|
||||
fixed). `fixtures/HSBC-USD-Sep2026_ground_truth.xlsx` was built and verified the
|
||||
same way (all 32 transactions visually confirmed page-by-page); HSBC's own
|
||||
opening/closing ground truth is `None`/`None`, matching
|
||||
`extract_statement_facts` — HSBC genuinely doesn't print these within the table
|
||||
(confirmed visually: the only balance figures on the statement are a
|
||||
"Closing ledger balance brought forward" and "Current ledger balance" dated 01–02
|
||||
Oct, outside the Sep 1–30 statement period, not this statement's own opening/
|
||||
closing). `fixtures/HSBC-USD-August2026.pdf` still has no ground truth (only
|
||||
Sep was built) — `measure.py` reports it (untouched pass only), which surfaced a
|
||||
pre-existing, real problem: it currently fails `running_balance` (1 broken row)
|
||||
and `engine_agreement` (Docling found no table on 3 of 4 pages) — not caused by
|
||||
this work, but now visible and tracked instead of silent.
|
||||
- [x] `git init` this repo — done 2026-10-11, initial commit `16f74f7`.
|
||||
- [ ] Decide whether a `README.md` is wanted.
|
||||
- [ ] `fixtures/ground_truth_sep_reference.xlsx` was discovered to be mismatched: it's a
|
||||
bank-description→accounting-category mapping (Bank Description / Accounting
|
||||
Description / Amount columns, 8 rows, no date or balance) — categorization data
|
||||
from the separate `bank_statement_categorizer` tool, not this product's own
|
||||
per-transaction extraction ground truth. It was left in place rather than deleted
|
||||
unilaterally; decide whether to remove it or repurpose it.
|
||||
- [ ] The HSBC-Aug and RBC `engine_agreement`/`running_balance` issues `measure.py` now
|
||||
surfaces (above) aren't fixed — this harness's job was to make them visible and
|
||||
regression-tracked, not to resolve them.
|
||||
|
||||
Nothing else from the original Phase 1 step list (scaffold, Docling spike, extractor,
|
||||
reconciler, pipeline, checks, UI, Excel export) is outstanding — those are built. Phases
|
||||
|
|
|
|||
Loading…
Reference in New Issue