# pravin2909/clinical-decision-support-system architecture

> Architecture diagram of the GitHub repository pravin2909/clinical-decision-support-system, 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/pravin2909/clinical-decision-support-system
- Repository: https://github.com/pravin2909/clinical-decision-support-system

## Overview

This is a clinical decision-support application: users submit symptoms, images, or audio through a web interface and receive a generated report; clinicians can also ask research-oriented questions. The backend orchestrates image routing and classification or text/audio processing, then returns reports, with optional account and consultation-history features. The graph reflects the documented endpoints and sampled calls; several UI, research, and model details are represented at subsystem level because their implementations were not excerpted.

Main entry points: [`backend/main.py`](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/main.py) (FastAPI endpoints), [`backend/app/pipeline.py`](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/pipeline.py) (Analysis pipeline), [`backend/app/db.py`](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/db.py) (Database sessions), [`frontend/src/pages/DashboardLayout.tsx`](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/DashboardLayout.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app_routes["App routing<br/>[App.tsx]"]
  node_landing["Landing page<br/>[LandingPage.tsx]"]
  node_dashboard["Dashboard"]
  node_chat["Diagnosis and chat<br/>[ChatPage.tsx]"]
  node_overview["Overview<br/>[OverviewPage.tsx]"]
  node_settings["Settings<br/>[SettingsPage.tsx]"]
  node_web_api["API client<br/>[api.ts]"]
  node_report_format["Report formatting<br/>[format.ts]"]
end

subgraph group_api["API and orchestration"]
  node_backend["FastAPI endpoints<br/>[main.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
end

subgraph group_clinical["Clinical analysis"]
  node_pipeline["Analysis pipeline<br/>[pipeline.py]"]
  node_model_loader["Model loading<br/>[model_loader.py]"]
  node_reasoning["Report generation<br/>[reasoning.py]"]
  node_speech["Speech processing<br/>[speech.py]"]
  node_research["Clinical research<br/>[research.py]"]
  node_llm["OpenAI-compatible LLM"]
end

subgraph group_identity["Accounts and history"]
  node_auth["Authentication<br/>[auth.py]"]
  node_users["User management<br/>[users.py]"]
  node_history["Consultation history<br/>[history.py]"]
  node_db["Database sessions<br/>[db.py]"]
  node_data_models["Identity and records<br/>[models_db.py]"]
  node_postgres[("PostgreSQL")]
end

node_user(("User or clinician"))

node_user -->|"opens"| node_app_routes
node_app_routes -->|"routes to"| node_landing
node_app_routes -->|"routes to"| node_dashboard
node_dashboard -->|"shows"| node_overview
node_dashboard -->|"routes to"| node_chat
node_dashboard -->|"routes to"| node_settings
node_chat -->|"calls"| node_web_api
node_chat -->|"formats reports"| node_report_format
node_web_api -.->|"requests"| node_backend
node_backend -->|"dispatches analysis"| node_pipeline
node_backend -->|"dispatches research"| node_research
node_backend -->|"saves consultations"| node_history
node_backend -->|"manages accounts"| node_users
node_backend -->|"checks access"| node_auth
node_pipeline -->|"uses models"| node_model_loader
node_pipeline -->|"generates report"| node_reasoning
node_pipeline -->|"processes audio"| node_speech
node_reasoning -.->|"generates text"| node_llm
node_auth -->|"loads users"| node_db
node_auth -->|"queries users"| node_data_models
node_users -->|"uses authentication"| node_auth
node_users -->|"uses sessions"| node_db
node_users -->|"manages records"| node_data_models
node_history -->|"uses sessions"| node_db
node_history -->|"stores consultations"| node_data_models
node_db -->|"reads and writes"| node_postgres
node_db -->|"initializes tables"| node_data_models
node_pipeline -->|"reads settings"| node_config
node_backend -->|"loads settings"| node_config

click node_app_routes "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/App.tsx"
click node_landing "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/LandingPage.tsx"
click node_dashboard "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/DashboardLayout.tsx"
click node_chat "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/ChatPage.tsx"
click node_overview "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/OverviewPage.tsx"
click node_settings "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/SettingsPage.tsx"
click node_web_api "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/lib/api.ts"
click node_report_format "https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/lib/format.ts"
click node_backend "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/main.py"
click node_pipeline "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/pipeline.py"
click node_model_loader "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/model_loader.py"
click node_reasoning "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/reasoning.py"
click node_speech "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/speech.py"
click node_research "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/research.py"
click node_config "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/config.py"
click node_auth "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/auth.py"
click node_users "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/users.py"
click node_history "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/history.py"
click node_db "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/db.py"
click node_data_models "https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/models_db.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_routes,node_landing,node_dashboard,node_chat,node_overview,node_settings,node_web_api,node_report_format,node_user toneBlue
class node_backend,node_config toneAmber
class node_pipeline,node_model_loader,node_reasoning,node_speech,node_research,node_llm toneMint
class node_auth,node_users,node_history,node_db,node_data_models,node_postgres toneRose
```

## Components

### Web application

- [App routing](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Landing page](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/LandingPage.tsx): `frontend/src/pages/LandingPage.tsx`
- [Dashboard](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/DashboardLayout.tsx): `frontend/src/pages/DashboardLayout.tsx`
- [Diagnosis and chat](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/ChatPage.tsx): `frontend/src/pages/ChatPage.tsx`
- [Overview](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/OverviewPage.tsx): `frontend/src/pages/OverviewPage.tsx`
- [Settings](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/pages/SettingsPage.tsx): `frontend/src/pages/SettingsPage.tsx`
- [API client](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Report formatting](https://github.com/pravin2909/clinical-decision-support-system/blob/main/frontend/src/lib/format.ts): `frontend/src/lib/format.ts`

### API and orchestration

- [FastAPI endpoints](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/main.py): `backend/main.py`
- [Runtime configuration](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/config.py): `backend/app/config.py`

### Clinical analysis

- [Analysis pipeline](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/pipeline.py): `backend/app/pipeline.py`
- [Model loading](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/model_loader.py): `backend/app/model_loader.py`
- [Report generation](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/reasoning.py): `backend/app/reasoning.py`
- [Speech processing](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/speech.py): `backend/app/speech.py`
- [Clinical research](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/research.py): `backend/app/research.py`
- **OpenAI-compatible LLM**

### Accounts and history

- [Authentication](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [User management](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/users.py): `backend/app/users.py`
- [Consultation history](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/history.py): `backend/app/history.py`
- [Database sessions](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/db.py): `backend/app/db.py`
- [Identity and records](https://github.com/pravin2909/clinical-decision-support-system/blob/main/backend/app/models_db.py): `backend/app/models_db.py`
- **PostgreSQL**

### Other components

- **User or clinician**

## Connections

- User or clinician → App routing: opens (evidence: `frontend/src/App.tsx`)
- App routing → Landing page: routes to (evidence: `frontend/src/App.tsx`)
- App routing → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard → Overview: shows (evidence: `frontend/src/App.tsx`)
- Dashboard → Diagnosis and chat: routes to (evidence: `frontend/src/App.tsx`)
- Dashboard → Settings: routes to (evidence: `frontend/src/App.tsx`)
- Diagnosis and chat → API client: calls (evidence: `frontend/src/pages/ChatPage.tsx`)
- Diagnosis and chat → Report formatting: formats reports (evidence: `frontend/src/pages/ChatPage.tsx`)
- API client → FastAPI endpoints: requests
- FastAPI endpoints → Analysis pipeline: dispatches analysis (evidence: `backend/main.py`)
- FastAPI endpoints → Clinical research: dispatches research (evidence: `backend/main.py`)
- FastAPI endpoints → Consultation history: saves consultations (evidence: `backend/main.py`)
- FastAPI endpoints → User management: manages accounts (evidence: `backend/main.py`)
- FastAPI endpoints → Authentication: checks access (evidence: `backend/main.py`)
- Analysis pipeline → Model loading: uses models (evidence: `backend/app/pipeline.py`)
- Analysis pipeline → Report generation: generates report (evidence: `backend/app/pipeline.py`)
- Analysis pipeline → Speech processing: processes audio (evidence: `backend/app/pipeline.py`)
- Report generation → OpenAI-compatible LLM: generates text
- Authentication → Database sessions: loads users (evidence: `backend/app/auth.py`)
- Authentication → Identity and records: queries users (evidence: `backend/app/auth.py`)
- User management → Authentication: uses authentication (evidence: `backend/app/users.py`)
- User management → Database sessions: uses sessions (evidence: `backend/app/users.py`)
- User management → Identity and records: manages records (evidence: `backend/app/users.py`)
- Consultation history → Database sessions: uses sessions (evidence: `backend/app/history.py`)
- Consultation history → Identity and records: stores consultations (evidence: `backend/app/history.py`)
- Database sessions → PostgreSQL: reads and writes (evidence: `backend/app/db.py`)
- Database sessions → Identity and records: initializes tables (evidence: `backend/app/db.py`)
- Analysis pipeline → Runtime configuration: reads settings (evidence: `backend/app/pipeline.py`)
- FastAPI endpoints → Runtime configuration: loads settings (evidence: `backend/main.py`)
