# arunkarthick052004/telemedicine_demo architecture

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

- Interactive diagram: https://gitdiagram.com/arunkarthick052004/telemedicine_demo
- Repository: https://github.com/arunkarthick052004/telemedicine_demo

## Overview

This is a full-stack health assistant: patients register or log in, enter vitals and symptoms for an AI analysis, then review history or request a doctor consultation. Doctors can manage patient consultations, and ESP32 sensor readings can be streamed to the app. The main runtime is concentrated in server.js and the two client scripts. README capabilities such as PDF reports and profile/history are included; unsampled implementations are represented only at their supported paths, and edges reflect the excerpts or documented features.

Main entry points: [`database_setup.sql`](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/database_setup.sql) (MySQL database), [`public/script.js`](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js) (Vitals and symptoms), [`server.js`](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js) (Consultation coordination), [`public/doctor`](https://github.com/arunkarthick052004/telemedicine_demo/tree/master/public/doctor) (Doctor dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_patient["Patient experience"]
  node_login["Login and QR<br/>[login.js]"]
  node_health["Vitals and symptoms<br/>[script.js]"]
  node_history["History and profile<br/>[script.js]"]
  node_reports["PDF reports<br/>[script.js]"]
  node_consult["Consultation UI<br/>[script.js]"]
end

subgraph group_clinical["Clinical services"]
  node_doctor["Doctor dashboard"]
  node_consultation["Consultation coordination<br/>[server.js]"]
  node_doctor_records["Doctor records<br/>[server.js]"]
  node_doctor_auth["Doctor registration and profile<br/>[server.js]"]
end

subgraph group_platform["Backend services"]
  node_analysis["AI analysis<br/>[server.js]"]
  node_auth["Patient authentication<br/>[server.js]"]
  node_patient_data["Patient data and history<br/>[server.js]"]
  node_db[("MySQL database<br/>[database_setup.sql]")]
  node_sensor_api["Sensor vitals endpoint<br/>[server.js]"]
end

subgraph group_device["Vitals device"]
  node_firmware["ESP32 sensor firmware<br/>[max30102_esp32.ino]"]
end

node_patient(("Patient"))
node_gemini{{"Gemini API"}}
node_email{{"Email service"}}

node_patient -->|"uses"| node_login
node_login -->|"authenticates"| node_auth
node_auth -->|"reads and writes"| node_db
node_patient -->|"enters vitals"| node_health
node_health -->|"submits analysis"| node_analysis
node_analysis -->|"stores results"| node_db
node_analysis -->|"requests diagnosis"| node_gemini
node_health -->|"views records"| node_history
node_history -->|"fetches history"| node_patient_data
node_patient_data -->|"queries records"| node_db
node_history -->|"generates PDF"| node_reports
node_patient -->|"requests doctor"| node_consult
node_consult -->|"requests consultation"| node_consultation
node_doctor -.->|"handles requests"| node_consultation
node_consultation -->|"updates requests"| node_db
node_consultation -->|"notifies admin"| node_email
node_doctor -.->|"views patients"| node_doctor_records
node_doctor_records -->|"queries records"| node_db
node_doctor -.->|"manages profile"| node_doctor_auth
node_doctor_auth -->|"stores doctor data"| node_db
node_firmware -.->|"posts vitals"| node_sensor_api
node_sensor_api -->|"broadcasts updates"| node_health

click node_login "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/login.js"
click node_health "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js"
click node_history "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js"
click node_reports "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js"
click node_consult "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js"
click node_doctor "https://github.com/arunkarthick052004/telemedicine_demo/tree/master/public/doctor"
click node_consultation "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js"
click node_doctor_records "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js"
click node_analysis "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js"
click node_auth "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js"
click node_patient_data "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js"
click node_db "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/database_setup.sql"
click node_firmware "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/firmware/max30102_esp32/max30102_esp32.ino"
click node_sensor_api "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js"
click node_doctor_auth "https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.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_login,node_health,node_history,node_reports,node_consult toneBlue
class node_doctor,node_consultation,node_doctor_records,node_doctor_auth toneAmber
class node_analysis,node_auth,node_patient_data,node_db,node_sensor_api,node_gemini toneMint
class node_firmware toneRose
class node_patient,node_email toneIndigo
```

## Components

### Patient experience

- [Login and QR](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/login.js): `public/login.js`
- [Vitals and symptoms](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js): `public/script.js`
- [History and profile](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js): `public/script.js`
- [PDF reports](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js): `public/script.js`
- [Consultation UI](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/public/script.js): `public/script.js`

### Clinical services

- [Doctor dashboard](https://github.com/arunkarthick052004/telemedicine_demo/tree/master/public/doctor): `public/doctor`
- [Consultation coordination](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js): `server.js`
- [Doctor records](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js): `server.js`
- [Doctor registration and profile](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js): `server.js`

### Backend services

- [AI analysis](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js): `server.js`
- [Patient authentication](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js): `server.js`
- [Patient data and history](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js): `server.js`
- [MySQL database](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/database_setup.sql): `database_setup.sql`
- [Sensor vitals endpoint](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/server.js): `server.js`

### Vitals device

- [ESP32 sensor firmware](https://github.com/arunkarthick052004/telemedicine_demo/blob/master/firmware/max30102_esp32/max30102_esp32.ino): `firmware/max30102_esp32/max30102_esp32.ino`

### Other components

- **Patient**
- **Gemini API**
- **Email service**

## Connections

- Patient → Login and QR: uses (evidence: `public/login.js`)
- Login and QR → Patient authentication: authenticates (evidence: `public/login.js`)
- Patient authentication → MySQL database: reads and writes (evidence: `server.js`)
- Patient → Vitals and symptoms: enters vitals (evidence: `public/script.js`)
- Vitals and symptoms → AI analysis: submits analysis (evidence: `server.js`)
- AI analysis → MySQL database: stores results (evidence: `server.js`)
- AI analysis → Gemini API: requests diagnosis (evidence: `server.js`)
- Vitals and symptoms → History and profile: views records (evidence: `public/script.js`)
- History and profile → Patient data and history: fetches history (evidence: `server.js`)
- Patient data and history → MySQL database: queries records (evidence: `server.js`)
- History and profile → PDF reports: generates PDF (evidence: `public/script.js`)
- Patient → Consultation UI: requests doctor (evidence: `public/script.js`)
- Consultation UI → Consultation coordination: requests consultation (evidence: `server.js`)
- Doctor dashboard → Consultation coordination: handles requests
- Consultation coordination → MySQL database: updates requests (evidence: `server.js`)
- Consultation coordination → Email service: notifies admin (evidence: `server.js`)
- Doctor dashboard → Doctor records: views patients
- Doctor records → MySQL database: queries records (evidence: `server.js`)
- Doctor dashboard → Doctor registration and profile: manages profile
- Doctor registration and profile → MySQL database: stores doctor data (evidence: `server.js`)
- ESP32 sensor firmware → Sensor vitals endpoint: posts vitals
- Sensor vitals endpoint → Vitals and symptoms: broadcasts updates (evidence: `server.js`)
