Home › Blog › OPD Scan QC: scoring thousands of scanned hospital pages with OpenCV, and keeping a human in charge

OPD Scan QC: scoring thousands of scanned hospital pages with OpenCV, and keeping a human in charge

Engineering · October 18, 2026 · 2 min read

A hospital records team scans paper case files all day. The question nobody could answer quickly was "which pages are unreadable and need a rescan?" This tool answers it, explains itself, and hands the final word to a reviewer.

OPD Scan QC runs at a university hospital where a records team digitises paper case files, thousands of pages at a time. Scanning is easy. Knowing which of those pages are actually readable, before they are archived and the paper is gone, is the hard part. That is what this tool does.

An engine that explains its verdict

Each uploaded page goes through an OpenCV pipeline that measures how readable it is: blur, skew, low contrast, cut-off edges, shadows, folds, blank pages, and so on, fourteen defect types in all. The important design choice was that every verdict comes with a plain-English reason. "Rescan: page is skewed 9° and the bottom edge is cut off" is something a scanning operator can act on; a score of 0.41 is not. The engine runs offline on the server, with no AI provider involved, so it is fast and free per page.

Rescans replace, they don't duplicate

When a page fails, the operator rescans it. In most systems that creates a second copy and someone later has to decide which one is real. Here pages are versioned: the rescan attaches to the page it replaces, the history is kept, and the file always has one current page.

Optional AI, mandatory human

If the hospital turns it on, the tool can locate handwriting on a page and transcribe any diagnosis already written there, through Google Document AI, Azure or Tesseract. The output never becomes the record on its own. A reviewer confirms or corrects every transcription, and the review is append-only: the original machine output is kept next to the human decision, so audits can see both.

Shipping it

  • A FastAPI backend with Celery workers doing the heavy image work in the background.
  • A React web app for operators and reviewers, and an Expo app for Android and iOS so a reviewer can work from a phone.
  • Exports to CSV, Excel, PDF and ZIP for the records office.
  • 231 automated backend tests, because a quality-control tool that is itself wrong is worse than no tool.

What I'd tell anyone building something similar

Start by sitting with the people who do the scanning. The defect list came from watching what actually went wrong on real pages, not from a paper. And make the machine explain itself; the moment people understand why a page failed, they stop fighting the tool and start fixing the scans. If your organisation is drowning in scans, custom software like this is quoted after a short look at the problem.

Tags: OpenCV, FastAPI, healthcare, OCR, React, Expo

More notes

Contact

[email protected] · GitHub · LinkedIn · X