Deterministic validation
Validate Shipping Document Data After OCR
Check extracted container numbers, IMO numbers, ports, dates, weights, package totals and financial arithmetic with reproducible rules. Validation identifies internal inconsistencies; it does not authenticate the issuer.
OCR confidence alone cannot establish whether a shipping value is operationally valid. GainingDocx follows extraction with deterministic checks written in code, giving each issue a reproducible reason and expected value where one can be calculated.
Checks include ISO 6346 container digits, IMO checksums, UN/LOCODE matching, date order, gross-versus-net weight, cargo totals and document-specific financial arithmetic.
Short answer
What validation adds after extraction
Once values are read, deterministic code evaluates them: container check digits are recomputed under ISO 6346, IMO checksums verified, ports matched against UN/LOCODE, weights and package totals added up, invoice arithmetic recomputed, and date ordering checked. Every finding carries a reproducible reason and, where one can be calculated, the expected value.
- Rules written in code, not model judgement
- Expected values shown for check-digit failures
- Contradictions separated from warnings
- The same input always produces the same result
How Document Validation Works
- 01
Extract the printed value.
- 02
Run document-specific validation rules.
- 03
Review pass, warning and fail results with explanations.
Why confidence scores are not enough
A model can be entirely confident about a container number it read perfectly from a document where the number itself is wrong. Confidence measures how sure the reader is about the characters, not whether those characters describe something real. For operational data, that distinction is the whole problem.
Deterministic validation answers a different question: given these characters, do they satisfy the rules that this kind of value must satisfy? A container check digit either matches its modulo-11 calculation or it does not. An invoice total either equals the sum of its lines or it does not. Those answers are reproducible, explainable and independent of how the value was read.
The AI reads; the rules decide
Extraction and validation are deliberately separate layers. That separation is what allows a finding to be explained — 'the expected check digit is 3, the document shows 8' is a sentence anyone can act on, and it does not change between runs.
The checks that run
| Category | Check | What a failure means |
|---|---|---|
| Equipment | ISO 6346 container check digit recomputed | Transcription or OCR error, or a mis-marked container |
| Vessel | IMO number checksum | Wrong or mistyped vessel identifier |
| Location | Routing points matched against UN/LOCODE | Unrecognised code — often legacy data, occasionally an error |
| Air | Modulus-7 AWB check digit on master waybill numbers | Mistyped or invented air waybill reference |
| Weights | Net weight against gross weight | Columns transposed, or units mixed across rows |
| Weights | Container weights summed against printed total | A container added or removed after the total was written |
| Packages | Package counts totalled across rows and containers | Line added or removed without the total being updated |
| Volume | CBM recomputed from dimensions and package count | Dimensions describing a pallet rather than a carton, or a unit error |
| Financial | Line amount = quantity × unit price; lines summed to totals | An edited line, a hidden discount, or a genuine error |
| Dates | Ordering between on-board, issue, ETA and arrival dates | Impossible sequence, or a document dated incorrectly |
| Classification | HS code structural plausibility | Truncated or malformed code |
| Terms | Incoterm validated against the published rule set | An invalid rule, or a maritime-only rule on containerised cargo |
Contradictions, warnings and why the difference matters
A review queue that treats every finding as equally urgent gets ignored, and an ignored queue is worse than no queue at all. Findings are therefore graded by what the rule can actually establish.
Contradictions
Something on the document cannot be true. These are arithmetic and structural facts, and they are almost never false positives.
- A container check digit that does not match its calculation
- Net weight exceeding gross weight
- A printed total that does not equal the sum of its lines
- A shipped-on-board date after the document's own issue date
- A chargeable weight below the gross weight on an air waybill
Warnings
Something could not be confirmed. These need a human to look, not to panic — and treating them as failures is how legitimate documents get rejected.
- A port code the bundled dataset does not contain, which is frequently valid legacy data
- A weight total differing from the sum of lines by less than the tolerance
- An HS code that is structurally valid but shorter than the destination requires
- A field the document simply does not carry
- A value read from a region of the page with poor legibility
Dataset misses warn, they never fail
UN/LOCODE is revised twice a year and carrier master data lags behind for years. An unrecognised port code is far more often stale reference data on a perfectly valid document than an actual error. Rejecting on a dataset miss would fail real shipments to satisfy a lookup.
What validation cannot establish
Every one of these rules operates on the document's internal consistency. None of them can reach outside the page.
- It cannot confirm a document is genuine, or that the named carrier issued it
- It cannot confirm a container exists, is in service or holds the cargo described
- It cannot confirm a vessel sailed, a flight operated or a booking was made
- It cannot confirm a declared value reflects the real transaction
- It cannot confirm a classification is correct for the goods
- It cannot substitute for customs, carrier or bank verification
Shipping Data Validation FAQ
What teams ask before relying on maritime document validation in a live operation.
Are validation results generated by AI?
No. The AI reads the document; deterministic code performs the checksum, arithmetic, date and reference checks. That separation is deliberate — it means every finding has a reproducible reason, the same input always produces the same result, and a finding can be explained in a sentence rather than justified by a confidence score.
Can validation prove that a document is genuine?
No. It detects internal inconsistencies and invalid references — arithmetic that fails, check digits that do not match, dates in an impossible order. It cannot authenticate an issuer, and it does not replace verification with the carrier, customs authority or bank. A perfectly fabricated document can pass every check.
What happens when a check fails?
The affected field is flagged with a plain-language explanation and, where one can be calculated, the expected value — so a failed container check digit shows the number the arithmetic implies. Findings are ordered by severity and grouped so the review queue reflects what blocks a shipment rather than the layout of the page.
What is the difference between a warning and a failure?
A failure means something on the document cannot be true — net weight above gross, a total that does not equal its lines, a check digit that does not compute. A warning means something could not be confirmed, most often a reference the bundled dataset does not contain. Failures are almost never false positives; warnings frequently resolve as legitimate.
How are container numbers validated?
Under ISO 6346: each of the first ten characters is converted to its numeric value, multiplied by 2 raised to its position, summed, and reduced modulo 11 — with a remainder of 10 written as 0. The result is compared against the printed check digit and the expected full number is shown when they disagree.
Which reference datasets are used?
A bundled UN/LOCODE snapshot for port and location codes, the ISO 6346 algorithm for container numbers, IMO checksum rules for vessels, the IATA modulus-7 scheme for master air waybill numbers, and the published Incoterms rule set. Datasets are snapshots rather than live queries, which is why a miss warns rather than fails.
Can I add my own validation rules?
Workflow rules let you express the checks your operation cares about — required document sets, tolerances, and which findings should block a handoff. The built-in deterministic checks cover the structural and arithmetic layer that applies to every shipment regardless of who is running it.
Does validation slow down processing?
Negligibly. The checks are arithmetic and lookups against bundled data, measured in milliseconds against extraction measured in seconds. The time cost is in reviewing findings, which is the point — and why grading them by severity matters more than the compute.
What tolerance is applied to weight totals?
A small percentage band, because printed totals are routinely rounded differently from their component lines and flagging every rounding difference would bury the real findings. Differences beyond the band are reported with both figures shown so the size of the gap is visible, not just the fact of it.
Does validation check documents against each other?
Field-level validation checks a document against itself. Cross-document comparison — parties, references, quantities and weights across the Bill of Lading, invoice, packing list and purchase order — is a separate layer that runs when documents are grouped as one shipment.
Why not just reject documents that fail validation?
Because many failures are in the source document rather than in the reading, and the correct response is usually to fix the source or query the issuer rather than to discard the record. Rejecting also removes the evidence you need to raise the query. Findings surface for a decision; they do not delete data.
Are validation results included in exports?
Yes. PDF review reports show the findings alongside the extracted values, and structured exports carry the validation state so a downstream system can see which fields were confirmed and which were flagged. That trail is what makes a later dispute answerable.
Related tools, templates and guides
- Container number checkRun the ISO 6346 validation on a list of numbers without a document.
- ISO 6346 check digit guideThe formula, letter values and a worked example.
- Standards and datasetsWhich reference data is bundled and how current each snapshot is.
- Accuracy and limitationsThe boundary between what is checked and what is claimed.