Deterministic-first document automation and verification workbench built with TypeScript (Bun), Python (pypdf, pdfplumber, openpyxl, python-docx), PostgreSQL, easy-template-x, and pdf-lib.
Every filled number and report claim carries format-native source provenance verified by code:
- PDF -> exact filename, 1-based page number, and verbatim quote
- XLSX -> exact
Sheet!Cellcoordinate viaopenpyxl(handling Docling'scharspan=(0, 0)and 0-based grid coordinates) - DOCX -> exact section heading and paragraph index (handling OOXML / Docling's lack of native Word page numbers)
Anything code cannot prove stays [MISSING: field]. An LLM runs only for the Engineering Discussion judgement section and a single AI review pass, with no tool access, on a compact verified evidence packet (~81.7% fewer input tokens than raw folder text), and every AI fix is re-checked by deterministic code before acceptance.
- Python Parser Service (
python-service/): Parses PDF, DOCX, XLSX, and CSV inputs deterministically, detects and converts metric (mm/s) to imperial (in/s) units while preserving raw source quotes, checks calibration expiry, and lints.docxtemplates for Word split-run{tag}XML fragments. - Deterministic Core & Code Verifier (
src/deterministic.ts,src/verifier.ts): Computes Table 1 values, limit comparisons, week-over-week deltas from the prior week's structured state, and builds the compact evidence packet. Rejects unknown evidence IDs, unverified decimals, dropped[MISSING: ...]markers, ungrounded cause speculation, prompt-injection compliance, and stale carry-forward text. - LLM Writer + Single Review Pass (
src/llm.ts): Compatible with Azure OpenAI (AZURE_OPENAI_ENDPOINT+AZURE_OPENAI_API_KEY) or OpenAI (OPENAI_API_KEY), strict Zod JSON Schema output, zero tools. - Review Screen (
src/server.ts,src/db.ts): Lightweight Bun + PostgreSQL web UI with report preview, source-on-hover popovers, missing-fields list, rerun, approval audit log, and DOCX / merged PDF downloads. - Template Fill & Appendix Merge (
src/docx_pdf.ts): Fills Word templates witheasy-template-x(MIT), verifies zero stray{tags}in output XML, converts via Gotenberg v8 (MIT; avoids v9's AGPL-3.0lithodependency) or LibreOffice, and merges Appendix A plus conditional Appendix B withpdf-lib(MIT).
# 1. Install TypeScript/Bun dependencies and run full CI (typecheck, lint, dead-code, license audit, tests)
bun install
bun run ci
# 2. Install Python parser dependencies and run pytest + ruff
cd python-service && uv sync && uv run pytest && uv run ruff check .
# 3. Start the Review Screen (after building sample corpus & eval snapshot)
bun run src/server.tsAll runtime and dev dependencies in this repository are strictly permissive (MIT, Apache-2.0, BSD-2/3-Clause, ISC). Run bun run check:licenses to verify zero GPL/AGPL dependencies.
The weekly monitoring PDFs used in the benchmark are real public vibration reports published by the City of Cambridge, MA (221 Mt. Auburn Street / Riverview Demolition, Project 200609.05). Companion work orders, field memos, Excel limit sheets, and adversarial stress-test fixtures are clearly labeled synthetic test inputs.