2026Fullstack Software AI Engineer
DocuFlow OCR
Turns scanned invoices into verifiable accounting data: OCR, LLM extraction and human review with per-field confidence measured, not assumed.
PythonFastAPIPostgreSQLpgvectorCeleryClaude AINext.jsDockerGoogle CloudVercel





The home page: a sample invoice is read field by field and anything doubtful gets flagged
1 / 8Problem
A small business receives invoices in three formats and keys them in by hand; automating it is hard to finish because both OCR and model make mistakes silently.
Solution
An async pipeline on Celery and Redis where every field carries its confidence and provenance, and anything below the threshold goes to human review.
- Claude Haiku 4.5 extracts; the AI analyst answers figures with fixed SQL queries.
- Spending categories, merged vendors, Salvadoran DTE e-invoices and Excel export.
- PostgreSQL 16 with pgvector: structured data and embeddings in a single engine.
- Semantic questions go through RAG citing the exact page; aggregation questions, through SQL.
Outcome
Measured across 120 fields against ground-truth labels.
- 93.3% accuracy when the system answers.
- Just 1.7% silent failures.
- 0.0045 USD per document.
- RAG alone added up $1,298.96; with SQL, the real total is $1,881.06.
Read the full storyHide the full story2 min read
- Problem
- A small business receives invoices in three formats at once: e-invoicing PDFs, scanned PDFs and photos taken on a phone. Getting them into the accounting system means manual data entry. Automating it is easy to start and hard to finish, because both the OCR and the model make mistakes, and they make them silently.
- Solution
- Built an async pipeline on Celery and Redis where every extracted field carries its confidence score and provenance: anything below the threshold goes to a human review queue instead of polluting the database. Tesseract with OpenCV preprocessing for shadowed phone photos, Claude Haiku 4.5 for extraction and Claude Sonnet 5 for answers, and PostgreSQL 16 with pgvector to keep structured data and embeddings in a single engine. The chat splits semantic questions, answered through hybrid search and RAG with citations to the exact page, from aggregation questions, answered with SQL: a top-k retriever only ever sees a sample of the corpus and would answer confidently about a subset. Measured: RAG added up $1,298.96 from the 7 invoices it happened to see, while the real total across all 12 is $1,881.06. So figures are answered by the dashboard's AI analyst (Claude Haiku 5.5 with tool use), which picks among fixed SQL queries and writes from what they return. Each invoice is classified into a spending category in the same call that reads it, variants of a vendor name are merged by trigram similarity before adding up, Salvadoran e-invoices (DTE) come in as JSON with no OCR or model, and everything downloads as an Excel file with a summary, charts and totals that recalculate. Accounts sign in with Google by invitation, each in its own workspace, with quotas the admin sets.
- Outcome
- Measured across 120 fields against ground-truth labels: 93.3% accuracy when the system answers and just 1.7% silent failures, at 0.0045 USD per document. Faced with illegible documents it abstains rather than inventing, and whatever it cannot resolve lands in the review queue. Public demo on Vercel, no sign-up, in Spanish and English, with 12 invoices already processed; the API runs on a Google Cloud e2-micro machine.