# jayr1612/ai-internship-project-chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/jayr1612/ai-internship-project-chatbot
- Repository: https://github.com/jayr1612/ai-internship-project-chatbot

## Overview

MedBot is a Streamlit medical-information chatbot. Users enter health questions, which the app screens for emergency keywords; non-emergency questions are sent with profile and conversation context to OpenRouter, and replies are shown and retained for chat-history export. The repository also contains standalone medical utilities for symptom and risk assessment, wellness calculations, medication information, reminders, and summaries. The README provides no architectural detail, and the sampled app excerpt does not show these utilities being invoked, so they are represented separately.

Main entry points: [`app.py`](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py) (Chat UI and flow), [`medical_utils.py`](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/medical_utils.py) (Health assessments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Chat application"]
  node_streamlit["Chat UI and flow<br/>[app.py]"]
  node_triage["Emergency screening<br/>[app.py]"]
  node_profile["Profile context<br/>[app.py]"]
  node_history["Chat history export<br/>[app.py]"]
  node_bot["Chatbot prompts<br/>[app.py]"]
end

subgraph group_medical["Medical utilities"]
  node_healthutils["Health assessments<br/>[medical_utils.py]"]
  node_drugdb[("Drug information<br/>[medical_utils.py]")]
  node_healthoutputs["Health outputs<br/>[medical_utils.py]"]
end

subgraph group_integration["AI integration"]
  node_client["OpenRouter client<br/>[app.py]"]
  node_openrouter{{"OpenRouter API"}}
  node_config["Models and guidance<br/>[config.py]"]
end

node_user(("User"))

node_user -->|"asks question"| node_streamlit
node_streamlit -->|"screens message"| node_triage
node_triage -->|"returns emergency reply"| node_streamlit
node_streamlit -->|"adds profile context"| node_profile
node_streamlit -->|"builds prompt"| node_bot
node_streamlit -->|"requests response"| node_client
node_client -->|"sends messages"| node_openrouter
node_openrouter -->|"returns completion"| node_client
node_streamlit -->|"records and exports"| node_history
node_streamlit -->|"shows reply"| node_user
node_healthutils -->|"generates assessments"| node_healthoutputs

click node_streamlit "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py"
click node_triage "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py"
click node_profile "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py"
click node_history "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py"
click node_bot "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py"
click node_client "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py"
click node_config "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/config.py"
click node_healthutils "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/medical_utils.py"
click node_drugdb "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/medical_utils.py"
click node_healthoutputs "https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/medical_utils.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_streamlit,node_triage,node_profile,node_history,node_bot,node_user toneBlue
class node_healthutils,node_drugdb,node_healthoutputs toneAmber
class node_client,node_openrouter,node_config toneMint
```

## Components

### Chat application

- [Chat UI and flow](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py): `app.py`
- [Emergency screening](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py): `app.py`
- [Profile context](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py): `app.py`
- [Chat history export](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py): `app.py`
- [Chatbot prompts](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py): `app.py`

### Medical utilities

- [Health assessments](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/medical_utils.py): `medical_utils.py`
- [Drug information](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/medical_utils.py): `medical_utils.py`
- [Health outputs](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/medical_utils.py): `medical_utils.py`

### AI integration

- [OpenRouter client](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/app.py): `app.py`
- **OpenRouter API**
- [Models and guidance](https://github.com/jayr1612/ai-internship-project-chatbot/blob/main/config.py): `config.py`

### Other components

- **User**

## Connections

- User → Chat UI and flow: asks question
- Chat UI and flow → Emergency screening: screens message
- Emergency screening → Chat UI and flow: returns emergency reply
- Chat UI and flow → Profile context: adds profile context
- Chat UI and flow → Chatbot prompts: builds prompt
- Chat UI and flow → OpenRouter client: requests response
- OpenRouter client → OpenRouter API: sends messages
- OpenRouter API → OpenRouter client: returns completion
- Chat UI and flow → Chat history export: records and exports
- Chat UI and flow → User: shows reply
- Health assessments → Health outputs: generates assessments
