Case Study 02 · Healthcare / Pharmacy
AI-Powered Prescription Analysis Automation
Turning a photo of a prescription into a structured, reviewed record in seconds.
Client
Confidential Healthcare Client (NDA)
Industry
Healthcare / Pharmacy
Stack
n8n, Telegram Bot, OpenAI Vision, OCR, Database
Minutes → Seconds
Processing speed
Edge cases only
Manual review volume
Fully structured
Record organization
The business challenge
Prescription intake was entirely manual — a staff member had to read each incoming prescription (often a photo sent by a patient or courier), interpret handwriting and medical shorthand, manually enter the details into a records system, and flag anything that needed pharmacist review, one at a time.
Prescription handwriting and image quality vary enormously, so the process couldn't be 'just read the text' — it needed to handle blurry photos, inconsistent formatting, and medical abbreviations reliably, while staying conservative enough to flag anything genuinely uncertain for a human pharmacist rather than guessing. Accuracy mattered more than speed, but speed was costing the team real hours every day.
Objectives
- Let patients submit prescriptions through a channel they already use, rather than a new portal
- Extract structured data (medication, dosage, patient details, prescriber) from images and text reliably
- Flag low-confidence or unusual cases for manual pharmacist review instead of guessing
- Store every record in an organized, searchable format automatically
The solution
Patients and couriers submit prescriptions directly through a Telegram bot. Each submission — image or text — runs through an AI OCR and vision analysis step that extracts the medication, dosage, patient, and prescriber details, structures them, and writes them into the client's records database. Anything below a confidence threshold is automatically routed to a pharmacist queue with the original image attached.
System architecture
A single intake channel (Telegram) feeds a two-stage AI pipeline — vision extraction, then structuring — with a confidence-based router that splits output between automatic database writes and a human review queue, so accuracy is never sacrificed for speed.
Workflow breakdown
Intake
A prescription image or text is submitted through a Telegram bot — no new app or portal required for patients.
OCR & Vision Analysis
AI Vision extracts raw text from the image, handling handwriting variance and common medical abbreviations.
Structured Extraction
A second AI pass converts the raw extraction into structured fields: medication, dosage, patient details, prescriber, date.
Confidence Check
Extractions below a set confidence threshold are automatically routed to a human pharmacist review queue instead of being auto-approved.
Database Write
Approved records are written into the client's database in a consistent, searchable structure.
Notification
The submitter and relevant staff are notified automatically once a record is processed.
Technical implementation
- n8n handles the orchestration from Telegram webhook through to database write, including the branching logic for confidence-based routing.
- OpenAI Vision performs the initial OCR and interpretation pass on prescription images, handling handwritten and printed formats alike.
- A dedicated structuring prompt converts free-text extraction into a fixed schema (medication, dosage, patient, prescriber, date), validated before it's allowed to write to the database.
- Low-confidence extractions are never auto-approved — they're routed with the original image attached so a pharmacist can review and correct in seconds rather than starting from scratch.
AI prompt strategy
The extraction prompt asks the model to output a confidence score and flag specific fields it's unsure about, rather than just returning a best guess. That self-reported uncertainty drives the routing logic — more reliable than inferring confidence after the fact, and it means the system fails safely toward human review instead of silently guessing on medication details.
Integrations used
Results
The team no longer processes every prescription by hand — only the genuine edge cases the system correctly flags. Records are structured and searchable from the moment they're created, and processing time dropped from minutes of manual reading and typing to seconds per submission.
Lessons learned
- Asking the model to self-report uncertainty (not just an answer) made the confidence-routing logic far more trustworthy than a post-hoc accuracy check.
- Keeping the intake channel as something patients already use (Telegram) removed nearly all adoption friction compared to a new portal.
- In a healthcare context, designing the system to fail safely toward a human — rather than optimizing purely for automation rate — was the right tradeoff.
Want a system like this for your business?
Tell me about your process and I'll get back to you within 24 hours with next steps.