# harshini202005/healthcare_assistant architecture

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

- Interactive diagram: https://gitdiagram.com/harshini202005/healthcare_assistant
- Repository: https://github.com/harshini202005/healthcare_assistant

## Overview

This is a patient-facing healthcare assistant with a doctor dashboard. Patients sign in, chat in natural language, and receive health guidance, diet plans, or appointment actions; booking and cancellation require confirmation in the agent. Doctors use dashboard APIs to manage appointments and view patient-related information. The graph reflects documented capabilities and sampled call paths; dashboard internals and some frontend/API wiring are not fully shown, so those links are left unverified.

Main entry points: [`backend/main.py`](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/main.py) (FastAPI application), [`backend/mcp.py`](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/mcp.py) (Tool registry), [`backend/database.py`](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/database.py) (Persistence layer), [`backend/auth.py`](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/auth.py) (Session authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_patient_ui["Patient portal<br/>[index.html]"]
  node_doctor_ui["Doctor dashboard"]
end

subgraph group_orchestration["API and orchestration"]
  node_api["FastAPI application<br/>[main.py]"]
  node_agent["Chat agent<br/>[agent.py]"]
  node_mcp["Tool registry<br/>[mcp.py]"]
  node_auth["Session authentication<br/>[auth.py]"]
end

subgraph group_health["Health services"]
  node_booking["Appointment booking<br/>[booking.py]"]
  node_doctors["Doctor availability<br/>[doctors.py]"]
  node_diet["Diet planning<br/>[diet.py]"]
  node_health_qa["Health Q&amp;A<br/>[general.py]"]
end

subgraph group_data["Identity and data"]
  node_db_layer["Persistence layer<br/>[database.py]"]
end

node_patient(("Patient"))
node_doctor(("Doctor"))
node_supabase[("Supabase")]
node_mistral{{"Mistral AI"}}

node_patient -->|"uses"| node_patient_ui
node_doctor -->|"uses"| node_doctor_ui
node_patient_ui -.->|"API requests"| node_api
node_doctor_ui -.->|"API requests"| node_api
node_api -->|"routes chat"| node_agent
node_agent -->|"dispatches tools"| node_mcp
node_api -->|"calls tools"| node_mcp
node_api -->|"authenticates"| node_auth
node_api -->|"reads and writes"| node_db_layer
node_mcp -->|"dispatches"| node_booking
node_mcp -->|"dispatches"| node_doctors
node_mcp -->|"dispatches"| node_diet
node_mcp -->|"dispatches"| node_health_qa
node_booking -->|"stores appointments"| node_db_layer
node_doctors -->|"queries availability"| node_db_layer
node_auth -->|"looks up doctor"| node_db_layer
node_db_layer -->|"reads and writes"| node_supabase
node_auth -->|"verifies sessions"| node_supabase
node_diet -->|"generates plans"| node_mistral
node_health_qa -->|"answers questions"| node_mistral

click node_patient_ui "https://github.com/harshini202005/healthcare_assistant/blob/main/frontend/index.html"
click node_doctor_ui "https://github.com/harshini202005/healthcare_assistant/blob/main/frontend/doctor-dashboard.html"
click node_api "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/main.py"
click node_agent "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/agent.py"
click node_mcp "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/mcp.py"
click node_auth "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/auth.py"
click node_booking "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/booking.py"
click node_doctors "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/doctors.py"
click node_diet "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/diet.py"
click node_health_qa "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/general.py"
click node_db_layer "https://github.com/harshini202005/healthcare_assistant/blob/main/backend/database.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_patient_ui,node_doctor_ui toneBlue
class node_api,node_agent,node_mcp,node_auth,node_supabase toneAmber
class node_booking,node_doctors,node_diet,node_health_qa toneMint
class node_db_layer toneRose
class node_patient,node_doctor,node_mistral toneIndigo
```

## Components

### User experience

- [Patient portal](https://github.com/harshini202005/healthcare_assistant/blob/main/frontend/index.html): `frontend/index.html`
- [Doctor dashboard](https://github.com/harshini202005/healthcare_assistant/blob/main/frontend/doctor-dashboard.html): `frontend/doctor-dashboard.html`

### API and orchestration

- [FastAPI application](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/main.py): `backend/main.py`
- [Chat agent](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/agent.py): `backend/agent.py`
- [Tool registry](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/mcp.py): `backend/mcp.py`
- [Session authentication](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/auth.py): `backend/auth.py`

### Health services

- [Appointment booking](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/booking.py): `backend/tools/booking.py`
- [Doctor availability](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/doctors.py): `backend/tools/doctors.py`
- [Diet planning](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/diet.py): `backend/tools/diet.py`
- [Health Q&A](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/tools/general.py): `backend/tools/general.py`

### Identity and data

- [Persistence layer](https://github.com/harshini202005/healthcare_assistant/blob/main/backend/database.py): `backend/database.py`

### Other components

- **Patient**
- **Doctor**
- **Supabase**
- **Mistral AI**

## Connections

- Patient → Patient portal: uses (evidence: `README.md`)
- Doctor → Doctor dashboard: uses (evidence: `README.md`)
- Patient portal → FastAPI application: API requests
- Doctor dashboard → FastAPI application: API requests
- FastAPI application → Chat agent: routes chat (evidence: `backend/main.py`)
- Chat agent → Tool registry: dispatches tools (evidence: `backend/agent.py`)
- FastAPI application → Tool registry: calls tools (evidence: `backend/main.py`)
- FastAPI application → Session authentication: authenticates (evidence: `backend/main.py`)
- FastAPI application → Persistence layer: reads and writes (evidence: `backend/main.py`)
- Tool registry → Appointment booking: dispatches (evidence: `backend/mcp.py`)
- Tool registry → Doctor availability: dispatches (evidence: `backend/mcp.py`)
- Tool registry → Diet planning: dispatches (evidence: `backend/mcp.py`)
- Tool registry → Health Q&A: dispatches (evidence: `backend/mcp.py`)
- Appointment booking → Persistence layer: stores appointments (evidence: `backend/tools/booking.py`)
- Doctor availability → Persistence layer: queries availability (evidence: `backend/tools/doctors.py`)
- Session authentication → Persistence layer: looks up doctor (evidence: `backend/auth.py`)
- Persistence layer → Supabase: reads and writes (evidence: `backend/database.py`)
- Session authentication → Supabase: verifies sessions (evidence: `backend/auth.py`)
- Diet planning → Mistral AI: generates plans (evidence: `backend/tools/diet.py`)
- Health Q&A → Mistral AI: answers questions (evidence: `backend/tools/general.py`)
