← Back to portfolio projects

AI engineering case study

Bilingual Document Intake

Extracts fields from English and Arabic invoice images, checks totals, and sends records to a review queue.

Python · FastAPI · Tesseract OCR · SQLite

4 / 4

Expected fields on the English sample

4 / 4

Expected fields on the Arabic sample

4 passed

Integration and parsing tests

The problem

Scanned invoices need structured fields before they can be reviewed. OCR can leave fields blank or return an incorrect amount, so reviewers need the extracted text and editable values together.

How it works

Queue an English or Arabic invoice

Upload a PNG or JPEG. A background worker claims the job from SQLite and runs local OCR with the selected language.

Review the extracted fields

Inspect the raw OCR text alongside invoice number, subtotal, tax, and total. Missing or conflicting fields remain available for correction.

Approve only when totals balance

The reviewer confirms the final values. The API validates subtotal plus tax against the total using decimal arithmetic.

Engineering decisions

The queue persists across restarts. If a worker stops mid-job, an expired lease allows another attempt. OCR runs locally, and the worker discards the source image once processing finishes.

What was tested

The recorded benchmark used two clean synthetic scans, one per language. Both produced all four expected fields. That result verifies the included examples and leaves production accuracy to be evaluated on a larger dataset.

Inspect the OCR benchmark results ↗