How advaith-3683/mediflow-ai works
This repository implements a hospital-automation application: role-based React dashboards use shared state to make authenticated API requests, while an Express backend handles staff authentication, patient records, appointments, prescription OCR, and reports. Appointment booking is the clearest end-to-end workflow shown: a user works through a dashboard, shared context calls the appointment API, the server dispatches to appointment routes and controller logic, and the controller reads or writes Supabase. The root README is a Vite template rather than product documentation; backend capabilities are also evidenced by the route registrations and source index. Some frontend features and backend controllers were not excerpted, so their internal links are omitted where unverified.
Main entry points: App.jsx Role dispatcher · AppContext.jsx Application state · server.js HTTP server · db.js Supabase client
Components 29
Web application
- Role dispatcher
src/App.jsx - Staff login
src/views/LoginView.jsx - Patient dashboard
src/views/PatientView.jsx - Doctor dashboard
src/views/DoctorView.jsx - Admin dashboard
src/views/AdminView.jsx - Reception dashboard
src/views/ReceptionistView.jsx - App layout
src/components/Layout.jsx - Shared UI
src/components/UI.jsx - Application state
src/context/AppContext.jsx - AI utilities
src/utils/ai.js
API runtime
- HTTP server
hospital-automation-backend/src/server.js - Auth routes
hospital-automation-backend/src/routes/auth.routes.js - Patient routes
hospital-automation-backend/src/routes/patients.routes.js - Appointment routes
hospital-automation-backend/src/routes/appointments.routes.js - OCR routes
hospital-automation-backend/src/routes/ocr.routes.js - Report routes
hospital-automation-backend/src/routes/reports.routes.js - JWT authorization
hospital-automation-backend/src/middleware/auth.js - Request validation
hospital-automation-backend/src/middleware/validate.js - Error handling
hospital-automation-backend/src/middleware/errorHandler.js
Clinical workflows
- Authentication
hospital-automation-backend/src/controllers/auth.controller.js - Patient records
hospital-automation-backend/src/controllers/patients.controller.js - Appointment workflow
hospital-automation-backend/src/controllers/appointments.controller.js - Prescription OCR
hospital-automation-backend/src/controllers/ocr.controller.js - Hospital reports
hospital-automation-backend/src/controllers/reports.controller.js
Data and integrations
- Supabase client
hospital-automation-backend/src/config/db.js - Supabase data
- Gemini service
hospital-automation-backend/src/services/gemini.service.js
Other components
- Hospital user
- Google Gemini
Connections 44
- Hospital user → Role dispatcher: uses
src/App.jsx - Role dispatcher → Application state: provides state
src/App.jsx - Role dispatcher → Staff login: shows unauthenticated
src/App.jsx - Role dispatcher → Patient dashboard: selects role view
src/App.jsx - Role dispatcher → Doctor dashboard: selects role view
src/App.jsx - Role dispatcher → Admin dashboard: selects role view
src/App.jsx - Role dispatcher → Reception dashboard: selects role view
src/App.jsx - Role dispatcher → App layout: wraps dashboard
src/App.jsx - Role dispatcher → Shared UI: renders notifications
src/App.jsx - Patient dashboard → Application state: uses state
src/context/AppContext.jsx - Doctor dashboard → Application state: uses state
src/context/AppContext.jsx - Admin dashboard → Application state: uses state
src/context/AppContext.jsx - Reception dashboard → Application state: uses state
src/context/AppContext.jsx - Staff login → Application state: uses state
src/context/AppContext.jsx - Shared UI → Application state: reads notifications
src/components/UI.jsx - Patient dashboard → AI utilities: uses AI helpers
src/views/PatientView.jsx - Reception dashboard → AI utilities: uses AI helpers
src/views/ReceptionistView.jsx - Application state → Auth routes: requests authentication
src/context/AppContext.jsx - Application state → Patient routes: requests patient records
src/context/AppContext.jsx - Application state → Appointment routes: requests appointments
src/context/AppContext.jsx - HTTP server → Auth routes: mounts routes
hospital-automation-backend/src/server.js - HTTP server → Patient routes: mounts routes
hospital-automation-backend/src/server.js - HTTP server → Appointment routes: mounts routes
hospital-automation-backend/src/server.js - HTTP server → OCR routes: mounts routes
hospital-automation-backend/src/server.js - HTTP server → Report routes: mounts routes
hospital-automation-backend/src/server.js - Auth routes → Authentication: dispatches
hospital-automation-backend/src/routes/auth.routes.js - Patient routes → Patient records: dispatches
hospital-automation-backend/src/routes/patients.routes.js - Appointment routes → Appointment workflow: dispatches
hospital-automation-backend/src/routes/appointments.routes.js - OCR routes → Prescription OCR: dispatches
hospital-automation-backend/src/routes/ocr.routes.js - Report routes → Hospital reports: dispatches
hospital-automation-backend/src/routes/reports.routes.js - Appointment routes → JWT authorization: authenticates requests
hospital-automation-backend/src/routes/appointments.routes.js - Appointment routes → Request validation: validates booking
hospital-automation-backend/src/routes/appointments.routes.js - OCR routes → JWT authorization: authenticates requests
hospital-automation-backend/src/routes/ocr.routes.js - Report routes → JWT authorization: authenticates requests
hospital-automation-backend/src/routes/reports.routes.js - Authentication → Supabase client: reads and writes
hospital-automation-backend/src/controllers/auth.controller.js - Patient records → Supabase client: reads and writes
hospital-automation-backend/src/controllers/patients.controller.js - Appointment workflow → Supabase client: reads and writes
hospital-automation-backend/src/controllers/appointments.controller.js - Prescription OCR → Supabase client: uses data store
hospital-automation-backend/src/controllers/ocr.controller.js - Hospital reports → Supabase client: reads data
hospital-automation-backend/src/controllers/reports.controller.js - Supabase client → Supabase data: connects
hospital-automation-backend/src/config/db.js - Prescription OCR → Gemini service: extracts prescription
hospital-automation-backend/src/controllers/ocr.controller.js - Hospital reports → Gemini service: generates summary
hospital-automation-backend/src/controllers/reports.controller.js - Gemini service → Google Gemini: sends AI request
hospital-automation-backend/src/services/gemini.service.js - HTTP server → Error handling: registers handlers
hospital-automation-backend/src/server.js