Stage 3 — OCR & Data Extraction
Goal
Convert raw evidence collected in Stage 2 into structured, machine-readable document data. This stage focuses only on extracting information from documents—it does not perform legal interpretation.
Output: Document Intelligence Package.
Scope
This stage is responsible for image preprocessing, OCR, layout extraction, field extraction, confidence scoring, document-level metadata and summaries.
This stage does not classify documents, build chain of title, detect liens or perform legal reasoning.
Processing Pipeline
Raw Document
│
▼
Preprocessing
│
▼
Tesseract OCR
│
▼
Layout Extraction
│
▼
LangChain Extraction Pipeline
│
▼
Schema Validation
│
▼
Confidence Scoring
│
▼
Document Summary
│
▼
Structured Document
OCR
Initial implementation:
- Tesseract OCR
Preprocessing:
- Deskew
- Rotate
- Denoise
- Contrast enhancement
- TIFF conversion
- Blank page detection
Intelligent Extraction
Field extraction should not rely primarily on regex or fixed templates.
Instead, use a LangChain-based extraction pipeline that converts OCR output into structured JSON.
Pipeline
- OCR Text
- Page Layout
- Bounding Boxes
- Document Metadata ↓ LangChain ↓ Prompted LLM ↓ Structured JSON ↓ Schema Validation ↓ Confidence Scoring
The LLM should extract all supported fields into a deterministic schema.
Validation should verify:
- Required fields
- Data types
- Field formats
- Cross-field consistency
Regex should only be used as a validator or fallback for deterministic values such as:
- Dates
- Instrument Numbers
- APNs
- Recording Numbers
- Book/Page references
It should never be the primary extraction mechanism.
Field Extraction
Every document should expose a structured schema instead of only OCR text.
Common Fields
- Document ID
- Document Type (unknown until Stage 4)
- Recording Date
- Execution Date
- Recording Office
- Instrument Number
- Book
- Page
- Document Number
- Page Count
- County
- State
- Confidence Score
Property Fields
- Property Address
- Parcel / APN
- Legal Description
- Lot
- Block
- Subdivision
Parties
- Grantor(s)
- Grantee(s)
- Buyer(s)
- Seller(s)
- Borrower(s)
- Lender(s)
- Trustee
- Beneficiary
- Notary
- Witnesses
Financial Fields
- Loan Amount
- Consideration Amount
- Taxes
- Fees
References
- Previous Instrument
- Related Instrument
- Referenced Mortgage
- Referenced Deed
Signatures
- Signature Present
- Notary Present
- Seal Present
Layout Information
Store:
- OCR text
- Bounding boxes
- Lines
- Paragraphs
- Pages
- Confidence by region
Document Summary
Generate a concise summary for every document.
Example:
- Warranty Deed transferring ownership from John Doe to Jane Doe.
- Recorded on 2022-01-15.
- References Parcel XXXXX.
This summary is attached to the document only.
Cumulative Summary
Do not build a property-level cumulative summary in Stage 3.
Stage 3 should only generate document-level summaries.
A cumulative/property-level summary should be generated later, after:
- Document Classification
- Chain of Title
- Lien Search
- Risk Analysis
At that point the system has enough context to produce an accurate property summary.
Structured Document Output
Each processed document should contain:
- Raw File
- Preprocessed Images
- OCR Text
- Layout Information
- Bounding Boxes
- Structured JSON
- Extracted Fields
- Validation Results
- Confidence Scores
- Document Summary
- Processing Logs
- Extraction Version
- Prompt Version
Edge Cases
- Handwritten notes
- Poor scans
- Rotated pages
- Stamps
- Multi-column layouts
- Mixed document types
- Missing pages
- Corrupted PDFs
Human Involvement
None.
Low-confidence extraction is preserved and forwarded.
Definition of Done
- OCR completed.
- Structured fields extracted.
- Layout preserved.
- Document summary generated.
- Confidence scores generated.
- Structured document created.
- Ready for Stage 4.