# auzzton/med-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/auzzton/med-chatbot
- Repository: https://github.com/auzzton/med-chatbot

## Overview

CareAI is a Streamlit medical chatbot with text question answering, severity cues, medical-image interpretation, and session-based history. The visible text workflow builds retrieval QA over a FAISS index and a local Llama model; image prompts are sent to Gemini. The README also documents a hospital locator, but its stated location.py is absent from the supplied tree, so its implementation and wiring cannot be represented. Source excerpts are partial, and the available tree does not establish how dataset.txt feeds the loaded index.

Main entry points: [`final_model.py`](https://github.com/auzzton/med-chatbot/blob/main/final_model.py) (Streamlit app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["CareAI interface"]
  node_app["Streamlit app<br/>[final_model.py]"]
  node_history[("Session history<br/>[final_model.py]")]
end

subgraph group_text["Text answers"]
  node_text_input["Medical question<br/>[final_model.py]"]
  node_answer_flow["Answer workflow<br/>[final_model.py]"]
  node_retrieval_chain["Retrieval QA<br/>[final_model.py]"]
  node_embeddings["Text embeddings<br/>[final_model.py]"]
  node_faiss[("FAISS index<br/>[final_model.py]")]
  node_llm["Local Llama<br/>[final_model.py]"]
  node_severity["Severity cues<br/>[final_model.py]"]
end

subgraph group_image["Image analysis"]
  node_image_input["Medical image<br/>[final_model.py]"]
  node_image_prompts["Image prompts<br/>[final_model.py]"]
  node_vision_workflow["Vision workflow<br/>[final_model.py]"]
  node_gemini["Gemini vision<br/>[final_model.py]"]
  node_image_results["Image descriptions<br/>[final_model.py]"]
end

node_patient(("Patient"))

node_patient -->|"uses"| node_app
node_app -->|"collects"| node_text_input
node_app -->|"invokes"| node_answer_flow
node_answer_flow -->|"queries"| node_retrieval_chain
node_retrieval_chain -->|"retrieves"| node_faiss
node_retrieval_chain -->|"generates"| node_llm
node_answer_flow -->|"assigns"| node_severity
node_app -->|"accepts"| node_image_input
node_app -->|"collects"| node_image_prompts
node_app -->|"invokes"| node_vision_workflow
node_vision_workflow -->|"submits"| node_gemini
node_vision_workflow -->|"produces"| node_image_results
node_app -->|"stores"| node_history
node_embeddings -->|"loads index"| node_faiss

click node_app "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_history "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_text_input "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_answer_flow "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_retrieval_chain "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_embeddings "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_faiss "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_llm "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_severity "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_image_input "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_image_prompts "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_vision_workflow "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_gemini "https://github.com/auzzton/med-chatbot/blob/main/final_model.py"
click node_image_results "https://github.com/auzzton/med-chatbot/blob/main/final_model.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_app,node_history toneBlue
class node_text_input,node_answer_flow,node_retrieval_chain,node_embeddings,node_faiss,node_llm,node_severity toneAmber
class node_image_input,node_image_prompts,node_vision_workflow,node_gemini,node_image_results toneMint
class node_patient toneIndigo
```

## Components

### CareAI interface

- [Streamlit app](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Session history](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`

### Text answers

- [Medical question](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Answer workflow](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Retrieval QA](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Text embeddings](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [FAISS index](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Local Llama](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Severity cues](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`

### Image analysis

- [Medical image](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Image prompts](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Vision workflow](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Gemini vision](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`
- [Image descriptions](https://github.com/auzzton/med-chatbot/blob/main/final_model.py): `final_model.py`

### Other components

- **Patient**

## Connections

- Patient → Streamlit app: uses
- Streamlit app → Medical question: collects
- Streamlit app → Answer workflow: invokes
- Answer workflow → Retrieval QA: queries
- Retrieval QA → FAISS index: retrieves
- Retrieval QA → Local Llama: generates
- Answer workflow → Severity cues: assigns
- Streamlit app → Medical image: accepts
- Streamlit app → Image prompts: collects
- Streamlit app → Vision workflow: invokes
- Vision workflow → Gemini vision: submits
- Vision workflow → Image descriptions: produces
- Streamlit app → Session history: stores
- Text embeddings → FAISS index: loads index
