Synthetic PDF extraction handoff
Run
Use Python 3.10+ with the libraries in requirements.txt already installed. The demo was verified without downloading packages. Run from this folder:
python -B demo.py
python -B tests/run.py
demo.py regenerates the two synthetic source PDFs and sample before/after deliverables. extract.py alone reads existing PDFs without regenerating them:
python -B extract.py --source sources --output output
Do not point the generator at real source documents. Use a new output folder for an extraction trial so the previous delivery remains available.
Verify
- Require 20 passed tests and 0 failures/errors in
evidence/tests.json. - Inspect all 4 source pages. The invoice spans 6 line items; the statement spans 8 transactions. Compare representative first, middle and last rows against their PDF pages.
- Open
output/QA_REPORT.md. Require invoice rows 6/6, quantity 13, subtotal 550.50; inspect all statement controls rather than accepting the closing balance alone. - Inspect
output/review_queue.csv: the only uncertain cell is Debit atstatement.pdf:p1:r4, source textO5.00. Output debit must stay blank, and the QA result must remain REVIEW_REQUIRED until a human resolves the source. - Open the CSVs/XLSX. Check 6 and 8 data rows, provenance, the review queue, and the formula-like invoice description stored as text. Monetary XLSX cells are numeric; dates are typed. No workbook formulas are required.
- A processing exit code of 0 is not an acceptance certificate. Check
overall_quality. Numeric/row count MISMATCH yields FAIL and CLI exit 2; unsupported layouts raise an error.
Resolve an exception
Review the referenced original source. Do not deduce a value solely from other totals or balances. Record the review decision and source evidence in a separate change log. For this synthetic demo the amount is intentionally unresolved, so no manual correction is included. For a real client, agree the correction process and reconcile again after the approved correction.
Roll back and rerun
The extractor does not alter input PDFs. Retain the previous output directory before rerunning, and write a new trial to a different folder. To roll back, discard the new trial folder and restore the previous agreed output snapshot. No accounts, workflows, external sheets or production systems are changed by the demo. Regenerate supplied synthetic PDFs with python -B generate_sources.py if needed; do not use this generator as a real-document restore tool.
Boundaries
Known text-PDF layouts only; no OCR or uploads. Confidence flags are rules, not probabilities. Counts/totals cannot prove every cell correct. Client review of uncertain required fields and representative row comparisons remain acceptance requirements. The workbook has local value/type and preview checks, not a live Excel/Google Sheets validation. The code and these notes were reviewed in the same engineering session using AI coding tools.