Docs
Document OCR

Document OCR & Data Consistency

Extract structured data from documents and verify consistency with declared information

The Document OCR module extracts structured data from uploaded documents (identity cards, passports, driver's licenses, utility bills, tax notices) and compares it against declared information. It combines 2D-DOC cryptographic verification with OCR and fuzzy matching to produce a consistency report.

How it works

Documents go through a two-tier extraction pipeline:

TierMethodTrust levelWhen used
1. 2D-DOCBarcode detection + cryptographic verification2ddoc_verifiedDocument contains a signed 2D-DOC barcode
2. OCRAI-powered document OCR with structured extractionocrAny document: PDFs, photos, scanned documents

2D-DOC fields are cryptographically signed by the document issuer and take precedence. OCR fills any remaining gaps.


Extraction

2D-DOC (cryptographic proof)

Documents are scanned for 2D-DOC barcodes using a neural network detector. When a barcode is found, it is decoded and cryptographically verified against the ANTS trust store. Fields extracted from the barcode are guaranteed authentic; any tampering with the visible document content is detectable.

Common documents with 2D-DOC: utility bills (ENGIE, EDF), tax notices (DGFIP), new French CNI (ANTS), administrative attestations.

OCR (structured extraction)

For fields not covered by 2D-DOC, documents are processed with AI-powered OCR that returns structured fields directly. Supports any document format (PDF, JPEG, PNG), including scanned documents, photos of ID cards, and handwritten receipts.

The extraction schema is configured per document category, specifying which fields to extract and whether they are required.


Matching

Once fields are extracted from all documents, the system compares each declared field against the best available extraction.

Field matching

For each field, the system picks the best extraction based on document category and trust tier, then applies fuzzy matching:

StrategyConfidenceExample
Exact match (normalized)1.0Léa-Marie = LEA-MARIE
Containment0.9DUPONT found in MR ET MME DUPONT MARTIN
Address abbreviation0.912 cité Verte = 12 CITE VERTE
Close spelling (Levenshtein)0.8MARTIN vs MARTNI (edit distance: 1)
Partial word match0.6-0.85Word-level overlap between declared and extracted
No match0.0Values are unrelated

Date matching

Dates receive special handling to detect common errors:

ScenarioConfidenceFlag
Exact match1.0none
DD/MM swap0.0date_dd_mm_swap
Wrong day, month, or year0.2-0.4Component mismatch flagged
Completely different0.0none

Date formats are normalized: 05.07.1990, 05/07/1990, 05-07-1990, and 05071990 are all equivalent.

Cross-document consistency

When the same field appears in multiple documents, the system checks whether the documents agree with each other. If two documents agree on a value but it differs from what was declared, a declared_vs_docs_mismatch flag is raised.


Scoring

The overall score is a weighted average of per-field confidence. Fields, weights, and thresholds are configurable per organization via the dashboard.

ResultCondition
passScore above pass threshold, no flags requiring review, no missing required fields
reviewScore above review threshold, or any flag requiring human review
failScore below review threshold

Flags that require human review: date_dd_mm_swap, declared_vs_docs_mismatch, spelling_close.

Missing required fields always cap the result at review.


Flags

FlagMeaning
date_dd_mm_swapDay and month appear swapped between declared and document values
spelling_closeName is very close but not identical; requires human verification
partial_addressAddress partially matches; some components are missing
cross_doc_mismatchTwo documents disagree on the same field
declared_vs_docs_mismatchDocuments agree with each other but differ from declared data