YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
π₯ Medical Schedule OCR Pipeline
Local OCR extraction pipeline for scanned medical schedule PDFs.
Extracts begin_time, end_time, patient_name, dob (+ room, surgeon, anes, age/sex, minutes) per row.
96.9% field accuracy on synthetic benchmark β 100% on time fields, 93.8% on names and dates.
Quick Start
# Install
pip install easyocr pypdfium2 opencv-python-headless numpy pandas Pillow
# Run on your PDFs
python extract_schedules.py --input-dir C:\ml\nt-pdfs --output-dir ./output
# With GPU + higher DPI
python extract_schedules.py -i ./pdfs -o ./out --dpi 400 --gpu --verbose
What It Does
PDF pages β grayscale β deskew β denoise β CLAHE β EasyOCR β header detection
β row grouping β column assignment β regex normalisation β validation β CSV + JSON
Files
| File | Purpose |
|---|---|
extract_schedules.py |
Main pipeline β the only file you need to run |
create_test_pdf.py |
Generate synthetic test PDFs with known ground truth |
validate.py |
Compare extraction results against ground truth |
RECOMMENDATIONS.md |
Engine selection, tuning guide, known limitations |
Output
schedule_extracted.csvβ one row per schedule entry with confidence scoreschedule_extracted.jsonβ same data with per-field confidence breakdownextraction_summary.txtβ human-readable reportdebug/β preprocessed page images, annotated bounding boxes, raw OCR text
Expected Column Layout
ROOM | BEGIN | END | MIN | SURGEON | ANES | PATIENT'S NAME | AGE/SEX | DOB
The header is auto-detected by keyword matching. If your PDFs use different headers, edit HEADER_KW in the script.
CLI Options
--input-dir, -i Folder with scanned PDF files (required)
--output-dir, -o Output folder (default: ./output)
--dpi Render DPI (default: 300, try 400 for small text)
--row-threshold Y-pixel tolerance for row grouping (default: 25)
--gpu Use GPU for EasyOCR
--no-debug Skip debug output
--verbose, -v Verbose logging
Requirements
- Python 3.10+
- No system packages needed (no poppler, no tesseract)
- CPU works fine; GPU speeds up OCR ~3-5x
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support