How kotianprakash/term-sheet-reconciliation works
Term Sheet Reconciliation turns a term-sheet PDF and a booking-system JSON/CSV file into a traceable, field-by-field CSV reconciliation. The CLI delegates to report generation, which loads booking trades and extracts the shared PDF once. Extraction preserves page evidence and validates Claude’s structured response; comparison applies deterministic normalization before escalating unresolved fields to Claude for arbitration. Results include Match, False Alert, True Mismatch, or Parsing Error. The README documents both input formats and the report’s traceability fields. Source excerpts show the main call ownership; data-file relationships are documented in the README.
Main entry points: report.py Report runner · extract.py Field extractor · compare.py Trade comparison · ingest.py PDF page reader
Components 16
Inputs
- Term sheet PDF
- Booking file
- Booking loader
src/report.py
Term extraction
- PDF page reader
src/ingest.py - Page markers
src/ingest.py - Field extractor
src/extract.py - Extraction schema
src/schema.py - Response validation
src/extract.py
Reconciliation
- Trade comparison
src/compare.py - Deterministic matching
src/normalize.py - Mismatch arbitration
src/compare.py
Reporting
- Pipeline CLI
src/run_pipeline.py - Report runner
src/report.py - CSV report
Other components
- Operator
- Claude API
Connections 16
- Operator → Pipeline CLI: runs
README.md - Pipeline CLI → Report runner: generates report
src/run_pipeline.py - Term sheet PDF → PDF page reader: provides PDF
README.md - PDF page reader → Page markers: returns pages
src/ingest.py - Page markers → Field extractor: supplies marked text
src/extract.py - Field extractor → Claude API: requests extraction
src/extract.py - Field extractor → Response validation: validates response
src/extract.py - Response validation → Extraction schema: validates against
src/extract.py - Booking file → Booking loader: provides JSON or CSV
README.md - Report runner → Booking loader: loads trades
src/report.py - Report runner → Field extractor: extracts once
src/report.py - Report runner → Trade comparison: compares each trade
src/report.py - Trade comparison → Deterministic matching: checks values
src/compare.py - Trade comparison → Mismatch arbitration: escalates unresolved fields
src/compare.py - Mismatch arbitration → Claude API: requests judgment
src/compare.py - Report runner → CSV report: writes CSV
src/report.py