How rudrakshsoni-dev/medisaathi works
MediSaathi is an offline-first medication companion: patients manage medicines and doses in the Android app, while caregivers monitor linked patients through a web dashboard. The patient workflow spans authentication, medication scheduling, daily dose tracking, reminders, history, and optional AI proposal approval; caregiver links, alerts, and health records form a distinct oversight workflow. The backend supplies authenticated APIs, deterministic drug-safety checks, proposal handling, and scheduled alerts. Some feature wiring is documented in the README but its implementation was not sampled; those relationships are cited as documentation.
Main entry points: routes.jsx App shell and routes · firebase.js Firestore data · agent.js Proposal API · useDoseEvents.js Dose and medicine data
Components 31
Patient app
- App shell and routes
MediSaathi/client/src/app/routes.jsx - Sign-in and session
MediSaathi/client/src/store/session.js - Medicine management
MediSaathi/client/src/features/meds/MedFormScreen.jsx - Today doses
MediSaathi/client/src/features/today/TodayScreen.jsx - Dose and medicine data
MediSaathi/client/src/hooks/useDoseEvents.js - Reminder synchronization
MediSaathi/client/src/hooks/useReminderSync.js - Local notifications
MediSaathi/client/src/native/notifications.js - History and records
MediSaathi/client/src/features/history/HistoryScreen.jsx - Profile and preferences
MediSaathi/client/src/features/profile/ProfileScreen.jsx
Caregiver oversight
- Caregiver dashboard
MediSaathi/client/src/features/caregiver/DashboardScreen.jsx - Patient detail
MediSaathi/client/src/features/caregiver/PatientDetailScreen.jsx - Caregiver linking
MediSaathi/client/src/features/caregiver/LinkScreen.jsx
Backend services
- API routing
MediSaathi/server/src/app.js - Token and role checks
MediSaathi/server/src/middleware/auth.js - Firestore data
MediSaathi/server/src/lib/firebase.js - Caregiver API
MediSaathi/server/src/routes/caregiver.js - Missed and refill jobs
MediSaathi/server/src/jobs/runJobs.js - Caregiver push delivery
MediSaathi/server/src/jobs/pushes.js - Drug index
MediSaathi/server/src/services/drugIndex.js
Assistant and safety
- Assistant screen
MediSaathi/client/src/features/assistant/AssistantScreen.jsx - Proposal API
MediSaathi/server/src/routes/agent.js - Agent orchestration
MediSaathi/server/src/agent/runAgent.js - Read-only tools
MediSaathi/server/src/agent/tools.js - Emergency and guards
MediSaathi/server/src/agent/guards.js
Shared domain logic
- Schedule builder
MediSaathi/shared/src/schedule.js - Dose event generation
MediSaathi/shared/src/doseEvents.js
Other components
- Patient
- Caregiver
- Gemini service
- FCM push service
- DDInter data
Connections 39
- Patient → App shell and routes: uses
README.md - Caregiver → Caregiver dashboard: monitors
README.md - App shell and routes → Sign-in and session: initializes
MediSaathi/client/src/app/routes.jsx - App shell and routes → Medicine management: routes to
MediSaathi/client/src/app/routes.jsx - App shell and routes → Today doses: routes to
MediSaathi/client/src/app/routes.jsx - App shell and routes → History and records: routes to
MediSaathi/client/src/app/routes.jsx - App shell and routes → Profile and preferences: routes to
MediSaathi/client/src/app/routes.jsx - App shell and routes → Assistant screen: routes to
MediSaathi/client/src/app/routes.jsx - App shell and routes → Caregiver dashboard: routes to
MediSaathi/client/src/app/routes.jsx - App shell and routes → Patient detail: routes to
MediSaathi/client/src/app/routes.jsx - App shell and routes → Caregiver linking: routes to
MediSaathi/client/src/app/routes.jsx - Medicine management → Dose and medicine data: reads and updates
MediSaathi/client/src/features/meds/MedFormScreen.jsx - Today doses → Dose and medicine data: tracks doses
README.md - Reminder synchronization → Dose and medicine data: reads
MediSaathi/client/src/hooks/useReminderSync.js - Reminder synchronization → Local notifications: synchronizes
MediSaathi/client/src/hooks/useReminderSync.js - Dose and medicine data → Firestore data: reads
MediSaathi/client/src/hooks/useDoseEvents.js - Sign-in and session → Firestore data: listens to profile
MediSaathi/client/src/store/session.js - Caregiver dashboard → Firestore data: live reads
README.md - Patient detail → Firestore data: reads records
README.md - API routing → Token and role checks: applies
MediSaathi/server/src/app.js - API routing → Caregiver API: mounts
MediSaathi/server/src/app.js - Token and role checks → Firestore data: loads profile
MediSaathi/server/src/middleware/auth.js - Caregiver API → Firestore data: reads and writes
MediSaathi/server/src/routes/caregiver.js - Missed and refill jobs → Firestore data: checks alerts
MediSaathi/server/src/jobs/runJobs.js - Missed and refill jobs → Caregiver push delivery: dispatches
MediSaathi/server/src/jobs/runJobs.js - Caregiver push delivery → FCM push service: sends
README.md - Assistant screen → Proposal API: requests proposals
README.md - Proposal API → Emergency and guards: checks emergency
MediSaathi/server/src/routes/agent.js - Proposal API → Agent orchestration: runs
MediSaathi/server/src/routes/agent.js - Agent orchestration → Read-only tools: invokes tools
MediSaathi/server/src/agent/runAgent.js - Agent orchestration → Gemini service: calls model
README.md - Read-only tools → Firestore data: reads context
- Read-only tools → Drug index: looks up drugs
- Emergency and guards → DDInter data: checks interactions
README.md - Proposal API → Firestore data: stores proposal
MediSaathi/server/src/routes/agent.js - Proposal API → Dose event generation: generates on approval
MediSaathi/server/src/routes/agent.js - Reminder synchronization → Schedule builder: uses dose window
MediSaathi/client/src/hooks/useReminderSync.js - Dose event generation → Schedule builder: uses schedule logic
MediSaathi/shared/src/doseEvents.js - Profile and preferences → Local notifications: configures reminders
README.md