# chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare- architecture

> Architecture diagram of the GitHub repository chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-
- Repository: https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-

## Overview

GramCare is an offline-first telehealth platform for rural care teams and patients. The main workflow is to authenticate, register or find a patient, book an appointment, conduct a consultation, and record clinical notes; triage, media, chat, and audit support that care. Clients can also submit and retrieve offline changes through sync, while store-and-forward supports delayed consultation work. The README documents these capabilities; sampled source confirms app routing, auth, storage URL generation, and live call/chat behavior, but most endpoint internals and offline client storage were not sampled.

Main entry points: [`backend/app/api/v1/router.py`](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/router.py) (API router), [`backend/app/db/session.py`](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/db/session.py) (Database sessions), [`frontend/src/App.jsx`](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/App.jsx) (Web application), [`frontend/src/api.js`](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/api.js) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_web_app["Web application<br/>[App.jsx]"]
  node_login["Sign in<br/>[Login.jsx]"]
  node_care_pages["Care workflows<br/>[Dashboard.jsx]"]
  node_appointment_room["Appointment room"]
  node_records_page["Patient records<br/>[PatientRecords.jsx]"]
  node_store_forward_page["Store-forward queue"]
  node_frontend_api["HTTP client<br/>[api.js]"]
end

subgraph group_api["REST care API"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_api_router["API router<br/>[router.py]"]
  node_auth["Authentication<br/>[auth.py]"]
  node_patients["Patient registration<br/>[patients.py]"]
  node_appointments["Appointments<br/>[appointments.py]"]
  node_encounters["Clinical records<br/>[encounters.py]"]
  node_triage["Rule-based triage<br/>[triage.py]"]
  node_sync["Offline sync<br/>[sync.py]"]
  node_media["Media access<br/>[media.py]"]
  node_messages["Message history<br/>[messages.py]"]
  node_teleconsult["Consultation rooms<br/>[teleconsult.py]"]
  node_user_admin["User and audit<br/>[users.py]"]
end

subgraph group_realtime["Live consultation"]
  node_realtime_server["Socket.IO signaling<br/>[socketio_app.py]"]
end

subgraph group_infrastructure["Persistence and services"]
  node_db_session["Database sessions<br/>[session.py]"]
  node_data_models["Care data models<br/>[models.py]"]
  node_postgres[("PostgreSQL")]
  node_redis[("Redis")]
  node_otp_service["OTP delivery<br/>[otp_service.py]"]
  node_object_storage[("MinIO object storage")]
  node_storage_service["Presigned URLs<br/>[storage_service.py]"]
end

node_care_users(("Patients and care team"))

node_care_users -->|"use"| node_web_app
node_web_app -->|"routes to"| node_login
node_web_app -->|"routes to"| node_care_pages
node_web_app -->|"routes to"| node_appointment_room
node_web_app -->|"routes to"| node_records_page
node_web_app -->|"routes to"| node_store_forward_page
node_login -->|"requests auth"| node_frontend_api
node_care_pages -->|"requests care"| node_frontend_api
node_records_page -->|"requests records"| node_frontend_api
node_store_forward_page -->|"syncs changes"| node_frontend_api
node_appointment_room -->|"loads room data"| node_frontend_api
node_appointment_room -->|"signals and chats"| node_realtime_server
node_frontend_api -->|"HTTPS requests"| node_api_app
node_api_app -->|"mounts routes"| node_api_router
node_api_router -->|"dispatches"| node_auth
node_api_router -->|"dispatches"| node_patients
node_api_router -->|"dispatches"| node_appointments
node_api_router -->|"dispatches"| node_encounters
node_api_router -->|"dispatches"| node_triage
node_api_router -->|"dispatches"| node_sync
node_api_router -->|"dispatches"| node_media
node_api_router -->|"dispatches"| node_messages
node_api_router -->|"dispatches"| node_teleconsult
node_api_router -->|"dispatches"| node_user_admin
node_auth -->|"sends OTP"| node_otp_service
node_auth -->|"rate limits"| node_redis
node_auth -->|"reads and writes"| node_db_session
node_patients -->|"reads and writes"| node_db_session
node_appointments -->|"reads and writes"| node_db_session
node_encounters -->|"reads and writes"| node_db_session
node_triage -->|"evaluates records"| node_db_session
node_sync -->|"syncs changes"| node_db_session
node_media -->|"requests URLs"| node_storage_service
node_messages -->|"reads history"| node_db_session
node_teleconsult -->|"loads appointments"| node_db_session
node_user_admin -->|"reads and writes"| node_db_session
node_storage_service -->|"signs object access"| node_object_storage
node_db_session -->|"queries"| node_postgres
node_db_session -->|"maps entities"| node_data_models
node_realtime_server -->|"authenticates and persists chat"| node_db_session
node_realtime_server -->|"relays peer signals"| node_care_users
node_otp_service -.->|"delivers OTP"| node_care_users

click node_web_app "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/App.jsx"
click node_login "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/Login.jsx"
click node_care_pages "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/Dashboard.jsx"
click node_appointment_room "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/AppointmentRoom.jsx"
click node_records_page "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/PatientRecords.jsx"
click node_store_forward_page "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/StoreForwardQueue.jsx"
click node_frontend_api "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/api.js"
click node_api_app "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/main.py"
click node_api_router "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/router.py"
click node_auth "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/auth.py"
click node_patients "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/patients.py"
click node_appointments "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/appointments.py"
click node_encounters "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/encounters.py"
click node_triage "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/triage.py"
click node_sync "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/sync.py"
click node_media "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/media.py"
click node_messages "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/messages.py"
click node_teleconsult "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/teleconsult.py"
click node_user_admin "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/users.py"
click node_realtime_server "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/realtime/socketio_app.py"
click node_db_session "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/db/session.py"
click node_data_models "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/models/models.py"
click node_otp_service "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/services/otp_service.py"
click node_storage_service "https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/services/storage_service.py"

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_web_app,node_login,node_care_pages,node_appointment_room,node_records_page,node_store_forward_page,node_frontend_api toneBlue
class node_api_app,node_api_router,node_auth,node_patients,node_appointments,node_encounters,node_triage,node_sync,node_media,node_messages,node_teleconsult,node_user_admin toneAmber
class node_realtime_server toneMint
class node_db_session,node_data_models,node_postgres,node_redis,node_otp_service,node_object_storage,node_storage_service toneRose
class node_care_users toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Sign in](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/Login.jsx): `frontend/src/pages/Login.jsx`
- [Care workflows](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Appointment room](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/AppointmentRoom.jsx): `frontend/src/pages/AppointmentRoom.jsx`
- [Patient records](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/PatientRecords.jsx): `frontend/src/pages/PatientRecords.jsx`
- [Store-forward queue](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/pages/StoreForwardQueue.jsx): `frontend/src/pages/StoreForwardQueue.jsx`
- [HTTP client](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/frontend/src/api.js): `frontend/src/api.js`

### REST care API

- [FastAPI app](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/main.py): `backend/app/main.py`
- [API router](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/router.py): `backend/app/api/v1/router.py`
- [Authentication](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/auth.py): `backend/app/api/v1/endpoints/auth.py`
- [Patient registration](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/patients.py): `backend/app/api/v1/endpoints/patients.py`
- [Appointments](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/appointments.py): `backend/app/api/v1/endpoints/appointments.py`
- [Clinical records](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/encounters.py): `backend/app/api/v1/endpoints/encounters.py`
- [Rule-based triage](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/triage.py): `backend/app/api/v1/endpoints/triage.py`
- [Offline sync](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/sync.py): `backend/app/api/v1/endpoints/sync.py`
- [Media access](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/media.py): `backend/app/api/v1/endpoints/media.py`
- [Message history](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/messages.py): `backend/app/api/v1/endpoints/messages.py`
- [Consultation rooms](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/teleconsult.py): `backend/app/api/v1/endpoints/teleconsult.py`
- [User and audit](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/api/v1/endpoints/users.py): `backend/app/api/v1/endpoints/users.py`

### Live consultation

- [Socket.IO signaling](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/realtime/socketio_app.py): `backend/app/realtime/socketio_app.py`

### Persistence and services

- [Database sessions](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Care data models](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/models/models.py): `backend/app/models/models.py`
- **PostgreSQL**
- **Redis**
- [OTP delivery](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/services/otp_service.py): `backend/app/services/otp_service.py`
- **MinIO object storage**
- [Presigned URLs](https://github.com/chandanhastantram/low-cost-telehealth-solution-for-villages-gramcare-/blob/main/backend/app/services/storage_service.py): `backend/app/services/storage_service.py`

### Other components

- **Patients and care team**

## Connections

- Patients and care team → Web application: use
- Web application → Sign in: routes to
- Web application → Care workflows: routes to
- Web application → Appointment room: routes to
- Web application → Patient records: routes to
- Web application → Store-forward queue: routes to
- Sign in → HTTP client: requests auth
- Care workflows → HTTP client: requests care
- Patient records → HTTP client: requests records
- Store-forward queue → HTTP client: syncs changes
- Appointment room → HTTP client: loads room data
- Appointment room → Socket.IO signaling: signals and chats
- HTTP client → FastAPI app: HTTPS requests
- FastAPI app → API router: mounts routes
- API router → Authentication: dispatches
- API router → Patient registration: dispatches
- API router → Appointments: dispatches
- API router → Clinical records: dispatches
- API router → Rule-based triage: dispatches
- API router → Offline sync: dispatches
- API router → Media access: dispatches
- API router → Message history: dispatches
- API router → Consultation rooms: dispatches
- API router → User and audit: dispatches
- Authentication → OTP delivery: sends OTP
- Authentication → Redis: rate limits
- Authentication → Database sessions: reads and writes
- Patient registration → Database sessions: reads and writes
- Appointments → Database sessions: reads and writes
- Clinical records → Database sessions: reads and writes
- Rule-based triage → Database sessions: evaluates records
- Offline sync → Database sessions: syncs changes
- Media access → Presigned URLs: requests URLs
- Message history → Database sessions: reads history
- Consultation rooms → Database sessions: loads appointments
- User and audit → Database sessions: reads and writes
- Presigned URLs → MinIO object storage: signs object access
- Database sessions → PostgreSQL: queries
- Database sessions → Care data models: maps entities
- Socket.IO signaling → Database sessions: authenticates and persists chat
- Socket.IO signaling → Patients and care team: relays peer signals
- OTP delivery → Patients and care team: delivers OTP
