The documents, and what makes each one hard
| Document | Fields usually needed | What makes it hard |
|---|---|---|
| Supplier invoice | Supplier, invoice number and date, totals, tax, line items, payment details | Every supplier has its own layout, line items run across pages, credit notes look like invoices |
| Purchase order | Customer, order number, items, quantities, prices, delivery dates | Customers use their own product codes, and changes arrive as revised copies |
| Bill of lading | Shipper, consignee, document number, container and seal numbers, weights, ports | Poor scans, stamps over text, handwritten notes and several copies of one document |
| Claim form | Policy or member number, claimant, dates, description, attachments | Handwriting, missing pages and free-text descriptions that matter more than the boxes |
| Identity document | Name, document number, nationality, dates of birth and expiry | Glare on photos, two sides, and names in Arabic and Latin script that must both be captured |
A bill of lading and an invoice need different fields, rules and reviewers, so each document type is set up and tested on its own, even when they arrive in the same inbox.
How the pipeline works, step by step
- Intake: documents arrive by email, upload portal, scanner or API. Each file is fingerprinted, so the same PDF sent twice is caught.
- Preparation: multi-document PDFs are split, pages rotated and straightened, and each document classified by type and language.
- Reading: digital PDFs already contain text; scans and photos go through OCR, and handwriting needs a model trained for it.
- Extraction: a layout-aware model, or a language model given a strict schema, returns each field, with line items as a table.
- Validation: every value is checked by rules and against your records.
- Routing: confident, valid documents continue; the rest go to review.
- Posting: data is written to the ERP, transport management system or claims system with a link back to the original image.
- Archive: the original is stored for a retention period you set.
Our glossary entry on intelligent document processing gives the short definition.
Validation rules catch what reading gets wrong
A value can be read perfectly and still be wrong, because the sender made the mistake. Validation checks meaning, not only reading. Typical rules:
- Line items, tax and total add up, within a rounding tolerance.
- The supplier exists in your vendor records and the bank details match the ones on file. Changed bank details are a classic fraud signal and always go to a person.
- The purchase order exists, is open and covers the quantities invoiced.
- The same supplier has not sent the same invoice number before.
- Container numbers pass their check digit, and dates are plausible: no delivery before pickup, no expired IDs.
- Tax registration numbers match the expected format for the country.
Rules like these are cheap to run and catch the errors that cost most, which is why they matter more than the choice of extraction model.
Confidence thresholds and the review queue
Extraction models report a confidence for each field, but confidence alone is not proof. We combine it with the validation results: a field is accepted only if the model is confident and every rule passes. Thresholds are set per field by the cost of an error. Bank details and amounts are always checked strictly; a reference field on a delivery note can be more relaxed.
Start conservatively. In the first weeks, send most documents to review and measure where the system was right, then relax thresholds only where the evidence supports it. The share of documents that pass without review depends on your documents, so treat any promised figure with caution.
The review screen matters as much as the model: the page image with the source of each field highlighted, the extracted values beside it, keyboard shortcuts, and a reason code for each correction. Corrections feed the test set and supplier-specific rules, so the same mistake is caught next time. This is human in the loop in its most practical form.
Arabic and English documents
In the Gulf, many invoices, contracts and customs papers carry both languages on one page, and Arabic brings its own problems. Letters that differ only by their dots are easy to misread on a faint scan. Numbers may appear in Eastern Arabic numerals and need converting before validation. Dates may be written in the Hijri calendar, the Gregorian calendar or both. The same name can be spelled several ways in Latin letters, so matching a supplier or a person to your records needs fuzzy matching across both scripts.
Test with your own documents, including faxes, phone photos and stamped copies, not clean samples. Our page on Arabic AI assistants covers Arabic language handling in more depth.
IDs and other sensitive documents
Identity documents and claim forms carry personal data, so the pipeline is designed around it: extract only the fields you need, mask numbers in the review screen where the reviewer does not need them, restrict who can open originals, encrypt storage, log every view and delete on schedule. Check where your OCR and model providers process data and what they retain. Reading an ID is also not verifying it: confirming that a document is genuine and belongs to the person presenting it is a separate step with its own tools.
Data protection laws, such as the GDPR for personal data in the EU and the national personal data laws in Gulf countries, apply to these documents. We design with awareness of them; this is not legal advice, so confirm your obligations with qualified counsel.
Measuring the result
Before launch, record documents per day, minutes of handling per document, the age of the backlog and how many errors surface later, such as duplicate payments or misbilled shipments. After launch, track the share accepted without review, review time per document, corrections by field and by sender, and time from receipt to posting. Audit a sample of auto-accepted documents every week, because those errors are the ones nobody sees. For workflows built on this, see freight document processing and accounts payable automation.