Turning scanned documents into structured data.
A pharmaceutical document pipeline that combines image preprocessing, OCR, checkbox reading, and schema-based extraction. A retrieval layer answers questions over regulatory documents with cited sources.
Inside the project
I used OpenCV to prepare the scans, Tesseract and EasyOCR to read the text, and OMR to interpret checkboxes. LangChain structured output was checked against Pydantic schemas, with a regex baseline evaluated on the same labelled set.
The retrieval component used a regulatory corpus and source citations. I evaluated retrieval with hit@k and mean reciprocal rank (MRR).
The project evaluation covered 40 documents. Field-level accuracy was 0.974, and preprocessing increased mean OCR confidence from 81.6 to 93.3. These are results on that small evaluation set, not a guarantee for unseen documents.
{
"document_type": "sample_form",
"fields": { "demo_field": "value" },
"review_required": true
}Illustrative output only. No patient data.