How simeonkolchin/invoice-ocr-framework works
Invoice OCR Framework turns supplier PDFs into structured invoice records using supplier-specific JSON templates. The main flow loads templates, OCRs and matches an invoice, extracts configured fields, applies supplier-specific logic and normalizes values. The README also documents table extraction, XML output, and email-to-Drive processing; some of those connections are not visible in the sampled calls, so they are shown only where documented or marked unverified.
Main entry points: invoice_parser.py Invoice orchestrator · utils.py Email intake · main.py PDF CLI · valle_flores.py Supplier custom logic
Components 20
Entry and intake
- PDF CLI
main.py - Email intake
utils/utils.py
Template system
- Template loader
utils/utils.py - Supplier configs
templates - Template matching
core/invoice_template.py
OCR and extraction
- Invoice orchestrator
core/invoice_parser.py - PDF OCR
- Full-text parser
parsers/tesseract_parser.py - Split-region parser
parsers/tesseract_split_parser.py - Static fields
parsers/static_parser.py - Table extraction
parsers/table_parser.py - Parser base
parsers/base_parser.py - Supplier custom logic
templates/valle_flores/valle_flores.py - Table helpers
utils/table_functions.py
Normalization and output
- Field normalization
core/invoice_parser.py - Name dictionaries
utils/translate.py - XML output
utils/utils.py - Structured record
Other components
- PDF submitter
- Mail and Drive
Connections 24
- PDF submitter → PDF CLI: submits PDF
main.py - PDF CLI → Template loader: loads templates
main.py - PDF CLI → Invoice orchestrator: parses PDF
main.py - Template loader → Supplier configs: loads configs
utils/utils.py - Template loader → Template matching: creates templates
utils/utils.py - Invoice orchestrator → PDF OCR: OCRs first page
core/invoice_parser.py - Invoice orchestrator → Template matching: tests keywords
README.md - Invoice orchestrator → Full-text parser: dispatches fields
core/invoice_parser.py - Invoice orchestrator → Split-region parser: dispatches fields
core/invoice_parser.py - Invoice orchestrator → Static fields: dispatches fields
core/invoice_parser.py - Full-text parser → Parser base: inherits
parsers/tesseract_parser.py - Split-region parser → Parser base: inherits
parsers/tesseract_split_parser.py - Static fields → Parser base: inherits
parsers/static_parser.py - Template matching → Supplier custom logic: loads custom module
README.md - Supplier custom logic → Invoice orchestrator: returns custom fields
core/invoice_parser.py - Supplier custom logic → Table helpers: extracts tables
- Invoice orchestrator → Table extraction: supports table strategy
README.md - Invoice orchestrator → Field normalization: fills and corrects
core/invoice_parser.py - Field normalization → Name dictionaries: looks up names
core/invoice_parser.py - Field normalization → Structured record: produces record
README.md - Email intake → Mail and Drive: polls mailbox
README.md - Email intake → Invoice orchestrator: reuses pipeline
- Email intake → XML output: writes XML
README.md - XML output → Mail and Drive: uploads result
README.md