Medical Form Hybrid Digitization Development

Job ID: 40124150

Budget: $1,500 – $3,000 USD

Project Title:
Hybrid Handwritten Medical Form Digitization System (QR-Based Template + ROI OCR)

Project Overview
We are looking to build a hybrid (human-in-the-loop) document digitization system for hospitals, focusing on handwritten patient forms such as consent forms and questionnaires.

The goal is NOT full automation.
Instead, the goal is to:
- Automatically extract structured data as much as possible
- Highlight low-confidence fields
- Allow quick human verification (within seconds)

This approach is required because fully automatic digitization of handwritten hospital documents is not realistic in real clinical environments.

Target Documents
- Patient consent forms
- Medical questionnaires
- Other A4 paper forms filled out by patients

Common characteristics:
- Fixed layout
- Checkboxes, numbers, short handwritten text
- Signatures and free-text fields may exist

Core Concept: ROI-Based Extraction
This system does not attempt to understand the entire document.
Instead, it works with pre-defined ROIs (Regions of Interest):
- Each ROI represents one field on the form
- Example: one checkbox, one phone number box, one date field

Each ROI is defined by:
- field_name
- type: checkbox / number / short_text
- Coordinates (x, y, width, height)
- Optional validation rules (numeric only, date format, etc.)

Template Management (Required)
Each document type is managed as a template.

Template Components
- Original template image (JPG/PNG)
- QR code
- Size: 1 cm × 1 cm
- Position: bottom or right-middle of the document
- Alignment markers
- Black circular markers
- Diameter: 5 mm
- Located at the four corners of the document
- ROI field definitions (DB / CSV / JSON)

Template Features
- Create / update / delete templates
- Templates may be modified over time

Input (Scanning)
- 300 DPI grayscale scans recommended
- JPG / PNG input (PDF support is a plus)
- Single or batch scanning

Processing Pipeline (Required)
1. Input scanned image
2. Detect QR code → identify template
3. Detect alignment markers → correct rotation, perspective, skew
4. Extract ROIs based on template coordinates
5. Field-type-specific recognition:
- Checkbox: checked / unchecked
- Number: numeric OCR + format validation
- Short text: OCR / handwriting recognition
6. Calculate confidence score per ROI
7. Highlight low-confidence fields for human review
8. User reviews/edits → final confirmation
9. Save final results

Hybrid (Human-in-the-Loop) Requirement – VERY IMPORTANT
- The goal is not 100% automatic recognition
- The system must support:
- Confidence scores per field
- Visual emphasis on low-confidence fields only
- ROI cropped image preview for verification
- Human verification is expected and required

Data Storage & Output
- Store results in a database (SQLite preferred initially)
- Export results as CSV (by date / template)
- Store original scanned images
- (Optional) store cropped ROI images for audit/debugging

Recognition Scope Policy
- Checkboxes, numbers, dates → primary OCR targets
- Signatures and long free-text → image storage only (OCR optional)

UI Expectations
One of the following is acceptable:
- Desktop application (Windows preferred), or
- Web-based internal tool (local or on-premise)
Minimum UI features:
- Template management
- Scan upload (drag & drop)
- Result list with ROI preview
- CSV export

Technology (Developer Proposal Welcome)
- Image processing: OpenCV
- QR detection: OpenCV / zxing / pyzbar
- OCR:
- Local OCR + optional commercial/cloud OCR fallback preferred
- Language: Python preferred
- Database: SQLite (initial)
Accuracy, robustness, and explainability are more important than novelty.

Deliverables
1. Working application
2. Full source code
3. Template data structure documentation
4. Sample output (CSV)
5. Setup and usage documentation

Milestone 1 – Proof of Concept
- QR detection
- Alignment correction
- ROI extraction
- Sample CSV output

Milestone 2 – Recognition Logic
- Checkbox, number, text OCR
- Confidence scoring

Milestone 3 – Review UI
- ROI preview
- Low-confidence highlighting
- Manual correction

Milestone 4 – Stabilization
- Batch processing
- Error handling
- Documentation

Questions Developers Must Answer
1. Experience with OCR / handwritten forms?
2. Experience with ROI-based document processing?
3. Proposed handwriting recognition approach (local vs API)?
4. How will confidence scores be calculated?
5. Fallback strategy if QR or alignment markers fail?
6. Estimated timeline and cost by milestone

Materials We Can Provide
- Template images
- ROI coordinate definitions
- Sample scanned handwritten forms (20–50 pages)

Success Criteria
- Not “perfect automation”
- 70%+ reduction in manual data entry time
- Stable performance in real hospital environments

Optional (Nice to Have)
- ROI selection UI (drag to define fields)
- Post-OCR editing grid
- Cloud storage integration