Technical assessment3 to 8 November 2026
DocIntel
An AI document intelligence system that reads invoices and checks them before anything is accepted.
Live demo, built as a technical assessment. The API sleeps on a free tier, so the first load may take a minute.
- Live demoFirst load may take a minute.
- API docs
- GitHub
- Walkthrough video
Problem
Reading an invoice is only part of the task. DocIntel keeps the source text behind each extracted value and checks line sums, dates, evidence and duplicates before anything is accepted.
System study
Documents enter a PostgreSQL job queue. Digital text is read directly, while weak scans and phone photos pass through OpenCV and Tesseract, with Gemini vision as a fallback for low-confidence pages. Gemini structured output extracts fields and line items. Python checks the arithmetic, stores the values with their confidence and source text, and sends failures to a review queue.
What was built
Invoice processing for digital and scanned PDFs, phone photos, TIFF, Excel and CSV. Gemini structured output extracts nine fields and line items, keeping each value with its confidence score and source text.
Eleven validation rules in exact decimal arithmetic check line sums, quantity times price, subtotal plus tax, dates, confidence, evidence and duplicates. Fuzzy supplier matching uses pg_trgm, and failed rules send the document to review.
A PostgreSQL job queue with row locking, heartbeats, retries with backoff and stale-job recovery, so processing survives restarts on free hosting.
OpenCV cleanup and Tesseract for weak scans and phone photos, with a Gemini vision fallback for low-confidence pages.
PDF-to-PDF and PDF-to-Excel reconciliation, plus hybrid search combining full-text search with pgvector meaning search.
Accuracy evaluation with real models on labelled data in GitHub Actions, with weak spots and synthetic-data limits recorded in the repository.
A storage failure on the deployed demo diagnosed from server logs. Supabase Storage needed an Authorization header that the test fake had not enforced. The fix made the fake enforce the real service's rules.
Architecture
- API
- FastAPI on Python 3.12, hosted on Render, with Pydantic v2, SQLAlchemy 2.0 and Alembic.
- Frontend
- Next.js, TypeScript and Tailwind CSS, hosted on Vercel.
- Storage
- Supabase Postgres and private file storage. Each value keeps its confidence and source text.
- Queue
- A PostgreSQL job queue with FOR UPDATE SKIP LOCKED, row locking, retries and stale-job recovery.
- Reading
- PyMuPDF, OpenCV and Tesseract OCR, with Gemini vision for low-confidence pages.
- Extraction
- Gemini structured output for fields and line items. Python performs exact decimal validation outside the model.
- Search and matching
- Hybrid full-text and pgvector meaning search, with pg_trgm for fuzzy supplier matching.
Key decisions
A Postgres job queue instead of Redis, because the free hosting can restart.
The model reads the document. Python performs the arithmetic.
Test fakes must enforce the real service's rules, including the storage service's Authorization header.
A fake model checks the plumbing. The real model measures extraction accuracy.
Evidence
All eight evaluated fields correct on 91 of 91 synthetic invoices in run 5, with every planted validation error caught and no failed documents.
Phone photos in the labelled synthetic evaluation reached 87.5% of fields in run 8.
428 automated tests in CI at 96% coverage, with more than 80 recorded design decisions.
About USD 0.0015 per invoice at paid Gemini prices, from the evaluation report.
Screenshots
Technology
- FastAPI (Python 3.12)
- Pydantic v2
- SQLAlchemy 2.0
- Alembic
- PostgreSQL job queue (FOR UPDATE SKIP LOCKED)
- PyMuPDF
- OpenCV
- Tesseract OCR
- Google Gemini (structured output, vision, embeddings)
- pgvector
- pg_trgm
- Next.js
- TypeScript
- Tailwind CSS
- Supabase (Postgres and private storage)
- Docker
- GitHub Actions CI with gitleaks
Deployed on Render and Vercel.
Limitations and status
The evaluation uses synthetic invoices. Its results do not establish accuracy on invoices outside that dataset, and the repository records the weak spots.
The API sleeps on Render's free tier. The first load of the live demo may take a minute.
Built in five days as a technical assessment for an AI Engineer role, with Claude Code cloud sessions driven by Sowan's written specifications and decisions.
Links
- Live demoFirst load may take a minute.
- API docs
- GitHub
- Walkthrough video


