Skip to content

Case study · Docflow

AI document intake that reads freight paperwork and posts it to the ERP.

An AI-assisted pipeline that extracts data from invoices, bills of lading, and customs documents, validates it against the ERP, and sends only uncertain cases to a person for review.

Sector
Freight forwarding & logistics
Scope
Pilot to production
Core stack
Python, LLM APIs, PostgreSQL, AWS, Docker
Illustrative case study

This case study shows how we would approach a representative project of this kind. It is not a record of a specific client engagement: names, interfaces, and plans are examples, and outcomes are described as what would be measured rather than as results.

docflow / review-queueDocflowReview queue12 WAITINGBILL OF LADINGBL_MSKU4471203.pdf2 fields to checkCARRIER INVOICEINV-88213.pdfVendor not matchedPACKING LISTPL_0931.pdfLow confidence: weightCUSTOMS DECLARATIONCD-55120.pdfMissing HS codeCARRIER INVOICEINV-88247.pdfTotal mismatchBILL OF LADINGBL_TGHU8821.pdfPossible duplicateCARRIER INVOICEINV-88251.pdfNew charge codeBILL OF LADINGNON-NEGOTIABLE COPYB/L NO.MSKU 4471203SHIPPERArden Components LtdCONSIGNEENordhavn Trading A/SPORT OF LOADINGRotterdam, NLPORT OF DISCHARGEGdańsk, PLCONTAINERPKGSDESCRIPTIONWEIGHTTGHU88210472418,420 KGSIGNED FOR THE CARRIER1234567Extracted fieldsSCHEMA: BILL_OF_LADINGCONFIDENCE1B/L NUMBERMSKU 447120399%2SHIPPERArden Components Ltd98%3CONSIGNEENordhavn Trading A/S97%4PORT OF LOADINGRotterdam (NLRTM)99%5PORT OF DISCHARGEGdańsk (PLGDN)96%6CONTAINER NO. · CHECK DIGIT DOES NOT MATCHTGHU 882104-788%7GROSS WEIGHT · PACKING LIST SAYS 18,240 KG18,420 kg61%ERP CHECKSShipment SH-20931 foundVendor matched2 fields need review before postingApprove & post to ERPCorrect fieldSkip

Scroll sideways to see the full screen

Interface conceptReview queue concept: the source document beside its extracted fields, with uncertain values flagged.

§ 01The situation

Where things stand.

The operations team at a freight forwarder processes thousands of documents a month: carrier invoices, bills of lading, packing lists, and customs declarations, arriving as PDFs, scans, and email attachments in countless layouts.

Each document is read and keyed into the ERP by hand. Peaks in volume create backlogs, errors surface weeks later as billing disputes, and experienced staff spend their time typing rather than resolving exceptions.

What makes it hard

  • Endless layouts

    Hundreds of carriers and suppliers use their own formats, so template-based OCR breaks constantly.

  • Errors are expensive

    A wrong container number or amount leads to disputes and delays, so accuracy matters more than speed.

  • Trust

    The team will not accept a black box. They need to see where each value came from and correct it quickly.

  • ERP constraints

    Data must match existing shipments, vendors, and charge codes before it can be posted.

§ 02The solution

What we would build.

Each part answers one of the problems above, and each can be delivered and tested on its own.

Ingestion
Documents collected from shared mailboxes and uploads, classified by type, and split when one PDF contains several documents.
Extraction with evidence
A language model extracts fields into a strict schema and records where on the page each value was found, so reviewers can verify it at a glance.
Validation against the ERP
Each result is checked: the shipment exists, the vendor matches, totals add up, and charge codes are valid.
Confidence-based routing
Documents that pass every check are posted automatically; anything uncertain goes to a review queue with the problem highlighted.
Evaluation harness
A labeled set of real documents scores every change to prompts, models, or rules before it reaches production.
ERP posting & audit trail
Approved data is written through the ERP's API, and every record links back to its source document.

§ 03Architecture

How the pieces fit.

A layered view of the proposed system. The highlighted component carries the logic the rest of the system depends on, so it is designed and tested first.

  1. 01 Sources

    • Shared mailboxes
    • Upload portal
    • Scanner inbox
  2. 02 Processing

    • Classification & splitting
    • LLM extraction (structured)
    • Validation rules
    • Confidence scoring
  3. 03 People & systems

    • Review queue
    • ERP API connector
    • Audit log
  4. 04 Platform

    • Python workers
    • Queues
    • PostgreSQL
    • AWS
    • Evaluation pipeline
Architecture overviewDocflow, by layer. Core technologies: Python, LLM APIs, PostgreSQL, AWS, Docker, React, REST APIs.

§ 04Delivery plan

Delivered in stages you can review.

Each stage ends with something working that you can evaluate before committing to the next.

  1. Stage 01

    3 weeks

    Assessment

    Sample documents, define fields and accuracy targets, and build the first evaluation set.

  2. Stage 02

    4 weeks

    Prototype

    Compare extraction approaches on the evaluation set and report accuracy, cost, and latency.

  3. Stage 03

    6 weeks

    Pilot with review

    One document type live, with every result approved by a person and quality tracked daily.

  4. Stage 04

    Ongoing

    Production & expansion

    Automatic posting for high-confidence documents, then further document types.

§ 05Outcomes

What you receive, and how success is measured.

Targets for each measure are agreed during discovery, using your current figures as the baseline, and reported on throughout delivery.

Deliverables

  • Document pipeline and review application
  • Evaluation set and automated scoring
  • ERP integration with a full audit trail
  • Monitoring of accuracy, cost, and processing time
  • Operating guide for reviewers and administrators

Measured by

  • Documents posted without manual correction
  • Field-level accuracy on the evaluation set
  • Time from document arrival to ERP posting
  • Cost per processed document

§ 06Start a project

Planning something similar?

Describe where things stand today and what needs to change. We will reply with questions and an initial view of scope and approach.

  1. 01

    Share the context

    A short description of the project, your goals, and any constraints you already know about.

  2. 02

    We review it

    We read it carefully and reply with questions or an initial perspective on the problem.

  3. 03

    A first conversation

    A call to explore scope, approach, and whether we are the right fit for the work.