How Document Extraction Works
A plain-language walkthrough of what happens from the moment you upload a document to when it's ready for review.
When you upload a document to CargoLint, a lot happens behind the scenes in just a few seconds. Here’s how the extraction pipeline works.
Step 1: Upload and Ingestion
You upload a PDF, PNG, JPEG, or TIFF file (up to 20 MB) through the CargoLint dashboard. The file is securely stored and queued for processing.
Step 2: Document Type Classification
The first thing CargoLint does is figure out what kind of document it is. Our AI analyzes the page layout, header text, and structural patterns to classify the document as a Commercial Invoice, Packing List, Bill of Lading, or Certificate of Origin.
If the document doesn’t match any of these types, it’s marked for manual review.
Step 3: Field Extraction
Now the AI extracts the specific fields relevant to the document type. For example:
- From an invoice: seller name, buyer name, invoice number, line items, total amount, payment terms
- From a packing list: item descriptions, quantities, weights, box numbers
- From a bill of lading: shipper, consignee, container numbers, ports
- From a certificate of origin: exporter, importer, country of origin, product descriptions
Each field is identified, located in the document, and read by our optical character recognition (OCR) system.
Step 4: Confidence Scoring
As the AI extracts each field, it calculates a confidence score (0 to 1) based on:
- How clear the text is
- How well it matches expected formats
- Whether it’s in the expected location
- How well extracted values validate against each other
The confidence score reflects the AI’s certainty. A score of 0.95 means we’re very confident; a score of 0.55 means we’re uncertain and the field should be reviewed.
Step 5: Validation Checks
CargoLint performs cross-field validation to catch obvious errors:
- Do line item totals add up to the invoice total?
- Do package counts match the shipment summary?
- Are dates in logical order (invoice date before due date)?
- Are required fields present?
If validation checks fail, confidence scores are adjusted down automatically.
Step 6: Review Queue Routing
After scoring and validation, the document is routed based on its overall confidence and on whether anything needs explicit confirmation:
- Pending Approval (confidence ≥ 78%, nothing to confirm): The document is ready for one-click approval. A reviewer signs off before it is marked complete.
- Review (confidence < 78%, or HS codes to confirm, or a degraded scan): The document goes to your review queue. A team member with sufficient permissions can open it, check the extractions, make corrections if needed, and then mark it complete.
The score alone does not decide the routing: HS codes are never applied automatically, so a document can score high and still wait in Review until a person confirms its codes. See How Confidence Scoring Works for the full routing rules.
Why does processing take a few seconds?
The entire pipeline-classification, extraction, scoring, and validation-typically takes 3 to 10 seconds per document. This delay accounts for:
- The time needed for the AI to analyze each page
- The time to perform validation checks and adjust scores
- Network latency for secure transmission
Why do some documents need review and others don’t?
Documents that go straight to Pending Approval are those with consistently clear text, standard layouts, extractions that validate well, and no HS codes waiting for confirmation. These typically score above 78%.
Documents that need review are those with:
- Low-quality scans or handwriting
- Non-standard layouts or missing fields
- Extracted values that don’t validate (e.g., math doesn’t add up)
- Formats the AI is less familiar with
Review isn’t a sign of failure-it’s a designed part of the workflow. Some documents are genuinely ambiguous and benefit from human judgment.
Real-time monitoring
You can monitor the extraction status of all your documents from the dashboard. You’ll see:
- Total documents processed
- Documents completed
- Documents requiring review
- Average confidence across all documents
- 30-day trend charts showing volume and confidence over time
This visibility helps you understand document quality patterns and plan your review resources.