Skip to main content
Back to Projects
Computer Vision / OCRFeb 2024 → Aug 2024

Contextual AI & Medical Vision Pipelines

Suite of context-aware document intelligence pipelines: PDF intelligence (PyMuPDF + spaCy + BERT), passport MRZ segmentation, and prescription OCR.

PythonPyMuPDFspaCyBERTOpenCVPaddleOCRFastAPI
PDF entity F1
0.91
MRZ accuracy
98.5%
Rx field accuracy
94%

Problem & Solution

The Problem

Domain documents — medical PDFs, passports, prescriptions — each need specialized extraction. Generic OCR misses the structure, and context (e.g., MRZ check digits, dosage patterns) lives outside the pixel-level model.

The Solution

Built a suite of pipelines: PyMuPDF + spaCy + BERT for medical PDF intelligence (entities, sections, context), classical CV + OCR for passport MRZ segmentation and validation, and a fine-tuned OCR pipeline for prescription digitization with dosage parsing.

System Architecture

End-to-end flow from intake to outcome

  1. 01

    PDF Intelligence

    PyMuPDFspaCyBERT

    PyMuPDF extracts text and layout; spaCy + BERT detect medical entities and sections.

  2. 02

    Passport MRZ

    OpenCVPaddleOCR

    Image preprocessing, region localization, OCR, and check-digit validation.

  3. 03

    Prescription OCR

    PaddleOCRPython

    Fine-tuned OCR pipeline with dosage and frequency parsing.

  4. 04

    API

    FastAPI

    FastAPI exposes the pipelines as independent services.

Engineering Challenges & Wins

Optimization results and engineering tradeoffs

Optimization Results

  • PDF intelligence: PyMuPDF extraction + spaCy + BERT for medical entity recognition.
  • Passport MRZ segmentation and check-digit validation.
  • Prescription OCR with dosage and frequency parsing.

Engineering Challenges

  • Validating MRZ check digits against OCR output without silent errors.
  • Disambiguating medical abbreviations with context-aware BERT models.

More case studies

Explore other production systems I've engineered end-to-end.

All Projects

Related Projects

Computer Vision / OCR
Cheque Processing & Digitization Ecosystem

End-to-end cheque digitization pipeline using OpenCV for image preprocessing, PaddleOCR for text and amount extraction, and a Flask + Docker orchestration layer.

Field accuracy
96.2%
Throughput
120 img/s
p95 latency
850ms
PythonOpenCVPaddleOCRFlaskDocker+1
Autonomous AI AgentsFeatured
OmniShield ICES: Asynchronous AI Email Security Middleware

Mail-server gateway (Postfix Milter) that intercepts every inbound message, runs a fine-tuned BERT core (M-BSCE) through an asynchronous inference pipeline (RabbitMQ + Celery), and adds multimodal threat detection (PaddleOCR for Quishing) with SOAP clawbacks to the upstream mail system.

Quishing detection
98%+
p95 classification
<400ms
Async throughput
5k msg/min
PythonPostfix MilterRabbitMQCeleryBERT+6