# prakharcodes-dev/healthcare-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/prakharcodes-dev/healthcare-chatbot
- Repository: https://github.com/prakharcodes-dev/healthcare-chatbot

## Overview

MedVitals AI is a Flask healthcare assistant whose main workflow takes reported symptoms, identifies possible conditions, and returns structured, safety-conscious guidance; users can also log vitals and review trends. The product also includes a searchable condition library, medication reminders, and localized safety guidance. The graph combines sampled implementation evidence with README-documented capabilities; routes and much of the frontend were not sampled, so some documented connections are shown without source-level detail.

Main entry points: [`backend/routes.py`](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/routes.py) (Flask API routes), [`frontend/static/js/main.js`](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/frontend/static/js/main.js) (Chat and workspace), [`backend/services/symptom_assessment.py`](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/services/symptom_assessment.py) (Symptom assessment), [`backend/__init__.py`](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/__init__.py) (Application setup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_web_ui["Chat and workspace<br/>[main.js]"]
  node_medical_library[("Medical knowledge library<br/>[diseases.json]")]
  node_language_safety["Language and safety guide<br/>[languages-extra.js]"]
  node_reminder_ui["Medication reminders<br/>[main.js]"]
end

subgraph group_assessment["Symptom assessment"]
  node_symptom_parse["Symptom report parsing<br/>[symptom_report.py]"]
  node_symptom_cleanup["Symptom normalization<br/>[utils.py]"]
  node_matching["Condition matching<br/>[matcher.py]"]
  node_assessment_service["Symptom assessment"]
  node_chat_response["Structured response<br/>[chat_response.py]"]
end

subgraph group_health["Health tracking"]
  node_health_detection["Measurement and safety checks<br/>[utils.py]"]
  node_health_status["Vital status rules<br/>[health_metrics.py]"]
  node_health_trends["Vital logs and trends"]
  node_notifications["Reminder scheduling<br/>[notifications.py]"]
end

subgraph group_platform["Application and data"]
  node_api["Flask API routes<br/>[routes.py]"]
  node_app_factory["Application setup<br/>[__init__.py]"]
  node_configuration["Application configuration<br/>[config.py]"]
  node_extensions["Database and scheduler<br/>[extensions.py]"]
  node_models["Domain records<br/>[models.py]"]
  node_chat_storage["Chat and search storage<br/>[chat_repository.py]"]
  node_health_storage["Health log storage"]
  node_notification_storage["Notification storage"]
  node_history["Chat history<br/>[history.py]"]
  node_service_registry["Service registry<br/>[registry.py]"]
end

node_user(("User"))

node_user -->|"reports symptoms"| node_web_ui
node_web_ui -->|"submits requests"| node_api
node_api -.->|"parses reports"| node_symptom_parse
node_symptom_parse -->|"normalizes phrases"| node_symptom_cleanup
node_assessment_service -->|"uses parser"| node_symptom_parse
node_assessment_service -.->|"requests matches"| node_matching
node_api -.->|"dispatches assessment"| node_assessment_service
node_matching -.->|"matches profiles"| node_medical_library
node_assessment_service -.->|"builds response"| node_chat_response
node_chat_response -->|"uses vital status"| node_health_status
node_chat_response -->|"returns guidance"| node_web_ui
node_web_ui -->|"searches profiles"| node_medical_library
node_user -->|"records vitals"| node_health_trends
node_api -.->|"checks symptoms"| node_health_detection
node_api -.->|"evaluates readings"| node_health_status
node_api -.->|"stores and reads logs"| node_health_trends
node_health_trends -->|"persists health logs"| node_models
node_user -->|"schedules reminders"| node_reminder_ui
node_reminder_ui -->|"manages reminders"| node_api
node_api -.->|"dispatches reminder work"| node_notifications
node_notifications -.->|"stores reminder state"| node_notification_storage
node_notifications -->|"schedules jobs"| node_extensions
node_app_factory -->|"loads settings"| node_configuration
node_app_factory -->|"registers routes"| node_api
node_app_factory -->|"initializes extensions"| node_extensions
node_chat_storage -->|"persists chat records"| node_models
node_notification_storage -->|"persists reminders"| node_models
node_history -->|"reads chat records"| node_chat_storage
node_language_safety -.->|"localizes interface"| node_web_ui

click node_web_ui "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/frontend/static/js/main.js"
click node_medical_library "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/data/diseases.json"
click node_language_safety "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/frontend/static/js/languages-extra.js"
click node_reminder_ui "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/frontend/static/js/main.js"
click node_api "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/routes.py"
click node_app_factory "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/__init__.py"
click node_configuration "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/config.py"
click node_extensions "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/extensions.py"
click node_models "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/models.py"
click node_chat_storage "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/chat_repository.py"
click node_health_storage "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/health_repository.py"
click node_notification_storage "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/notification_repository.py"
click node_history "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/history.py"
click node_symptom_parse "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/core/symptom_report.py"
click node_symptom_cleanup "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/utils.py"
click node_matching "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/matcher.py"
click node_assessment_service "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/services/symptom_assessment.py"
click node_chat_response "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/services/chat_response.py"
click node_health_detection "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/utils.py"
click node_health_status "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/core/health_metrics.py"
click node_health_trends "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/health_repository.py"
click node_notifications "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/notifications.py"
click node_service_registry "https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/services/registry.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_medical_library,node_language_safety,node_reminder_ui,node_user toneBlue
class node_symptom_parse,node_symptom_cleanup,node_matching,node_assessment_service,node_chat_response toneAmber
class node_health_detection,node_health_status,node_health_trends,node_notifications toneMint
class node_api,node_app_factory,node_configuration,node_extensions,node_models,node_chat_storage,node_health_storage,node_notification_storage,node_history,node_service_registry toneRose
```

## Components

### User experience

- [Chat and workspace](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/frontend/static/js/main.js): `frontend/static/js/main.js`
- [Medical knowledge library](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/data/diseases.json): `data/diseases.json`
- [Language and safety guide](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/frontend/static/js/languages-extra.js): `frontend/static/js/languages-extra.js`
- [Medication reminders](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/frontend/static/js/main.js): `frontend/static/js/main.js`

### Symptom assessment

- [Symptom report parsing](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/core/symptom_report.py): `backend/core/symptom_report.py`
- [Symptom normalization](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/utils.py): `backend/utils.py`
- [Condition matching](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/matcher.py): `backend/matcher.py`
- [Symptom assessment](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/services/symptom_assessment.py): `backend/services/symptom_assessment.py`
- [Structured response](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/services/chat_response.py): `backend/services/chat_response.py`

### Health tracking

- [Measurement and safety checks](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/utils.py): `backend/utils.py`
- [Vital status rules](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/core/health_metrics.py): `backend/core/health_metrics.py`
- [Vital logs and trends](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/health_repository.py): `backend/repositories/health_repository.py`
- [Reminder scheduling](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/notifications.py): `backend/notifications.py`

### Application and data

- [Flask API routes](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/routes.py): `backend/routes.py`
- [Application setup](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/__init__.py): `backend/__init__.py`
- [Application configuration](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/config.py): `backend/config.py`
- [Database and scheduler](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/extensions.py): `backend/extensions.py`
- [Domain records](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/models.py): `backend/models.py`
- [Chat and search storage](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/chat_repository.py): `backend/repositories/chat_repository.py`
- [Health log storage](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/health_repository.py): `backend/repositories/health_repository.py`
- [Notification storage](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/repositories/notification_repository.py): `backend/repositories/notification_repository.py`
- [Chat history](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/history.py): `backend/history.py`
- [Service registry](https://github.com/prakharcodes-dev/healthcare-chatbot/blob/main/backend/services/registry.py): `backend/services/registry.py`

### Other components

- **User**

## Connections

- User → Chat and workspace: reports symptoms (evidence: `README.md`)
- Chat and workspace → Flask API routes: submits requests (evidence: `README.md`)
- Flask API routes → Symptom report parsing: parses reports
- Symptom report parsing → Symptom normalization: normalizes phrases (evidence: `backend/core/symptom_report.py`)
- Symptom assessment → Symptom report parsing: uses parser (evidence: `backend/services/symptom_assessment.py`)
- Symptom assessment → Condition matching: requests matches
- Flask API routes → Symptom assessment: dispatches assessment
- Condition matching → Medical knowledge library: matches profiles
- Symptom assessment → Structured response: builds response
- Structured response → Vital status rules: uses vital status (evidence: `backend/services/chat_response.py`)
- Structured response → Chat and workspace: returns guidance (evidence: `README.md`)
- Chat and workspace → Medical knowledge library: searches profiles (evidence: `README.md`)
- User → Vital logs and trends: records vitals (evidence: `README.md`)
- Flask API routes → Measurement and safety checks: checks symptoms
- Flask API routes → Vital status rules: evaluates readings
- Flask API routes → Vital logs and trends: stores and reads logs
- Vital logs and trends → Domain records: persists health logs (evidence: `backend/repositories/health_repository.py`)
- User → Medication reminders: schedules reminders (evidence: `README.md`)
- Medication reminders → Flask API routes: manages reminders (evidence: `README.md`)
- Flask API routes → Reminder scheduling: dispatches reminder work
- Reminder scheduling → Notification storage: stores reminder state
- Reminder scheduling → Database and scheduler: schedules jobs (evidence: `backend/notifications.py`)
- Application setup → Application configuration: loads settings (evidence: `backend/__init__.py`)
- Application setup → Flask API routes: registers routes (evidence: `backend/__init__.py`)
- Application setup → Database and scheduler: initializes extensions (evidence: `backend/__init__.py`)
- Chat and search storage → Domain records: persists chat records (evidence: `backend/repositories/chat_repository.py`)
- Notification storage → Domain records: persists reminders (evidence: `backend/repositories/notification_repository.py`)
- Chat history → Chat and search storage: reads chat records (evidence: `backend/history.py`)
- Language and safety guide → Chat and workspace: localizes interface
