How aryan22n/pharmabrain- works
Single-Hospital-Pro is a patient-and-clinician medical-record application centered on turning prescription images into clinician-reviewed structured records. The main workflow runs from image upload through OCR and Gemini-assisted structuring to draft review, correction, and confirmation; the product also supports patient history, timelines, trends, and clinician access workflows. The graph combines sampled source with README-documented capabilities and integrations; links not established by those excerpts or documentation are omitted.
Main entry points: final_prescription_ocr_service_windows.py OCR and extraction service · upload/page.tsx Prescription upload · [id]/page.tsx Extraction review · route.ts Confirm or discard
Components 23
Web experience
- Patient and clinician UI
frontend/app - Accounts and sessions
frontend/lib/auth.ts - Role-based sign-in
frontend/components/auth/AuthForm.tsx - Prescription upload
frontend/app/upload/page.tsx - OCR API route
frontend/app/api/ocr/route.ts - Extraction review
frontend/app/extractions/[id]/page.tsx - Medicine editor
frontend/components/MedicineEditor.tsx - Review status badges
frontend/components/StatusBadge.tsx - Confirm or discard
frontend/app/api/confirm/[id]/route.ts
Clinical records
- Patient record views
frontend/app/patient - Medical timeline
frontend/app/patient/timeline/page.tsx - Vitals and trends
frontend/app/api/patient/trends/route.ts - Patient access sharing
frontend/app/api/doctor/access-requests/route.ts - Medication lifecycle
frontend/lib/medicationLifecycle.ts
Prescription processing
- OCR and extraction service
model/final_prescription_ocr_service_windows.py - Medicine master import
model/import_medicines_bulk.py
Storage and services
- Shared application database
- Image storage integration
frontend/lib/supabaseStorage.ts - Supabase Storage
- PaddleOCR
- Google Gemini
Other components
- Patient
- Clinician
Connections 29
- Patient → Patient and clinician UI: uses
README.md - Clinician → Patient and clinician UI: uses
README.md - Patient and clinician UI → Role-based sign-in: presents
README.md - Role-based sign-in → Accounts and sessions: authenticates
frontend/components/auth/AuthForm.tsx - Patient → Prescription upload: submits image
README.md - Clinician → Prescription upload: submits image
README.md - Prescription upload → OCR API route: sends image
README.md - OCR API route → OCR and extraction service: calls over HTTP
README.md - OCR and extraction service → PaddleOCR: extracts text
README.md - OCR and extraction service → Google Gemini: structures draft
README.md - OCR and extraction service → Shared application database: stores records
README.md - OCR and extraction service → Extraction review: returns draft
README.md - Extraction review → Medicine editor: renders fields
frontend/components/MedicineEditor.tsx - Medicine editor → Review status badges: renders badges
frontend/components/MedicineEditor.tsx - Clinician → Extraction review: reviews draft
README.md - Extraction review → Confirm or discard: submits corrections
README.md - Confirm or discard → Shared application database: confirms record
README.md - Confirm or discard → Medication lifecycle: updates medication
- Prescription upload → Image storage integration: stores image
README.md - Image storage integration → Supabase Storage: uploads image
frontend/lib/supabaseStorage.ts - Patient → Patient record views: views records
README.md - Patient record views → Shared application database: reads records
README.md - Patient → Medical timeline: views history
README.md - Medical timeline → Shared application database: reads history
README.md - Patient → Vitals and trends: views trends
README.md - Vitals and trends → Shared application database: reads observations
frontend/app/api/patient/trends/route.ts - Clinician → Patient access sharing: requests access
README.md - Patient access sharing → Shared application database: records requests
- Medicine master import → Shared application database: imports medicines
model/import_medicines_bulk.py