How krishna-jajoo-git/pharmabrain works
PharmaBrain turns prescription images into patient-owned medical records: a patient uploads a prescription, the web API sends it to the OCR service for text extraction and structuring, and the resulting draft remains pending until human review and confirmation. Confirmed records support medication reconciliation, longitudinal trends, and patient-approved doctor access. The README documents the major capabilities and service integrations; source excerpts additionally show OCR forwarding, medication reconciliation, database access, and storage upload. Several feature routes and trend implementations are indexed but unsampled, so their internal call relationships are not inferred.
Main entry points: app Patient and doctor portals · final_prescription_ocr_service_windows.py Prescription OCR service · route.ts OCR upload API · MedicineEditor.tsx Draft review and editing
Components 17
Web experience and APIs
- Patient and doctor portals
frontend/app - OCR upload API
frontend/app/api/ocr/route.ts - Authentication
frontend/lib/auth.ts
Prescription extraction
- Prescription OCR service
model/final_prescription_ocr_service_windows.py - PaddleOCR
- Gemini structuring
- Draft review and editing
frontend/components/MedicineEditor.tsx - Field confidence badges
frontend/components/StatusBadge.tsx - Confirm or discard drafts
frontend/app/api/confirm/[id]/route.ts
Medical record
- Patient dashboard and timeline
frontend/app/api/user/dashboard/route.ts - Medication lifecycle
frontend/app/api/patient/medicines/route.ts - Medication reconciliation rules
frontend/lib/medicationLifecycle.ts
Trends and sharing
- Longitudinal trend analysis
frontend/lib/trendsService.ts - Consent-based doctor sharing
frontend/app/api/doctor/access-requests/route.ts
Other components
- Patient / clinician
- PostgreSQL / Supabase
- Prescription image storage
Connections 20
- Patient / clinician → Patient and doctor portals: uses
- Patient and doctor portals → OCR upload API: uploads image
- OCR upload API → Prescription OCR service: forwards image
frontend/app/api/ocr/route.ts - Prescription OCR service → PaddleOCR: extracts text
- Prescription OCR service → Gemini structuring: structures text
- Prescription OCR service → PostgreSQL / Supabase: stores pipeline data
- OCR upload API → Prescription image storage: uploads image
frontend/app/api/ocr/route.ts - Patient and doctor portals → Draft review and editing: reviews draft
- Draft review and editing → Field confidence badges: renders confidence
frontend/components/MedicineEditor.tsx - Draft review and editing → Confirm or discard drafts: submits decision
- Confirm or discard drafts → PostgreSQL / Supabase: records confirmation
- Patient and doctor portals → Authentication: authenticates
- Patient and doctor portals → Patient dashboard and timeline: requests dashboard
- Patient dashboard and timeline → PostgreSQL / Supabase: reads patient record
frontend/app/api/user/dashboard/route.ts - Patient and doctor portals → Medication lifecycle: manages medicines
- Medication lifecycle → Medication reconciliation rules: reconciles courses
frontend/app/api/patient/medicines/route.ts - Medication lifecycle → PostgreSQL / Supabase: reads and writes
frontend/app/api/patient/medicines/route.ts - Patient and doctor portals → Longitudinal trend analysis: views trends
- Patient and doctor portals → Consent-based doctor sharing: requests access
- Consent-based doctor sharing → PostgreSQL / Supabase: stores consent