# rohithkumar0219/heal-x architecture

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

- Interactive diagram: https://gitdiagram.com/rohithkumar0219/heal-x
- Repository: https://github.com/rohithkumar0219/heal-x

## Overview

Heal_X is an educational multimodal healthcare assistant: users submit text, images, voice, or combinations through a browser UI; FastAPI routes process them into structured health explanations, possible conditions, and precautions, with optional spoken responses. The backend separates request/response schemas, modality-specific AI services, and upload handling. The README documents these capabilities, while sampled code verifies several route and service interactions. The LLM and file-handler implementations were not sampled, so their internal behavior and some connections remain unspecified.

Main entry points: [`backend/routes/health_routes.py`](https://github.com/rohithkumar0219/heal-x/blob/main/backend/routes/health_routes.py) (Health API routes), [`frontend/script.js`](https://github.com/rohithkumar0219/heal-x/blob/main/frontend/script.js) (Assistant interface), [`backend/main.py`](https://github.com/rohithkumar0219/heal-x/blob/main/backend/main.py) (FastAPI app), [`backend/services/tts_service.py`](https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/tts_service.py) (Speech synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_web_ui["Assistant interface<br/>[script.js]"]
  node_local_history[("Local history<br/>[script.js]")]
end

subgraph group_api["API and contracts"]
  node_app["FastAPI app<br/>[main.py]"]
  node_routes["Health API routes<br/>[health_routes.py]"]
  node_schemas["Health contracts<br/>[schemas.py]"]
end

subgraph group_services["AI services"]
  node_llm["Text response service<br/>[llm_service.py]"]
  node_vision["Image analysis<br/>[vision_service.py]"]
  node_speech["Speech transcription<br/>[speech_service.py]"]
  node_tts["Speech synthesis<br/>[tts_service.py]"]
end

subgraph group_support["Files and state"]
  node_file_handler["Upload handling<br/>[file_handler.py]"]
  node_logger["Application logging<br/>[logger.py]"]
  node_audio_files[("Generated audio")]
end

node_user(("Healthcare user"))
node_ai_provider{{"AI model provider"}}
node_gtts{{"gTTS service"}}

node_user -->|"uses"| node_web_ui
node_web_ui -->|"submits queries"| node_routes
node_web_ui -->|"stores history"| node_local_history
node_app -->|"mounts router"| node_routes
node_app -->|"serves static UI"| node_web_ui
node_routes -->|"validates responses"| node_schemas
node_routes -->|"requests answers"| node_llm
node_routes -->|"analyzes images"| node_vision
node_routes -->|"transcribes audio"| node_speech
node_routes -->|"generates audio"| node_tts
node_routes -->|"validates uploads"| node_file_handler
node_app -->|"logs events"| node_logger
node_routes -->|"logs requests"| node_logger
node_vision -->|"sends image analysis"| node_ai_provider
node_speech -->|"uploads audio"| node_ai_provider
node_llm -.->|"requests text answers"| node_ai_provider
node_tts -->|"converts text"| node_gtts
node_tts -->|"writes audio"| node_audio_files
node_routes -->|"serves audio"| node_audio_files
node_routes -->|"returns results"| node_web_ui

click node_web_ui "https://github.com/rohithkumar0219/heal-x/blob/main/frontend/script.js"
click node_local_history "https://github.com/rohithkumar0219/heal-x/blob/main/frontend/script.js"
click node_app "https://github.com/rohithkumar0219/heal-x/blob/main/backend/main.py"
click node_routes "https://github.com/rohithkumar0219/heal-x/blob/main/backend/routes/health_routes.py"
click node_schemas "https://github.com/rohithkumar0219/heal-x/blob/main/backend/models/schemas.py"
click node_llm "https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/llm_service.py"
click node_vision "https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/vision_service.py"
click node_speech "https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/speech_service.py"
click node_tts "https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/tts_service.py"
click node_file_handler "https://github.com/rohithkumar0219/heal-x/blob/main/backend/utils/file_handler.py"
click node_logger "https://github.com/rohithkumar0219/heal-x/blob/main/backend/utils/logger.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_web_ui,node_local_history,node_user toneBlue
class node_app,node_routes,node_schemas toneAmber
class node_llm,node_vision,node_speech,node_tts toneMint
class node_file_handler,node_logger,node_audio_files toneRose
class node_ai_provider,node_gtts toneIndigo
```

## Components

### Browser experience

- [Assistant interface](https://github.com/rohithkumar0219/heal-x/blob/main/frontend/script.js): `frontend/script.js`
- [Local history](https://github.com/rohithkumar0219/heal-x/blob/main/frontend/script.js): `frontend/script.js`

### API and contracts

- [FastAPI app](https://github.com/rohithkumar0219/heal-x/blob/main/backend/main.py): `backend/main.py`
- [Health API routes](https://github.com/rohithkumar0219/heal-x/blob/main/backend/routes/health_routes.py): `backend/routes/health_routes.py`
- [Health contracts](https://github.com/rohithkumar0219/heal-x/blob/main/backend/models/schemas.py): `backend/models/schemas.py`

### AI services

- [Text response service](https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/llm_service.py): `backend/services/llm_service.py`
- [Image analysis](https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/vision_service.py): `backend/services/vision_service.py`
- [Speech transcription](https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/speech_service.py): `backend/services/speech_service.py`
- [Speech synthesis](https://github.com/rohithkumar0219/heal-x/blob/main/backend/services/tts_service.py): `backend/services/tts_service.py`

### Files and state

- [Upload handling](https://github.com/rohithkumar0219/heal-x/blob/main/backend/utils/file_handler.py): `backend/utils/file_handler.py`
- [Application logging](https://github.com/rohithkumar0219/heal-x/blob/main/backend/utils/logger.py): `backend/utils/logger.py`
- **Generated audio**

### Other components

- **Healthcare user**
- **AI model provider**
- **gTTS service**

## Connections

- Healthcare user → Assistant interface: uses (evidence: `README.md`)
- Assistant interface → Health API routes: submits queries (evidence: `frontend/script.js`)
- Assistant interface → Local history: stores history (evidence: `frontend/script.js`)
- FastAPI app → Health API routes: mounts router (evidence: `backend/main.py`)
- FastAPI app → Assistant interface: serves static UI (evidence: `backend/main.py`)
- Health API routes → Health contracts: validates responses (evidence: `backend/routes/health_routes.py`)
- Health API routes → Text response service: requests answers (evidence: `backend/routes/health_routes.py`)
- Health API routes → Image analysis: analyzes images (evidence: `backend/routes/health_routes.py`)
- Health API routes → Speech transcription: transcribes audio (evidence: `backend/routes/health_routes.py`)
- Health API routes → Speech synthesis: generates audio (evidence: `backend/routes/health_routes.py`)
- Health API routes → Upload handling: validates uploads (evidence: `backend/routes/health_routes.py`)
- FastAPI app → Application logging: logs events (evidence: `backend/main.py`)
- Health API routes → Application logging: logs requests (evidence: `backend/routes/health_routes.py`)
- Image analysis → AI model provider: sends image analysis (evidence: `backend/services/vision_service.py`)
- Speech transcription → AI model provider: uploads audio (evidence: `backend/services/speech_service.py`)
- Text response service → AI model provider: requests text answers
- Speech synthesis → gTTS service: converts text (evidence: `backend/services/tts_service.py`)
- Speech synthesis → Generated audio: writes audio (evidence: `backend/services/tts_service.py`)
- Health API routes → Generated audio: serves audio (evidence: `backend/routes/health_routes.py`)
- Health API routes → Assistant interface: returns results (evidence: `frontend/script.js`)
