# ritheesh-chittimalla/mediqon architecture

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

- Interactive diagram: https://gitdiagram.com/ritheesh-chittimalla/mediqon
- Repository: https://github.com/ritheesh-chittimalla/mediqon

## Overview

Mediqon is a healthcare portal for patient and clinician workflows, with multi-disease risk assessments as a documented end-to-end path: patients submit assessment data, the NestJS API delegates predictions to a Python ML service, and prediction history is persisted. The portal also supports accounts, doctor discovery, appointment management, records, vitals, wellness, and assistant experiences. The README documents Gemini explanations and Vapi voice booking; their detailed wiring is not fully visible in the sampled source, so those links are shown only at the documented integration boundary.

Main entry points: [`Mediqon-frontend/src/lib/api.js`](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/lib/api.js) (API client), [`mediqon-backend/src/config/database.config.ts`](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/config/database.config.ts) (PostgreSQL), [`mediqon-backend/src/modules/ml/ml.service.ts`](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/ml/ml.service.ts) (Prediction orchestration), [`ml-service/app/main.py`](https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/main.py) (FastAPI prediction API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Patient portal"]
  node_frontend["React app and routes<br/>[App.jsx]"]
  node_assessments["Disease assessments"]
  node_portalhealth["Health portal<br/>[Dashboard.jsx]"]
  node_bookingui["Doctor booking<br/>[Bookings.jsx]"]
  node_assistantui["Assistant experiences<br/>[Assistant.jsx]"]
  node_authui["Login and registration<br/>[Login.jsx]"]
  node_api["API client<br/>[api.js]"]
end

subgraph group_backend["NestJS backend"]
  node_authcontroller["Auth endpoints<br/>[auth.controller.ts]"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
  node_doctorcontroller["Doctor discovery"]
  node_appointmentcontroller["Appointment endpoints"]
  node_appointmentservice["Appointment service"]
  node_vapi["Voice booking endpoints<br/>[vapi.controller.ts]"]
  node_mlcontroller["Prediction endpoints<br/>[ml.controller.ts]"]
  node_mlservice["Prediction orchestration<br/>[ml.service.ts]"]
  node_database[("PostgreSQL<br/>[database.config.ts]")]
end

subgraph group_ml["Prediction service"]
  node_fastapi["FastAPI prediction API<br/>[main.py]"]
  node_heart["Heart risk model<br/>[heart.py]"]
  node_diabetes["Diabetes risk model<br/>[diabetes.py]"]
  node_kidney["Kidney risk model<br/>[kidney.py]"]
end

subgraph group_integrations["External services"]
  node_gemini["Google Gemini"]
  node_vapi_service["Vapi voice service"]
end

node_patient(("Patient"))

node_patient -->|"uses"| node_frontend
node_frontend -->|"routes to"| node_authui
node_authui -->|"requests"| node_api
node_api -->|"calls"| node_authcontroller
node_authcontroller -->|"delegates"| node_authservice
node_authservice -->|"reads/writes users"| node_database
node_patient -->|"enters measures"| node_assessments
node_assessments -->|"submits inputs"| node_api
node_api -->|"calls"| node_mlcontroller
node_mlcontroller -->|"delegates"| node_mlservice
node_mlservice -->|"forwards prediction"| node_fastapi
node_fastapi -->|"runs heart model"| node_heart
node_fastapi -->|"runs diabetes model"| node_diabetes
node_fastapi -->|"runs kidney model"| node_kidney
node_mlservice -->|"persists history"| node_database
node_mlservice -.->|"requests explanation"| node_gemini
node_patient -->|"seeks appointment"| node_bookingui
node_bookingui -->|"requests"| node_api
node_api -->|"calls"| node_doctorcontroller
node_api -->|"calls"| node_appointmentcontroller
node_doctorcontroller -->|"reads doctors and slots"| node_database
node_appointmentcontroller -->|"delegates"| node_appointmentservice
node_appointmentservice -->|"reads/writes bookings"| node_database
node_patient -->|"uses"| node_assistantui
node_assistantui -->|"requests"| node_api
node_vapi_service -.->|"calls booking tools"| node_vapi
node_vapi -->|"books appointments"| node_appointmentservice
node_vapi -->|"queries records"| node_database
node_patient -->|"views health data"| node_portalhealth

click node_frontend "https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/App.jsx"
click node_assessments "https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/predictions/HeartAssessment.jsx"
click node_portalhealth "https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Dashboard.jsx"
click node_bookingui "https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Bookings.jsx"
click node_assistantui "https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Assistant.jsx"
click node_authui "https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Login.jsx"
click node_api "https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/lib/api.js"
click node_authcontroller "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/auth/auth.controller.ts"
click node_authservice "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/auth/auth.service.ts"
click node_doctorcontroller "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/doctor/doctor.controller.ts"
click node_appointmentcontroller "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/appointment/appointment.controller.ts"
click node_appointmentservice "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/appointment/appointment.service.ts"
click node_vapi "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/vapi/vapi.controller.ts"
click node_mlcontroller "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/ml/ml.controller.ts"
click node_mlservice "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/ml/ml.service.ts"
click node_database "https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/config/database.config.ts"
click node_fastapi "https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/main.py"
click node_heart "https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/services/heart.py"
click node_diabetes "https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/services/diabetes.py"
click node_kidney "https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/services/kidney.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_frontend,node_assessments,node_portalhealth,node_bookingui,node_assistantui,node_authui,node_api toneBlue
class node_authcontroller,node_authservice,node_doctorcontroller,node_appointmentcontroller,node_appointmentservice,node_vapi,node_mlcontroller,node_mlservice,node_database toneAmber
class node_fastapi,node_heart,node_diabetes,node_kidney toneMint
class node_gemini,node_vapi_service toneRose
class node_patient toneIndigo
```

## Components

### Patient portal

- [React app and routes](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/App.jsx): `Mediqon-frontend/src/App.jsx`
- [Disease assessments](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/predictions/HeartAssessment.jsx): `Mediqon-frontend/src/pages/predictions/HeartAssessment.jsx`
- [Health portal](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Dashboard.jsx): `Mediqon-frontend/src/pages/Dashboard.jsx`
- [Doctor booking](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Bookings.jsx): `Mediqon-frontend/src/pages/Bookings.jsx`
- [Assistant experiences](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Assistant.jsx): `Mediqon-frontend/src/pages/Assistant.jsx`
- [Login and registration](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/pages/Login.jsx): `Mediqon-frontend/src/pages/Login.jsx`
- [API client](https://github.com/ritheesh-chittimalla/mediqon/blob/main/Mediqon-frontend/src/lib/api.js): `Mediqon-frontend/src/lib/api.js`

### NestJS backend

- [Auth endpoints](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/auth/auth.controller.ts): `mediqon-backend/src/modules/auth/auth.controller.ts`
- [Auth service](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/auth/auth.service.ts): `mediqon-backend/src/modules/auth/auth.service.ts`
- [Doctor discovery](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/doctor/doctor.controller.ts): `mediqon-backend/src/modules/doctor/doctor.controller.ts`
- [Appointment endpoints](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/appointment/appointment.controller.ts): `mediqon-backend/src/modules/appointment/appointment.controller.ts`
- [Appointment service](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/appointment/appointment.service.ts): `mediqon-backend/src/modules/appointment/appointment.service.ts`
- [Voice booking endpoints](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/vapi/vapi.controller.ts): `mediqon-backend/src/modules/vapi/vapi.controller.ts`
- [Prediction endpoints](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/ml/ml.controller.ts): `mediqon-backend/src/modules/ml/ml.controller.ts`
- [Prediction orchestration](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/modules/ml/ml.service.ts): `mediqon-backend/src/modules/ml/ml.service.ts`
- [PostgreSQL](https://github.com/ritheesh-chittimalla/mediqon/blob/main/mediqon-backend/src/config/database.config.ts): `mediqon-backend/src/config/database.config.ts`

### Prediction service

- [FastAPI prediction API](https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/main.py): `ml-service/app/main.py`
- [Heart risk model](https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/services/heart.py): `ml-service/app/services/heart.py`
- [Diabetes risk model](https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/services/diabetes.py): `ml-service/app/services/diabetes.py`
- [Kidney risk model](https://github.com/ritheesh-chittimalla/mediqon/blob/main/ml-service/app/services/kidney.py): `ml-service/app/services/kidney.py`

### External services

- **Google Gemini**
- **Vapi voice service**

### Other components

- **Patient**

## Connections

- Patient → React app and routes: uses
- React app and routes → Login and registration: routes to
- Login and registration → API client: requests
- API client → Auth endpoints: calls
- Auth endpoints → Auth service: delegates
- Auth service → PostgreSQL: reads/writes users
- Patient → Disease assessments: enters measures
- Disease assessments → API client: submits inputs
- API client → Prediction endpoints: calls
- Prediction endpoints → Prediction orchestration: delegates
- Prediction orchestration → FastAPI prediction API: forwards prediction
- FastAPI prediction API → Heart risk model: runs heart model
- FastAPI prediction API → Diabetes risk model: runs diabetes model
- FastAPI prediction API → Kidney risk model: runs kidney model
- Prediction orchestration → PostgreSQL: persists history
- Prediction orchestration → Google Gemini: requests explanation
- Patient → Doctor booking: seeks appointment
- Doctor booking → API client: requests
- API client → Doctor discovery: calls
- API client → Appointment endpoints: calls
- Doctor discovery → PostgreSQL: reads doctors and slots
- Appointment endpoints → Appointment service: delegates
- Appointment service → PostgreSQL: reads/writes bookings
- Patient → Assistant experiences: uses
- Assistant experiences → API client: requests
- Vapi voice service → Voice booking endpoints: calls booking tools
- Voice booking endpoints → Appointment service: books appointments
- Voice booking endpoints → PostgreSQL: queries records
- Patient → Health portal: views health data
