Skip to content

Prescription Label OCR + Human-Verification Flow for Medication AutofillΒ #47

@hoangsonww

Description

@hoangsonww

Summary

Add a medication-label OCR flow so users can snap or upload a prescription label image and prefill medication reminder fields when barcode/QR data is unavailable.

Motivation

SymptomSync already supports barcode scanning, but many labels are damaged, missing, or not machine-readable. OCR-based autofill would reduce manual typing and lower data-entry friction while still keeping users in control.

Proposed scope (MVP)

  1. Label capture/input
  • Allow image upload and camera capture from the medication creation/edit flow.
  1. OCR extraction
  • Extract structured candidates for:
    • medication name
    • strength
    • dosage instructions
    • frequency text
    • optional NDC / Rx number if present
  1. Parsing + confidence scoring
  • Normalize OCR text into medication form fields.
  • Return per-field confidence (high, medium, low) to drive UX.
  1. Human verification step (required)
  • Show extracted values in editable form fields before save.
  • Require explicit user confirmation; never auto-save to database directly from OCR output.
  1. Provenance + observability
  • Store extraction metadata (source=ocr_label, timestamp, confidence summary) for debugging and quality tracking.

Suggested technical approach

  • Frontend:
    • Add "Scan Label" CTA in medication form.
    • Reuse existing medication form validation, but prefill values from OCR response.
  • Backend:
    • Add /api/med/ocr endpoint that accepts image input and returns normalized fields + confidence.
    • Use a pluggable OCR service layer so provider changes do not affect UI contracts.
  • Data:
    • Add optional metadata columns (or side table) for OCR provenance and confidence snapshots.

Acceptance criteria

  • User can upload/capture a medication label image from medication form.
  • OCR response prefills medication fields in editable state.
  • User must review and confirm before medication is created/updated.
  • Low-confidence fields are visibly flagged for manual review.
  • OCR failures return actionable messages without blocking manual entry.
  • Unit/integration tests cover OCR parsing, confidence mapping, and confirmation gating.

Out of scope (later)

  • Full handwriting recognition for cursive notes.
  • Direct pharmacy integrations/e-prescription import.

Suggested labels

enhancement, help wanted

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcodexdocumentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is neededquestionFurther information is requested

Projects

Status

Backlog

Relationships

None yet

Development

No branches or pull requests

Issue actions