Skip to content
ALGOLOGIX

Retail · 2026

Turning supplier documents into records

A document-extraction pipeline for a retail group, classifying and extracting structured records from supplier invoices and delivery notes arriving in every format a supplier felt like using.

The problem

Supplier documents arrived as scans, spreadsheets and email bodies, and were re-keyed by hand into the finance system. The errors were expensive and only surfaced during reconciliation.

Constraints

  • Extraction had to produce a typed record or an explicit failure, never a plausible guess
  • Scanned documents varied in quality and orientation
  • Anything not extracted with confidence had to reach a person, not a silent retry
  • The pipeline had to reprocess a backlog without a second implementation

What we built

Classification then schema-constrained extraction, with validation before anything reached the finance system and an explicit low-confidence path into a review queue. The same pipeline handled the backlog and the live feed, so reprocessing needed no separate code path.

What we built

Extraction pipelines fail in a specific way: they work on the documents used to build them, and then meet the real distribution. The design target was therefore not accuracy on a sample — it was knowing, per field, whether this particular extraction can be trusted without a person looking.

Everything the model is unsure about goes right, to the review queue.
  1. Classify before extracting. Document types have different fields and different failure modes. A single prompt over everything is what produces confident nonsense on the format that was under-represented in testing.

  2. Extract into a typed schema. The output is validated structure, not free text. A field that does not parse is a failure the pipeline can see, rather than a string that flows onward and breaks something downstream.

  3. Validate against what is already known. Totals are recomputed, references are checked against the systems of record, and dates are range-checked. Most extraction errors are caught by arithmetic rather than by a model.

  4. Route on confidence. Clean documents post automatically. Anything failing validation, or extracted below threshold, goes to a review queue with the field and the source region highlighted — so a person confirms one number rather than re-reading the page.

The review queue is the product

It is tempting to treat human review as the part to eliminate. Reframing it as the interface is what made the rollout safe: the threshold starts conservative, almost everything is reviewed, and each correction is a labelled example. The threshold moves as the measured accuracy justifies it.

Where the model is, and is not

The model reads documents. It does not decide what is true. Every extracted value passes through validation that does not involve a model at all, and the schema is the contract between them.

How we evaluated it

A labelled document set scored field-level extraction accuracy and, separately, the calibration of the confidence signal — a pipeline that is right often but wrong confidently is not usable for finance data. The review queue's volume was tracked as the real measure of success.

Results

Documents extracted without human review
Illustrative — this is a placeholder case study.
Field-level extraction accuracy
Illustrative — this is a placeholder case study.
Reduction in reconciliation exceptions
Illustrative — this is a placeholder case study.

Stack

  • Anthropic Claude
  • Pydantic AI
  • Python
  • Airflow
  • PostgreSQL
  • OpenCV

Tell us what you are trying to ship.

The useful first conversation is about the constraint, not the technology. Bring the deadline, the data you actually have and the thing that has to be true — we will tell you what it takes, including when the answer is that you do not need us yet.