# dipesh10110n1/rural-health-connect architecture

> Architecture diagram of the GitHub repository dipesh10110n1/rural-health-connect, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dipesh10110n1/rural-health-connect
- Repository: https://github.com/dipesh10110n1/rural-health-connect

## Overview

Rural Health Connect is a role-based rural healthcare web platform. A visitor enters through the routed React app, selects a role to authenticate, and reaches a role-specific dashboard or healthcare feature. The home page dispatches users into emergency response, AI consultation, doctor-network, community-worker, IVR, USSD, and external-database setup experiences; training includes lessons and quizzes. Supabase provides authentication and the documented backend foundation. The graph includes the substantial indexed modules and documented serverless capabilities; unsampled function internals and their invocation paths are not inferred.

Main entry points: [`src/pages/Index.tsx`](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/pages/Index.tsx) (Home Experience), [`src/App.tsx`](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/App.tsx) (Routed Web App), [`src/pages/auth`](https://github.com/dipesh10110n1/rural-health-connect/tree/main/src/pages/auth) (Role Authentication), [`src/components/AIConsultation.tsx`](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/AIConsultation.tsx) (AI Consultation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application and Access"]
  node_app["Routed Web App<br/>[App.tsx]"]
  node_home["Home Experience<br/>[Index.tsx]"]
  node_role_select["Role Selection<br/>[AuthSelection.tsx]"]
  node_role_auth["Role Authentication"]
  node_auth_context["Auth Context<br/>[AuthContext.tsx]"]
  node_dashboards["Role Dashboards"]
end

subgraph group_care["Care Services"]
  node_emergency["Emergency Response"]
  node_ai_consult["AI Consultation<br/>[AIConsultation.tsx]"]
  node_consult_form["Consultation Form"]
  node_doctor_network["Doctor Network<br/>[DoctorNetwork.tsx]"]
  node_approval["Patient Approvals"]
end

subgraph group_community["Community and Learning"]
  node_community_dashboard["Worker Tools"]
  node_video_lessons["Video Lessons"]
  node_quiz["Training Quiz<br/>[QuizPlayer.tsx]"]
  node_ivr["IVR Simulator<br/>[IVRSimulator.tsx]"]
  node_ussd["USSD Menu<br/>[USSDMenu.tsx]"]
  node_voice["Voice Provider<br/>[VoiceProvider.tsx]"]
end

subgraph group_platform["Backend Platform"]
  node_external_setup["External DB Setup"]
  node_supabase_client["Supabase Client<br/>[client.ts]"]
  node_supabase_db[("Supabase PostgreSQL")]
  node_medical_fn["Medical Consultation Function<br/>[index.ts]"]
  node_initial_sync["Initial Sync Function<br/>[index.ts]"]
  node_database_sync["Database Sync Function<br/>[index.ts]"]
  node_setup_fn["External DB Setup Function<br/>[index.ts]"]
  node_i18n["Language Configuration<br/>[config.ts]"]
  node_toast_hook["Toast State<br/>[use-toast.ts]"]
  node_button["Button Primitive<br/>[button.tsx]"]
  node_badge["Badge Primitive<br/>[badge.tsx]"]
  node_card["Card Primitive<br/>[card.tsx]"]
  node_dialog["Dialog Primitive<br/>[dialog.tsx]"]
  node_input["Input Primitive<br/>[input.tsx]"]
  node_label["Label Primitive<br/>[label.tsx]"]
  node_sheet["Sheet Primitive<br/>[sheet.tsx]"]
end

node_visitor(("Patient or Provider"))

node_visitor -->|"opens"| node_app
node_app -->|"routes to"| node_home
node_app -->|"routes to"| node_role_select
node_app -->|"routes to"| node_role_auth
node_app -->|"routes to"| node_dashboards
node_app -->|"provides auth"| node_auth_context
node_role_auth -->|"authenticates through"| node_auth_context
node_auth_context -->|"uses"| node_supabase_client
node_home -->|"renders"| node_emergency
node_home -->|"renders"| node_ai_consult
node_home -->|"renders"| node_community_dashboard
node_home -->|"renders"| node_doctor_network
node_home -->|"renders"| node_ivr
node_home -->|"renders"| node_ussd
node_home -->|"renders"| node_external_setup
node_ai_consult -->|"uses"| node_voice
node_ai_consult -->|"uses"| node_supabase_client
node_ai_consult -->|"uses"| node_i18n
node_community_dashboard -->|"renders"| node_video_lessons
node_community_dashboard -->|"renders"| node_quiz
node_ivr -->|"uses"| node_voice
node_home -.->|"offers consultation"| node_consult_form
node_dashboards -.->|"includes approval requests"| node_approval
node_supabase_client -->|"connects to"| node_supabase_db
node_medical_fn -.->|"backend service"| node_supabase_db
node_initial_sync -.->|"backend service"| node_supabase_db
node_database_sync -.->|"backend service"| node_supabase_db
node_setup_fn -.->|"backend service"| node_supabase_db
node_external_setup -.->|"configures through"| node_setup_fn
node_ai_consult -.->|"may invoke"| node_medical_fn
node_community_dashboard -->|"uses"| node_toast_hook
node_ai_consult -->|"uses"| node_toast_hook
node_ivr -->|"uses"| node_toast_hook
node_quiz -->|"renders with"| node_dialog
node_role_auth -->|"renders with"| node_button
node_role_auth -->|"renders with"| node_card
node_role_auth -->|"renders with"| node_input
node_role_auth -->|"renders with"| node_label
node_home -->|"renders with"| node_card
node_community_dashboard -->|"renders with"| node_badge
node_home -.->|"renders with"| node_sheet

click node_app "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/App.tsx"
click node_home "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/pages/Index.tsx"
click node_role_select "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/pages/AuthSelection.tsx"
click node_role_auth "https://github.com/dipesh10110n1/rural-health-connect/tree/main/src/pages/auth"
click node_auth_context "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/contexts/AuthContext.tsx"
click node_dashboards "https://github.com/dipesh10110n1/rural-health-connect/tree/main/src/pages/dashboards"
click node_emergency "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/EmergencyResponse.tsx"
click node_ai_consult "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/AIConsultation.tsx"
click node_consult_form "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ConsultationForm.tsx"
click node_doctor_network "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/DoctorNetwork.tsx"
click node_approval "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/PatientApprovalRequests.tsx"
click node_community_dashboard "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/HealthWorkerDashboard.tsx"
click node_video_lessons "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/VideoLessonPlayer.tsx"
click node_quiz "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/QuizPlayer.tsx"
click node_ivr "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/IVRSimulator.tsx"
click node_ussd "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/USSDMenu.tsx"
click node_voice "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/VoiceProvider.tsx"
click node_external_setup "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ExternalDBSetup.tsx"
click node_supabase_client "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/integrations/supabase/client.ts"
click node_medical_fn "https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/medical-consultation/index.ts"
click node_initial_sync "https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/initial-sync/index.ts"
click node_database_sync "https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/database-sync/index.ts"
click node_setup_fn "https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/setup-external-db/index.ts"
click node_i18n "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/i18n/config.ts"
click node_toast_hook "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/hooks/use-toast.ts"
click node_button "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/button.tsx"
click node_badge "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/badge.tsx"
click node_card "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/card.tsx"
click node_dialog "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/dialog.tsx"
click node_input "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/input.tsx"
click node_label "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/label.tsx"
click node_sheet "https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/sheet.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_home,node_role_select,node_role_auth,node_auth_context,node_dashboards toneBlue
class node_emergency,node_ai_consult,node_consult_form,node_doctor_network,node_approval toneAmber
class node_community_dashboard,node_video_lessons,node_quiz,node_ivr,node_ussd,node_voice toneMint
class node_external_setup,node_supabase_client,node_supabase_db,node_medical_fn,node_initial_sync,node_database_sync,node_setup_fn,node_i18n,node_toast_hook,node_button,node_badge,node_card,node_dialog,node_input,node_label,node_sheet toneRose
class node_visitor toneIndigo
```

## Components

### Application and Access

- [Routed Web App](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/App.tsx): `src/App.tsx`
- [Home Experience](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`
- [Role Selection](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/pages/AuthSelection.tsx): `src/pages/AuthSelection.tsx`
- [Role Authentication](https://github.com/dipesh10110n1/rural-health-connect/tree/main/src/pages/auth): `src/pages/auth`
- [Auth Context](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Role Dashboards](https://github.com/dipesh10110n1/rural-health-connect/tree/main/src/pages/dashboards): `src/pages/dashboards`

### Care Services

- [Emergency Response](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/EmergencyResponse.tsx): `src/components/EmergencyResponse.tsx`
- [AI Consultation](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/AIConsultation.tsx): `src/components/AIConsultation.tsx`
- [Consultation Form](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ConsultationForm.tsx): `src/components/ConsultationForm.tsx`
- [Doctor Network](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/DoctorNetwork.tsx): `src/components/DoctorNetwork.tsx`
- [Patient Approvals](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/PatientApprovalRequests.tsx): `src/components/PatientApprovalRequests.tsx`

### Community and Learning

- [Worker Tools](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/HealthWorkerDashboard.tsx): `src/components/HealthWorkerDashboard.tsx`
- [Video Lessons](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/VideoLessonPlayer.tsx): `src/components/VideoLessonPlayer.tsx`
- [Training Quiz](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/QuizPlayer.tsx): `src/components/QuizPlayer.tsx`
- [IVR Simulator](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/IVRSimulator.tsx): `src/components/IVRSimulator.tsx`
- [USSD Menu](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/USSDMenu.tsx): `src/components/USSDMenu.tsx`
- [Voice Provider](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/VoiceProvider.tsx): `src/components/VoiceProvider.tsx`

### Backend Platform

- [External DB Setup](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ExternalDBSetup.tsx): `src/components/ExternalDBSetup.tsx`
- [Supabase Client](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase PostgreSQL**
- [Medical Consultation Function](https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/medical-consultation/index.ts): `supabase/functions/medical-consultation/index.ts`
- [Initial Sync Function](https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/initial-sync/index.ts): `supabase/functions/initial-sync/index.ts`
- [Database Sync Function](https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/database-sync/index.ts): `supabase/functions/database-sync/index.ts`
- [External DB Setup Function](https://github.com/dipesh10110n1/rural-health-connect/blob/main/supabase/functions/setup-external-db/index.ts): `supabase/functions/setup-external-db/index.ts`
- [Language Configuration](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/i18n/config.ts): `src/i18n/config.ts`
- [Toast State](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/hooks/use-toast.ts): `src/hooks/use-toast.ts`
- [Button Primitive](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/button.tsx): `src/components/ui/button.tsx`
- [Badge Primitive](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/badge.tsx): `src/components/ui/badge.tsx`
- [Card Primitive](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/card.tsx): `src/components/ui/card.tsx`
- [Dialog Primitive](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/dialog.tsx): `src/components/ui/dialog.tsx`
- [Input Primitive](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/input.tsx): `src/components/ui/input.tsx`
- [Label Primitive](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/label.tsx): `src/components/ui/label.tsx`
- [Sheet Primitive](https://github.com/dipesh10110n1/rural-health-connect/blob/main/src/components/ui/sheet.tsx): `src/components/ui/sheet.tsx`

### Other components

- **Patient or Provider**

## Connections

- Patient or Provider → Routed Web App: opens (evidence: `src/App.tsx`)
- Routed Web App → Home Experience: routes to (evidence: `src/App.tsx`)
- Routed Web App → Role Selection: routes to (evidence: `src/App.tsx`)
- Routed Web App → Role Authentication: routes to (evidence: `src/App.tsx`)
- Routed Web App → Role Dashboards: routes to (evidence: `src/App.tsx`)
- Routed Web App → Auth Context: provides auth (evidence: `src/App.tsx`)
- Role Authentication → Auth Context: authenticates through (evidence: `src/pages/auth/AshaWorkerAuth.tsx`)
- Auth Context → Supabase Client: uses (evidence: `src/contexts/AuthContext.tsx`)
- Home Experience → Emergency Response: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → AI Consultation: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → Worker Tools: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → Doctor Network: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → IVR Simulator: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → USSD Menu: renders (evidence: `src/pages/Index.tsx`)
- Home Experience → External DB Setup: renders (evidence: `src/pages/Index.tsx`)
- AI Consultation → Voice Provider: uses (evidence: `src/components/AIConsultation.tsx`)
- AI Consultation → Supabase Client: uses (evidence: `src/components/AIConsultation.tsx`)
- AI Consultation → Language Configuration: uses (evidence: `src/components/AIConsultation.tsx`)
- Worker Tools → Video Lessons: renders (evidence: `src/components/HealthWorkerDashboard.tsx`)
- Worker Tools → Training Quiz: renders (evidence: `src/components/HealthWorkerDashboard.tsx`)
- IVR Simulator → Voice Provider: uses (evidence: `src/components/IVRSimulator.tsx`)
- Home Experience → Consultation Form: offers consultation
- Role Dashboards → Patient Approvals: includes approval requests
- Supabase Client → Supabase PostgreSQL: connects to (evidence: `README.md`)
- Medical Consultation Function → Supabase PostgreSQL: backend service (evidence: `README.md`)
- Initial Sync Function → Supabase PostgreSQL: backend service (evidence: `README.md`)
- Database Sync Function → Supabase PostgreSQL: backend service (evidence: `README.md`)
- External DB Setup Function → Supabase PostgreSQL: backend service (evidence: `README.md`)
- External DB Setup → External DB Setup Function: configures through
- AI Consultation → Medical Consultation Function: may invoke
- Worker Tools → Toast State: uses (evidence: `src/components/HealthWorkerDashboard.tsx`)
- AI Consultation → Toast State: uses (evidence: `src/components/AIConsultation.tsx`)
- IVR Simulator → Toast State: uses (evidence: `src/components/IVRSimulator.tsx`)
- Training Quiz → Dialog Primitive: renders with (evidence: `src/components/QuizPlayer.tsx`)
- Role Authentication → Button Primitive: renders with (evidence: `src/pages/auth/AshaWorkerAuth.tsx`)
- Role Authentication → Card Primitive: renders with (evidence: `src/pages/auth/AshaWorkerAuth.tsx`)
- Role Authentication → Input Primitive: renders with (evidence: `src/pages/auth/AshaWorkerAuth.tsx`)
- Role Authentication → Label Primitive: renders with (evidence: `src/pages/auth/AshaWorkerAuth.tsx`)
- Home Experience → Card Primitive: renders with (evidence: `src/pages/Index.tsx`)
- Worker Tools → Badge Primitive: renders with (evidence: `src/components/HealthWorkerDashboard.tsx`)
- Home Experience → Sheet Primitive: renders with (evidence: `src/pages/Index.tsx`)
