Peru Prescription OCR

Research & Model Selection Report

Prescription Bot Project | CustomerTimes HLS Practice | May 27, 2026

Downloads

1. Executive Summary

KEY FINDING: No existing dataset of Peruvian prescriptions exists on HuggingFace or Kaggle. The client's 1-year historical corpus (~100k labeled pairs) is the critical training asset. PP-OCRv5 + Donut is the recommended model stack.

2. HuggingFace Model Recommendations

Tier 1 - Production Models Recommended

PropertyPP-OCRv5Donut (Medical)
HuggingFace IDPaddlePaddle/PP-OCRv5_server_det/recchinmays18/medical-prescription-ocr
Parameters~70M total~200M
LicenseApache 2.0MIT
SpanishYes - 100+ languagesVia fine-tuning
Handwriting★★★★★ SOTA★★★★ 84% word-level
OutputText + bounding boxesDirect structured JSON
GPUCPU OK (370+ char/sec)1x L4/A10G
Key AdvantagePurpose-built for noisy handwritingEnd-to-end image-to-JSON

Tier 2 - Alternatives Strong

ModelHuggingFace IDParamsLicenseBest For
TrOCR Prescriptionaci-mis-team/trocr-large-handwritten-prescription560MMITPrescription handwriting
GOT-OCR2GOT-OCR/GOT-OCR21B+CheckGeneral document OCR
RolmOCRreducto-ai/RolmOCR7BApache 2.0Document transcription
Florence-2microsoft/Florence-2-largeMulti-BMITFew-shot extraction
Qwen2.5-VLQwen/Qwen2.5-VL-7B-Instruct7BApache 2.0Joint OCR + interpretation
Claude VisionAnthropic API (Sonnet 4.6)APIAPIPilot (100%), steady (5%)

Recommended Architecture

Phone Photo --> Pre-processing (deskew, crop, enhance) | v PP-OCRv5 (text detection + recognition) | v Donut fine-tuned (structured JSON extraction) | (if confidence < 0.85) v Claude Vision (fallback) | v Master file matching (product/doctor/outlet via rapidfuzz) | v Postgres --> Weekly Excel report

Full Comparison Matrix

ModelParamsLicenseHandwritingSpanishJSONGPU
PP-OCRv570MApache 2.0★★★★★YesPipelineCPU
Donut200MMIT★★★★Fine-tuneDirectL4
TrOCR560MMIT★★★★★Fine-tuneTextT4
GOT-OCR21B+Check★★★YesPromptA10G
RolmOCR7BApache★★★YesPromptA10G
Florence-2Multi-BMIT★★★YesPromptA100
ClaudeAPIAPI★★★★YesPromptN/A

3. Peru Prescription Format (Receta Unica Estandarizada)

Regulated by DIGEMID under MINSA. Official template: DIGEMID Model (PDF)

Standard Fields

SectionFieldsNotes
InstitutionLogo, name, addressPrinted/stamped
PatientNombres, DNI, Edad, Sexo, HCOften handwritten
DiagnosisDiagnostico, CIE-10, EspecialidadICD-10 codes
MedicationsDCI, Concentracion, Forma, Dosis, FrecuenciaCore extraction target
DatesFecha Expedicion, Fecha Validezdd/mm/yyyy
PrescriberNombre, CMP, Firma, SelloStamp overlaps text

Institutional Variations

InstitutionCharacteristicsVolume
Hospital de la SolidaridadCity coat of arms, standardized RUE, mostly handwritten~20%
MINSA HospitalsMINSA logo, standard RUE, varies by region~20%
EsSaludPrinted/digital forms, barcodes, insurance number~15%
Private ClinicsCustom letterhead, same required fields~15%
Generic PadsPlain pads, fully handwritten~15%

OCR Challenges

ChallengeDescription
Poor HandwritingIllegible doctor handwriting with personal shorthand
Phone DistortionPerspective skew, rotation from quick pharmacy photos
LightingShadows, reflections, flash glare
CompressionWhatsApp JPEG compression reduces detail
Stamp OverlapDoctor's stamp overlaps medication text
Abbreviationstab, cap, gts, c/8h, VO, IM, amp

4. Training Datasets

CRITICAL GAP: No existing dataset of Peruvian prescriptions exists. All available datasets are English or Bengali with non-Latin American formats.
DatasetSourceImagesLanguage
chinmays18/medical-prescription-datasetHuggingFace1,000 syntheticEnglish
avi-kai/Medical_Prescription_Handwritten_WordsHuggingFace~40English
RxHandBDMendeley5,578Bengali/EN
Doctor's Handwritten Prescription BDKaggle~500+Bengali/EN

Data Strategy

SourceDescription
1. Client Historical Corpus~100k labeled pairs from 1 year of manual transcription (PRIMARY)
2. Synthetic GenerationGenerate synthetic Peruvian prescription images
3. Manus Web Collection47 real images + 500 catalog entries (COMPLETED)
4. Active Learning LoopHuman corrections feed back into training data

5. Manus AI Data Collection COMPLETED

Task ID: NXRJM6HC3JMMh6TuS3nbNB | Agent: manus-1.6-max | View Task

The Manus agent collected 47 real prescription images from 10 source categories (Scribd, SlideShare, Studocu, government portals, news, social media) plus 453 synthetic metadata entries for a total of 500 catalog entries.

DeliverableSizeContents
peru_rx_dataset.zip5.3 MB47 images (rx_0001-rx_0047) in JPG/PNG/WebP
prescription_catalog.csv104 KB500 entries with full metadata columns
peru_rx_vocabulary.md19 KBTop 100 medications, abbreviations, CIE-10 codes
template_analysis.md11 KBRUE template analysis by institution type
sources_summary.md6.2 KB10 source categories with result counts

6. Key References

Regulatory

Models & Technology