# neerajyadav604/clinicall architecture

> Architecture diagram of the GitHub repository neerajyadav604/clinicall, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/neerajyadav604/clinicall
- Repository: https://github.com/neerajyadav604/clinicall

## Overview

Clinicall is a multi-role healthcare consultation platform. Patients discover doctors, request and pay for appointments, access consent-controlled FHIR records, and consult by chat or video; doctors manage appointments and clinical notes, while hospital and system administrators manage their respective operations. The frontend routes into an Express API backed by MongoDB, with real-time Socket.IO features and an ML service for symptom, matching, summary, and drug-checking capabilities. The README documents the broad platform relationships; source excerpts additionally show consultation, socket, sync, and ML internals, but not every frontend-to-API call.

Main entry points: [`frontend/src/App.js`](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/App.js) (Web Application), [`frontend/src/routes/DoctorRoutes.jsx`](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/routes/DoctorRoutes.jsx) (Doctor Portal), [`frontend/src/routes/AdminRoutes.jsx`](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/routes/AdminRoutes.jsx) (Admin Portal), [`frontend/src/services/fhirApi.js`](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/services/fhirApi.js) (Records Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_care["Patient Care"]
  node_web_app["Web Application<br/>[App.js]"]
  node_doctor_routes["Doctor Portal<br/>[DoctorRoutes.jsx]"]
  node_auth["Authentication<br/>[authSession.js]"]
  node_appointment_api["Appointments"]
  node_payment_api["Payments<br/>[Payment.js]"]
end

subgraph group_clinical["Clinical Records"]
  node_fhir_frontend["Records Interface<br/>[fhirApi.js]"]
  node_fhir_api["FHIR Resources<br/>[fhir.js]"]
  node_consent["Consent Controls<br/>[ConsentManager.jsx]"]
  node_sync["FHIR Synchronization<br/>[fhirSyncEngine.js]"]
  node_database[("MongoDB<br/>[Database.js]")]
end

subgraph group_live["Live Consultation"]
  node_consultation["Consultation Sessions"]
  node_chat_frontend["Chat and Calls<br/>[Chat.jsx]"]
  node_socket_server["Real-time Socket.IO<br/>[index.js]"]
end

subgraph group_operations["Platform Operations"]
  node_admin_routes["Admin Portal<br/>[AdminRoutes.jsx]"]
  node_hospital_api["Hospital Management"]
  node_admin_api["Admin Management<br/>[AdminController.js]"]
  node_analytics["Admin Analytics"]
end

subgraph group_intelligence["AI Services"]
  node_ml_api["ML Endpoints<br/>[main.py]"]
  node_ai_api["AI Controller<br/>[AIController.js]"]
end

node_patient(("Patient"))
node_doctor(("Doctor"))
node_hospital_admin(("Hospital Admin"))
node_system_admin(("System Admin"))

node_patient -->|"uses"| node_web_app
node_doctor -->|"uses"| node_doctor_routes
node_system_admin -->|"uses"| node_admin_routes
node_hospital_admin -->|"manages hospitals"| node_hospital_api
node_web_app -->|"authenticates"| node_auth
node_web_app -->|"REST requests"| node_appointment_api
node_web_app -->|"pays online"| node_payment_api
node_doctor_routes -->|"manages appointments"| node_appointment_api
node_admin_routes -->|"reviews registrations"| node_admin_api
node_admin_routes -->|"views analytics"| node_analytics
node_web_app -->|"views records"| node_fhir_frontend
node_fhir_frontend -->|"requests records"| node_fhir_api
node_consent -->|"controls access"| node_fhir_frontend
node_fhir_api -->|"reads and writes"| node_database
node_sync -->|"reads and writes"| node_database
node_sync -.->|"syncs with external EHR"| node_patient
node_doctor_routes -->|"starts sessions"| node_consultation
node_chat_frontend -->|"uses session APIs"| node_consultation
node_consultation -->|"emits session events"| node_socket_server
node_chat_frontend -->|"exchanges events"| node_socket_server
node_web_app -.->|"requests predictions"| node_ml_api
node_ai_api -.->|"calls inference"| node_ml_api
node_ai_api -->|"reads clinical data"| node_database

click node_web_app "https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/App.js"
click node_doctor_routes "https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/routes/DoctorRoutes.jsx"
click node_admin_routes "https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/routes/AdminRoutes.jsx"
click node_auth "https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/services/authSession.js"
click node_appointment_api "https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/ManageAppoinment.js"
click node_payment_api "https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/Payment.js"
click node_hospital_api "https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/HospitalController.js"
click node_admin_api "https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/AdminController.js"
click node_analytics "https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/AdminAnalyticsController.js"
click node_fhir_frontend "https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/services/fhirApi.js"
click node_fhir_api "https://github.com/neerajyadav604/clinicall/blob/main/server/routes/fhir.js"
click node_consent "https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/components/consent/ConsentManager.jsx"
click node_sync "https://github.com/neerajyadav604/clinicall/blob/main/server/utils/fhirSyncEngine.js"
click node_database "https://github.com/neerajyadav604/clinicall/blob/main/server/config/Database.js"
click node_consultation "https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/consultationController.js"
click node_chat_frontend "https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/pages/Chat.jsx"
click node_socket_server "https://github.com/neerajyadav604/clinicall/blob/main/server/index.js"
click node_ml_api "https://github.com/neerajyadav604/clinicall/blob/main/ml-service/main.py"
click node_ai_api "https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/AIController.js"

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_doctor_routes,node_auth,node_appointment_api,node_payment_api toneBlue
class node_fhir_frontend,node_fhir_api,node_consent,node_sync,node_database toneAmber
class node_consultation,node_chat_frontend,node_socket_server toneMint
class node_admin_routes,node_hospital_api,node_admin_api,node_analytics toneRose
class node_ml_api,node_ai_api,node_patient,node_doctor,node_hospital_admin,node_system_admin toneIndigo
```

## Components

### Patient Care

- [Web Application](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/App.js): `frontend/src/App.js`
- [Doctor Portal](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/routes/DoctorRoutes.jsx): `frontend/src/routes/DoctorRoutes.jsx`
- [Authentication](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/services/authSession.js): `frontend/src/services/authSession.js`
- [Appointments](https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/ManageAppoinment.js): `server/Controllers/ManageAppoinment.js`
- [Payments](https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/Payment.js): `server/Controllers/Payment.js`

### Clinical Records

- [Records Interface](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/services/fhirApi.js): `frontend/src/services/fhirApi.js`
- [FHIR Resources](https://github.com/neerajyadav604/clinicall/blob/main/server/routes/fhir.js): `server/routes/fhir.js`
- [Consent Controls](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/components/consent/ConsentManager.jsx): `frontend/src/components/consent/ConsentManager.jsx`
- [FHIR Synchronization](https://github.com/neerajyadav604/clinicall/blob/main/server/utils/fhirSyncEngine.js): `server/utils/fhirSyncEngine.js`
- [MongoDB](https://github.com/neerajyadav604/clinicall/blob/main/server/config/Database.js): `server/config/Database.js`

### Live Consultation

- [Consultation Sessions](https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/consultationController.js): `server/Controllers/consultationController.js`
- [Chat and Calls](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/pages/Chat.jsx): `frontend/src/pages/Chat.jsx`
- [Real-time Socket.IO](https://github.com/neerajyadav604/clinicall/blob/main/server/index.js): `server/index.js`

### Platform Operations

- [Admin Portal](https://github.com/neerajyadav604/clinicall/blob/main/frontend/src/routes/AdminRoutes.jsx): `frontend/src/routes/AdminRoutes.jsx`
- [Hospital Management](https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/HospitalController.js): `server/Controllers/HospitalController.js`
- [Admin Management](https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/AdminController.js): `server/Controllers/AdminController.js`
- [Admin Analytics](https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/AdminAnalyticsController.js): `server/Controllers/AdminAnalyticsController.js`

### AI Services

- [ML Endpoints](https://github.com/neerajyadav604/clinicall/blob/main/ml-service/main.py): `ml-service/main.py`
- [AI Controller](https://github.com/neerajyadav604/clinicall/blob/main/server/Controllers/AIController.js): `server/Controllers/AIController.js`

### Other components

- **Patient**
- **Doctor**
- **Hospital Admin**
- **System Admin**

## Connections

- Patient → Web Application: uses
- Doctor → Doctor Portal: uses (evidence: `frontend/src/routes/DoctorRoutes.jsx`)
- System Admin → Admin Portal: uses (evidence: `frontend/src/routes/AdminRoutes.jsx`)
- Hospital Admin → Hospital Management: manages hospitals
- Web Application → Authentication: authenticates (evidence: `frontend/src/services/authSession.js`)
- Web Application → Appointments: REST requests
- Web Application → Payments: pays online
- Doctor Portal → Appointments: manages appointments
- Admin Portal → Admin Management: reviews registrations
- Admin Portal → Admin Analytics: views analytics
- Web Application → Records Interface: views records
- Records Interface → FHIR Resources: requests records
- Consent Controls → Records Interface: controls access (evidence: `frontend/src/components/consent/ConsentManager.jsx`)
- FHIR Resources → MongoDB: reads and writes
- FHIR Synchronization → MongoDB: reads and writes (evidence: `server/utils/fhirSyncEngine.js`)
- FHIR Synchronization → Patient: syncs with external EHR
- Doctor Portal → Consultation Sessions: starts sessions
- Chat and Calls → Consultation Sessions: uses session APIs (evidence: `frontend/src/pages/Chat.jsx`)
- Consultation Sessions → Real-time Socket.IO: emits session events (evidence: `server/Controllers/consultationController.js`)
- Chat and Calls → Real-time Socket.IO: exchanges events (evidence: `frontend/src/pages/Chat.jsx`)
- Web Application → ML Endpoints: requests predictions
- AI Controller → ML Endpoints: calls inference
- AI Controller → MongoDB: reads clinical data (evidence: `server/Controllers/AIController.js`)
