# manepallisruthi123-hub/healthsathiai architecture

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

- Interactive diagram: https://gitdiagram.com/manepallisruthi123-hub/healthsathiai
- Repository: https://github.com/manepallisruthi123-hub/healthsathiai

## Overview

HealthSathi AI is a bilingual health-question assistant. Users submit text or voice through the web interface; Flask handles queries, optionally translates Telugu, resolves a disease intent, retrieves a medical answer, and returns text plus synthesized audio. The README also documents browser speech recognition, while the backend has a separate optional audio-transcription route. The source excerpt shows SQLite Q&A lookup and chat logging. The local model directory is present, but the sampled backend uses the Hugging Face Inference API; unsampled UI behavior is represented only where the README documents it.

Main entry points: [`HealthSathi_Flask.py`](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py) (Query processing), [`HealthSathi_WebUI.html`](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_WebUI.html) (Web interface), [`healthsathi.db`](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/healthsathi.db) (Medical Q&A database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_webui["Web interface"]
  node_browser_stt["Browser speech input"]
end

subgraph group_workflow["Flask workflow"]
  node_flask_routes["Flask endpoints"]
  node_voice_transcription["Audio transcription"]
  node_query_processing["Query processing"]
  node_disease_matching["Disease matching"]
end

subgraph group_knowledge["Knowledge and history"]
  node_qa_database[("Medical Q&amp;A database<br/>[healthsathi.db]")]
  node_chat_logs[("Chat history<br/>[healthsathi.db]")]
end

subgraph group_integrations["Language and audio"]
  node_intent_api["Intent classification API"]
  node_telugu_translation["Telugu translation"]
  node_speech_synthesis["Speech synthesis"]
end

node_user(("User"))
node_gtts["gTTS service"]
node_speech_recognition_service["Google speech recognition"]

node_user -->|"asks question"| node_webui
node_webui -->|"captures speech"| node_browser_stt
node_webui -->|"submits query"| node_flask_routes
node_browser_stt -->|"transcribes speech"| node_webui
node_flask_routes -->|"handles audio"| node_voice_transcription
node_voice_transcription -->|"transcribes audio"| node_speech_recognition_service
node_voice_transcription -->|"sends transcript"| node_query_processing
node_flask_routes -->|"processes text"| node_query_processing
node_query_processing -->|"translates Telugu"| node_telugu_translation
node_query_processing -->|"resolves disease"| node_disease_matching
node_disease_matching -->|"classifies fallback"| node_intent_api
node_query_processing -->|"retrieves answer"| node_qa_database
node_query_processing -->|"generates audio"| node_speech_synthesis
node_speech_synthesis -->|"synthesizes speech"| node_gtts
node_flask_routes -->|"records exchange"| node_chat_logs
node_flask_routes -->|"serves interface"| node_webui

click node_webui "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_WebUI.html"
click node_flask_routes "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py"
click node_voice_transcription "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py"
click node_query_processing "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py"
click node_disease_matching "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py"
click node_telugu_translation "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py"
click node_qa_database "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/healthsathi.db"
click node_chat_logs "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/healthsathi.db"
click node_speech_synthesis "https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.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_webui,node_browser_stt,node_user toneBlue
class node_flask_routes,node_voice_transcription,node_query_processing,node_disease_matching toneAmber
class node_qa_database,node_chat_logs toneMint
class node_intent_api,node_telugu_translation,node_speech_synthesis toneRose
class node_gtts,node_speech_recognition_service toneIndigo
```

## Components

### User interface

- [Web interface](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_WebUI.html): `HealthSathi_WebUI.html`
- **Browser speech input**

### Flask workflow

- [Flask endpoints](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py): `HealthSathi_Flask.py`
- [Audio transcription](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py): `HealthSathi_Flask.py`
- [Query processing](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py): `HealthSathi_Flask.py`
- [Disease matching](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py): `HealthSathi_Flask.py`

### Knowledge and history

- [Medical Q&A database](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/healthsathi.db): `healthsathi.db`
- [Chat history](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/healthsathi.db): `healthsathi.db`

### Language and audio

- **Intent classification API**
- [Telugu translation](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py): `HealthSathi_Flask.py`
- [Speech synthesis](https://github.com/manepallisruthi123-hub/healthsathiai/blob/main/HealthSathi_Flask.py): `HealthSathi_Flask.py`

### Other components

- **User**
- **gTTS service**
- **Google speech recognition**

## Connections

- User → Web interface: asks question (evidence: `README.md`)
- Web interface → Browser speech input: captures speech (evidence: `README.md`)
- Web interface → Flask endpoints: submits query (evidence: `README.md`)
- Browser speech input → Web interface: transcribes speech (evidence: `README.md`)
- Flask endpoints → Audio transcription: handles audio (evidence: `HealthSathi_Flask.py`)
- Audio transcription → Google speech recognition: transcribes audio (evidence: `HealthSathi_Flask.py`)
- Audio transcription → Query processing: sends transcript (evidence: `HealthSathi_Flask.py`)
- Flask endpoints → Query processing: processes text (evidence: `HealthSathi_Flask.py`)
- Query processing → Telugu translation: translates Telugu (evidence: `HealthSathi_Flask.py`)
- Query processing → Disease matching: resolves disease (evidence: `HealthSathi_Flask.py`)
- Disease matching → Intent classification API: classifies fallback (evidence: `HealthSathi_Flask.py`)
- Query processing → Medical Q&A database: retrieves answer (evidence: `HealthSathi_Flask.py`)
- Query processing → Speech synthesis: generates audio (evidence: `HealthSathi_Flask.py`)
- Speech synthesis → gTTS service: synthesizes speech (evidence: `HealthSathi_Flask.py`)
- Flask endpoints → Chat history: records exchange (evidence: `HealthSathi_Flask.py`)
- Flask endpoints → Web interface: serves interface (evidence: `HealthSathi_Flask.py`)
