# jamal-khan-i/medikiosk architecture

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

- Interactive diagram: https://gitdiagram.com/jamal-khan-i/medikiosk
- Repository: https://github.com/jamal-khan-i/medikiosk

## Overview

MediKiosk is a multilingual hospital outpatient intake and clinical handoff platform. Patients register at a kiosk, answer adaptive questions, and submit prior records; the system synthesizes and prioritizes clinical information for physician review, while staff manage the queue and operations. The graph includes the documented kiosk, physician, admin, and triage surfaces plus backend intake, document, identity, and persistence layers. Several backend routes and service integrations were not sampled in full, so their relationships are shown only where README or indexed source references support them.

Main entry points: [`backend/server.js`](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/server.js) (HTTP and realtime API), [`frontend/src/services/api.js`](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/services/api.js) (API client), [`frontend/src/App.jsx`](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/App.jsx) (Surface router), [`backend/services/documentService.js`](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/documentService.js) (Document OCR)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Patient and staff UI"]
  node_app["Surface router<br/>[App.jsx]"]
  node_kiosk["Patient kiosk<br/>[PatientKiosk.jsx]"]
  node_physician["Physician workstation"]
  node_admin["Hospital admin<br/>[HospitalAdmin.jsx]"]
  node_alerts["Triage alert surface"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_backend["Intake backend"]
  node_server["HTTP and realtime API<br/>[server.js]"]
end

subgraph group_clinical["Clinical processing"]
  node_intake["Adaptive intake<br/>[intakeService.js]"]
  node_triage["Red-flag triage<br/>[triageService.js]"]
  node_documents["Document OCR<br/>[documentService.js]"]
  node_llm["Clinical reasoning<br/>[llmService.js]"]
  node_bhashini["Bhashini language services<br/>[bhashiniService.js]"]
end

subgraph group_platform["Identity and records"]
  node_abdm["ABDM identity<br/>[abdmService.js]"]
  node_auth["Staff authentication<br/>[authService.js]"]
  node_fhir["FHIR record builder<br/>[fhirService.js]"]
  node_audit["Audit trail<br/>[auditService.js]"]
  node_store[("Relational file store<br/>[store.js]")]
end

node_patient(("Patient"))
node_staff(("Hospital staff"))
node_gemini["Google Gemini"]
node_bhashini_ext["Bhashini platform"]

node_patient -->|"checks in"| node_kiosk
node_kiosk -->|"requests intake"| node_api
node_api -->|"calls API"| node_server
node_server -->|"generates questions"| node_intake
node_server -->|"processes documents"| node_documents
node_documents -->|"uses OCR"| node_bhashini
node_documents -->|"uses extraction"| node_llm
node_server -->|"generates summary"| node_llm
node_llm -.->|"requests reasoning"| node_gemini
node_bhashini -.->|"requests language services"| node_bhashini_ext
node_server -.->|"routes triage"| node_triage
node_server -->|"handles identity"| node_abdm
node_server -.->|"uses staff auth"| node_auth
node_server -.->|"supports records"| node_fhir
node_server -.->|"records audit"| node_audit
node_server -->|"reads and writes"| node_store
node_auth -->|"checks staff"| node_store
node_audit -->|"persists events"| node_store
node_staff -->|"reviews cases"| node_physician
node_staff -->|"manages operations"| node_admin
node_staff -->|"responds to alerts"| node_alerts
node_physician -->|"requests records"| node_api
node_admin -->|"manages staff"| node_api
node_alerts -->|"receives updates"| node_api
node_app -->|"routes to"| node_kiosk
node_app -->|"routes to"| node_physician
node_app -->|"routes to"| node_admin
node_app -->|"routes to"| node_alerts

click node_app "https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/App.jsx"
click node_kiosk "https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/kiosk/PatientKiosk.jsx"
click node_physician "https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/physician/PhysicianDashboard.jsx"
click node_admin "https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/admin/HospitalAdmin.jsx"
click node_alerts "https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/triage/TriageAlertSurface.jsx"
click node_api "https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/server.js"
click node_intake "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/intakeService.js"
click node_triage "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/triageService.js"
click node_documents "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/documentService.js"
click node_llm "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/llmService.js"
click node_bhashini "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/bhashiniService.js"
click node_abdm "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/abdmService.js"
click node_auth "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/authService.js"
click node_fhir "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/fhirService.js"
click node_audit "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/auditService.js"
click node_store "https://github.com/jamal-khan-i/medikiosk/blob/main/backend/db/store.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_app,node_kiosk,node_physician,node_admin,node_alerts,node_api toneBlue
class node_server toneAmber
class node_intake,node_triage,node_documents,node_llm,node_bhashini toneMint
class node_abdm,node_auth,node_fhir,node_audit,node_store toneRose
class node_patient,node_staff,node_gemini,node_bhashini_ext toneIndigo
```

## Components

### Patient and staff UI

- [Surface router](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Patient kiosk](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/kiosk/PatientKiosk.jsx): `frontend/src/surfaces/kiosk/PatientKiosk.jsx`
- [Physician workstation](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/physician/PhysicianDashboard.jsx): `frontend/src/surfaces/physician/PhysicianDashboard.jsx`
- [Hospital admin](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/admin/HospitalAdmin.jsx): `frontend/src/surfaces/admin/HospitalAdmin.jsx`
- [Triage alert surface](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/surfaces/triage/TriageAlertSurface.jsx): `frontend/src/surfaces/triage/TriageAlertSurface.jsx`
- [API client](https://github.com/jamal-khan-i/medikiosk/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### Intake backend

- [HTTP and realtime API](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/server.js): `backend/server.js`

### Clinical processing

- [Adaptive intake](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/intakeService.js): `backend/services/intakeService.js`
- [Red-flag triage](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/triageService.js): `backend/services/triageService.js`
- [Document OCR](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/documentService.js): `backend/services/documentService.js`
- [Clinical reasoning](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/llmService.js): `backend/services/llmService.js`
- [Bhashini language services](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/bhashiniService.js): `backend/services/bhashiniService.js`

### Identity and records

- [ABDM identity](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/abdmService.js): `backend/services/abdmService.js`
- [Staff authentication](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/authService.js): `backend/services/authService.js`
- [FHIR record builder](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/fhirService.js): `backend/services/fhirService.js`
- [Audit trail](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/services/auditService.js): `backend/services/auditService.js`
- [Relational file store](https://github.com/jamal-khan-i/medikiosk/blob/main/backend/db/store.js): `backend/db/store.js`

### Other components

- **Patient**
- **Hospital staff**
- **Google Gemini**
- **Bhashini platform**

## Connections

- Patient → Patient kiosk: checks in
- Patient kiosk → API client: requests intake (evidence: `frontend/src/surfaces/kiosk/PatientKiosk.jsx`)
- API client → HTTP and realtime API: calls API (evidence: `frontend/src/services/api.js`)
- HTTP and realtime API → Adaptive intake: generates questions (evidence: `backend/server.js`)
- HTTP and realtime API → Document OCR: processes documents (evidence: `backend/server.js`)
- Document OCR → Bhashini language services: uses OCR (evidence: `backend/services/documentService.js`)
- Document OCR → Clinical reasoning: uses extraction (evidence: `backend/services/documentService.js`)
- HTTP and realtime API → Clinical reasoning: generates summary (evidence: `backend/server.js`)
- Clinical reasoning → Google Gemini: requests reasoning
- Bhashini language services → Bhashini platform: requests language services
- HTTP and realtime API → Red-flag triage: routes triage (evidence: `backend/server.js`)
- HTTP and realtime API → ABDM identity: handles identity (evidence: `backend/server.js`)
- HTTP and realtime API → Staff authentication: uses staff auth (evidence: `backend/server.js`)
- HTTP and realtime API → FHIR record builder: supports records (evidence: `backend/server.js`)
- HTTP and realtime API → Audit trail: records audit (evidence: `backend/server.js`)
- HTTP and realtime API → Relational file store: reads and writes (evidence: `backend/server.js`)
- Staff authentication → Relational file store: checks staff (evidence: `backend/services/authService.js`)
- Audit trail → Relational file store: persists events (evidence: `backend/services/auditService.js`)
- Hospital staff → Physician workstation: reviews cases
- Hospital staff → Hospital admin: manages operations
- Hospital staff → Triage alert surface: responds to alerts
- Physician workstation → API client: requests records (evidence: `frontend/src/surfaces/physician/PhysicianDashboard.jsx`)
- Hospital admin → API client: manages staff (evidence: `frontend/src/surfaces/admin/HospitalAdmin.jsx`)
- Triage alert surface → API client: receives updates (evidence: `frontend/src/surfaces/triage/TriageAlertSurface.jsx`)
- Surface router → Patient kiosk: routes to (evidence: `frontend/src/App.jsx`)
- Surface router → Physician workstation: routes to (evidence: `frontend/src/App.jsx`)
- Surface router → Hospital admin: routes to (evidence: `frontend/src/App.jsx`)
- Surface router → Triage alert surface: routes to (evidence: `frontend/src/App.jsx`)
