# harshitrajj23/mediai architecture

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

- Interactive diagram: https://gitdiagram.com/harshitrajj23/mediai
- Repository: https://github.com/harshitrajj23/mediai

## Overview

MediAI combines a React clinical-care interface, FastAPI endpoints, and ML services. The main patient flow is sign-in, symptom or voice intake, server-side triage and guidance, with separate branches for wound scans, medication management, clinician matching, and SOS dispatch. The README documents additional persistence and integrations; sampled excerpts establish only some of their runtime connections, so uncertain links are omitted. Native Android/iOS shells host the frontend, but their runtime wiring is not shown.

Main entry points: [`backend/main.py`](https://github.com/harshitrajj23/mediai/blob/main/backend/main.py) (FastAPI service), [`frontend/src/App.jsx`](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/App.jsx) (React application), [`frontend/src/components/SymptomChat.jsx`](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/SymptomChat.jsx) (Symptom chat), [`frontend/src/components/VisionLab.jsx`](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/VisionLab.jsx) (Vision lab)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Patient interface"]
  node_app["React application<br/>[App.jsx]"]
  node_auth["Authentication<br/>[Auth.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
  node_dashboard["Care dashboard<br/>[Dashboard.jsx]"]
  node_chat["Symptom chat<br/>[SymptomChat.jsx]"]
  node_vision_ui["Vision lab<br/>[VisionLab.jsx]"]
  node_med_ui["Medication tracker<br/>[MedTracker.jsx]"]
  node_doctor_ui["Clinician matching<br/>[DocMatch.jsx]"]
end

subgraph group_api["Clinical API"]
  node_api["FastAPI service<br/>[main.py]"]
end

subgraph group_intelligence["Clinical intelligence"]
  node_agents["Symptom agents<br/>[agents.py]"]
  node_rag["Guideline retrieval<br/>[rag.py]"]
  node_vector_store[("Guideline vectors")]
  node_vision["Image analysis<br/>[vision.py]"]
  node_voice["Audio transcription<br/>[voice.py]"]
end

subgraph group_care["Care services"]
  node_supa_client["Supabase client<br/>[supabaseClient.js]"]
end

subgraph group_integrations["External services"]
  node_supabase[("Supabase platform")]
  node_hf["Hugging Face inference"]
  node_mistral["Mistral API"]
  node_geo["Geoapify"]
  node_telegram["Telegram alerts"]
end

node_patient(("Patient"))
node_device(("Mobile device"))

node_patient -->|"uses"| node_app
node_app -->|"shows"| node_landing
node_app -->|"renders"| node_auth
node_app -->|"renders"| node_dashboard
node_app -->|"routes to"| node_chat
node_app -->|"routes to"| node_vision_ui
node_app -->|"renders"| node_med_ui
node_app -->|"routes to"| node_doctor_ui
node_auth -->|"uses"| node_supa_client
node_supa_client -->|"connects"| node_supabase
node_chat -.->|"submits symptoms"| node_api
node_api -->|"extracts and triages"| node_agents
node_api -->|"retrieves guidance"| node_rag
node_rag -->|"queries"| node_vector_store
node_agents -->|"requests inference"| node_hf
node_rag -.->|"translates guidance"| node_mistral
node_chat -.->|"uploads audio"| node_api
node_api -->|"transcribes"| node_voice
node_vision_ui -.->|"submits scan"| node_api
node_api -.->|"analyzes image"| node_vision
node_vision -->|"classifies image"| node_hf
node_vision_ui -.->|"stores scans"| node_supabase
node_med_ui -.->|"syncs records"| node_supabase
node_doctor_ui -.->|"requests doctors"| node_api
node_api -->|"locates clinics"| node_geo
node_doctor_ui -.->|"books appointments"| node_supabase
node_dashboard -.->|"triggers SOS"| node_api
node_api -->|"finds hospitals"| node_geo
node_api -->|"dispatches alerts"| node_telegram
node_device -.->|"hosts mobile app"| node_app

click node_app "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/App.jsx"
click node_auth "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/Auth.jsx"
click node_landing "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/LandingPage.jsx"
click node_dashboard "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/Dashboard.jsx"
click node_chat "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/SymptomChat.jsx"
click node_vision_ui "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/VisionLab.jsx"
click node_med_ui "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/MedTracker.jsx"
click node_doctor_ui "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/DocMatch.jsx"
click node_api "https://github.com/harshitrajj23/mediai/blob/main/backend/main.py"
click node_agents "https://github.com/harshitrajj23/mediai/blob/main/ml/agents.py"
click node_rag "https://github.com/harshitrajj23/mediai/blob/main/ml/rag.py"
click node_vector_store "https://github.com/harshitrajj23/mediai/tree/main/ml/chroma_db"
click node_vision "https://github.com/harshitrajj23/mediai/blob/main/ml/vision.py"
click node_voice "https://github.com/harshitrajj23/mediai/blob/main/ml/voice.py"
click node_supa_client "https://github.com/harshitrajj23/mediai/blob/main/frontend/src/supabaseClient.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_auth,node_landing,node_dashboard,node_chat,node_vision_ui,node_med_ui,node_doctor_ui toneBlue
class node_api toneAmber
class node_agents,node_rag,node_vector_store,node_vision,node_voice toneMint
class node_supa_client toneRose
class node_supabase,node_hf,node_mistral,node_geo,node_telegram,node_patient,node_device toneIndigo
```

## Components

### Patient interface

- [React application](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/Auth.jsx): `frontend/src/components/Auth.jsx`
- [Landing page](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/LandingPage.jsx): `frontend/src/components/LandingPage.jsx`
- [Care dashboard](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/Dashboard.jsx): `frontend/src/components/Dashboard.jsx`
- [Symptom chat](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/SymptomChat.jsx): `frontend/src/components/SymptomChat.jsx`
- [Vision lab](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/VisionLab.jsx): `frontend/src/components/VisionLab.jsx`
- [Medication tracker](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/MedTracker.jsx): `frontend/src/components/MedTracker.jsx`
- [Clinician matching](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/components/DocMatch.jsx): `frontend/src/components/DocMatch.jsx`

### Clinical API

- [FastAPI service](https://github.com/harshitrajj23/mediai/blob/main/backend/main.py): `backend/main.py`

### Clinical intelligence

- [Symptom agents](https://github.com/harshitrajj23/mediai/blob/main/ml/agents.py): `ml/agents.py`
- [Guideline retrieval](https://github.com/harshitrajj23/mediai/blob/main/ml/rag.py): `ml/rag.py`
- [Guideline vectors](https://github.com/harshitrajj23/mediai/tree/main/ml/chroma_db): `ml/chroma_db`
- [Image analysis](https://github.com/harshitrajj23/mediai/blob/main/ml/vision.py): `ml/vision.py`
- [Audio transcription](https://github.com/harshitrajj23/mediai/blob/main/ml/voice.py): `ml/voice.py`

### Care services

- [Supabase client](https://github.com/harshitrajj23/mediai/blob/main/frontend/src/supabaseClient.js): `frontend/src/supabaseClient.js`

### External services

- **Supabase platform**
- **Hugging Face inference**
- **Mistral API**
- **Geoapify**
- **Telegram alerts**

### Other components

- **Patient**
- **Mobile device**

## Connections

- Patient → React application: uses (evidence: `README.md`)
- React application → Landing page: shows (evidence: `frontend/src/App.jsx`)
- React application → Authentication: renders (evidence: `frontend/src/App.jsx`)
- React application → Care dashboard: renders (evidence: `frontend/src/App.jsx`)
- React application → Symptom chat: routes to (evidence: `frontend/src/App.jsx`)
- React application → Vision lab: routes to (evidence: `frontend/src/App.jsx`)
- React application → Medication tracker: renders (evidence: `frontend/src/App.jsx`)
- React application → Clinician matching: routes to (evidence: `frontend/src/App.jsx`)
- Authentication → Supabase client: uses (evidence: `frontend/src/components/Auth.jsx`)
- Supabase client → Supabase platform: connects (evidence: `frontend/src/supabaseClient.js`)
- Symptom chat → FastAPI service: submits symptoms
- FastAPI service → Symptom agents: extracts and triages (evidence: `backend/main.py`)
- FastAPI service → Guideline retrieval: retrieves guidance (evidence: `backend/main.py`)
- Guideline retrieval → Guideline vectors: queries (evidence: `ml/rag.py`)
- Symptom agents → Hugging Face inference: requests inference (evidence: `ml/agents.py`)
- Guideline retrieval → Mistral API: translates guidance
- Symptom chat → FastAPI service: uploads audio
- FastAPI service → Audio transcription: transcribes (evidence: `backend/main.py`)
- Vision lab → FastAPI service: submits scan
- FastAPI service → Image analysis: analyzes image (evidence: `backend/main.py`)
- Image analysis → Hugging Face inference: classifies image (evidence: `ml/vision.py`)
- Vision lab → Supabase platform: stores scans (evidence: `README.md`)
- Medication tracker → Supabase platform: syncs records (evidence: `README.md`)
- Clinician matching → FastAPI service: requests doctors
- FastAPI service → Geoapify: locates clinics (evidence: `backend/main.py`)
- Clinician matching → Supabase platform: books appointments (evidence: `README.md`)
- Care dashboard → FastAPI service: triggers SOS
- FastAPI service → Geoapify: finds hospitals (evidence: `backend/main.py`)
- FastAPI service → Telegram alerts: dispatches alerts (evidence: `backend/main.py`)
- Mobile device → React application: hosts mobile app (evidence: `README.md`)
