PDF Invoice Extractor
Offline OCR that turns messy invoices into 30+ structured fields — no LLM calls.
Sole developer — OCR pipeline, extraction engine, vector search, React UI · PaddleOCR, RapidFuzz, Flask, sentence-transformers, Qdrant, React
Invoices arrive in dozens of layouts. OCR output is noisy — labels are misspelt (qty / qnty / nos / pcs), table columns come back as separate text blocks and totals don't always add up. Manual entry is slow and error-prone.
- PDF pages are rasterised with pdf2image and run through PaddleOCR locally; the code handles both the current and the legacy PaddleOCR result formats.
- A fuzzy-matching engine maps ~200 OCR-noisy label variants onto 30+ structured fields using rapidfuzz WRatio with a configurable threshold.
- Line items are rebuilt with three strategies tried in order: multicolumn recovery, four compiled table regexes, and a product-code fallback that searches for the (qty, rate, amount) triple with the smallest error.
- Every result is validated (qty × rate = amount, totals vs. item sums), embedded with all-MiniLM-L6-v2 and upserted into Qdrant for natural-language search.
- No LLM in the parsing path.
- Extraction is regex + fuzzy matching, so it runs fully offline, deterministically and without per-document API cost.
- Graceful degradation.
- If Qdrant is unavailable, extraction still works and only the vector features switch off.
- Tables that OCR reads column-by-column.
- Multicolumn recovery pairs product lines with nearby monetary values and back-calculates quantity from amount ÷ rate.
- False positives.
- Invoice-number and date detectors explicitly skip phone numbers, TINs and printer footer dates.