How balayuvaraj2812/health works
MedSafe is a medication-management web application. Patients sign in, manage medication schedules, record doses, and receive reminder and safety information; they can also upload prescriptions for OCR extraction and review. The dashboard includes calendar, history, timeline, and AI-insight views, while the interface supports English and Telugu. The graph follows relationships visible in excerpts and the source index; unsampled dashboard links and reminder dispatch wiring are not asserted.
Main entry points: MedicationContext.tsx Medication state · firebase-admin.ts Firebase admin access · page.tsx Prescription workspace · route.ts Medication API
Components 30
Patient experience
- Dashboard overview
src/app/dashboard/page.tsx - Medication views
src/app/dashboard/medications/page.tsx - Schedule calendar
src/app/dashboard/calendar/page.tsx - Medication history
src/app/dashboard/history/page.tsx - Dose timeline
src/app/dashboard/timeline/page.tsx - Safety alerts
src/app/dashboard/alerts/page.tsx - AI insights
src/components/dashboard/AIInsightsPanel.tsx - Language context
src/context/LanguageContext.tsx
Medication management
- Medication state
src/context/MedicationContext.tsx - Medication API
src/app/api/medications/route.ts - Dose recording API
src/app/api/medications/take-dose/route.ts - Medication models
src/types/medication.ts
Prescription processing
- Prescription workspace
src/app/ePrescription/page.tsx - Prescription upload API
src/app/api/prescriptions/upload/route.ts - Prescription OCR API
src/app/api/prescriptions/ocr/route.ts - OCR engine
scripts/ocr_prescription.py - Prescription save API
src/app/api/prescriptions/save/route.ts
Identity and persistence
- Authentication APIs
src/app/api/auth/login/route.ts - JWT sessions
src/lib/jwt.ts - Prisma client
src/lib/prisma.ts - Relational database
- Firebase admin access
src/lib/firebase-admin.ts - Firestore
- Firebase Storage
Reminders and alerts
- Reminder API
src/app/api/reminders/route.ts - Reminder status API
src/app/api/reminders/status/route.ts - Reminder scheduler
src/lib/reminder-scheduler.ts - Notification service
src/lib/notification-service.ts
Other components
- Patient
- SMS gateway
Connections 33
- Patient → Dashboard overview: opens
- Patient → Prescription workspace: uploads prescription
- Prescription workspace → Medication state: uses state
src/app/ePrescription/page.tsx - Prescription workspace → Prescription upload API: uploads image
- Prescription workspace → Prescription OCR API: requests OCR
- Prescription workspace → Prescription save API: saves prescription
- Prescription OCR API → OCR engine: runs
src/app/api/prescriptions/ocr/route.ts - Prescription OCR API → Firebase admin access: gets storage and database
src/app/api/prescriptions/ocr/route.ts - Prescription upload API → Firebase admin access: uses Firebase
src/app/api/prescriptions/upload/route.ts - Prescription save API → Firebase admin access: uses Firestore
src/app/api/prescriptions/save/route.ts - Firebase admin access → Firestore: accesses
src/lib/firebase-admin.ts - Firebase admin access → Firebase Storage: accesses
src/lib/firebase-admin.ts - Medication views → Medication state: uses state
- Schedule calendar → Medication state: uses schedule
- Medication history → Medication state: uses history
- Dose timeline → Medication state: uses doses
- Safety alerts → Medication state: uses alerts
- AI insights → Medication state: reads medication state
src/components/dashboard/AIInsightsPanel.tsx - Medication state → Medication API: fetches and creates
src/context/MedicationContext.tsx - Medication state → Reminder API: updates dose state
src/context/MedicationContext.tsx - Medication state → Medication models: uses models
src/context/MedicationContext.tsx - Medication API → JWT sessions: authenticates
src/app/api/medications/route.ts - Medication API → Prisma client: queries medications
src/app/api/medications/route.ts - Dose recording API → JWT sessions: authenticates
src/app/api/medications/take-dose/route.ts - Dose recording API → Firebase admin access: uses Firebase
src/app/api/medications/take-dose/route.ts - Reminder API → JWT sessions: authenticates
src/app/api/reminders/route.ts - Reminder API → Prisma client: queries reminders
src/app/api/reminders/route.ts - Reminder status API → Reminder scheduler: uses scheduler
src/app/api/reminders/status/route.ts - Reminder status API → Firebase admin access: uses Firebase
src/app/api/reminders/status/route.ts - Reminder scheduler → Notification service: dispatches notifications
src/lib/reminder-scheduler.ts - Notification service → Firebase admin access: records notifications
src/lib/notification-service.ts - Notification service → SMS gateway: optionally dispatches SMS
src/lib/notification-service.ts - Prisma client → Relational database: queries