# pranav30r/multi-agent-hospital-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/pranav30r/multi-agent-hospital-management-system
- Repository: https://github.com/pranav30r/multi-agent-hospital-management-system

## Overview

This is a hospital command-center application: staff authenticate, review live operational and clinical information, enter patient intake, and manage emergencies, beds, and approvals. The React dashboard calls a FastAPI backend, which exposes clinical, operational, and AI-assisted workflows backed by SQLAlchemy persistence and Redis/WebSocket event streaming. The README documents broader capabilities—including predictions, resource optimization, and multiple agents—whose detailed implementation was not sampled; those are represented at subsystem level rather than inferred call-by-call.

Main entry points: [`backend/app/main.py`](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/main.py) (FastAPI Application), [`frontend/src/App.jsx`](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/App.jsx) (Dashboard Application), [`frontend/src/api/client.js`](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/api/client.js) (HTTP API Client), [`backend/app/routers`](https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/routers) (Clinical And Patient Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Command Center UI"]
  node_react_app["Dashboard Application<br/>[App.jsx]"]
  node_auth_context["Authentication State<br/>[AuthContext.jsx]"]
  node_event_context["Live Event Context<br/>[EventContext.jsx]"]
  node_dashboard_panels["Operational Panels"]
  node_api_client["HTTP API Client<br/>[client.js]"]
  node_websocket_hook["WebSocket Hook<br/>[useWebSocket.js]"]
end

subgraph group_api["Backend API"]
  node_fastapi["FastAPI Application<br/>[main.py]"]
  node_auth_routes["Staff Authentication<br/>[auth.py]"]
  node_clinical_routes["Clinical And Patient Routes"]
  node_operations_routes["Operations Routes"]
end

subgraph group_clinical["Clinical Workflow"]
  node_intake_service["Clinical Intake"]
end

subgraph group_intelligence["Intelligence And Operations"]
  node_intelligence_engine["Intelligence Execution"]
  node_agent_orchestrator["Multi-Agent Orchestrator"]
  node_prediction_capability["Prediction Engine"]
  node_resource_workflows["Resource And Workflow Services"]
end

subgraph group_platform["Persistence And Events"]
  node_sql_database[("SQL Database<br/>[database.py]")]
  node_redis[("Redis Cache And Pub/Sub<br/>[redis.py]")]
  node_event_stream["WebSocket Event Stream<br/>[events.py]"]
end

node_staff_user(("Hospital Staff"))

node_staff_user -->|"uses dashboard"| node_react_app
node_react_app -->|"checks identity"| node_auth_context
node_react_app -->|"renders panels"| node_dashboard_panels
node_react_app -->|"provides events"| node_event_context
node_auth_context -->|"stores token"| node_api_client
node_dashboard_panels -.->|"requests data"| node_api_client
node_event_context -->|"subscribes to"| node_websocket_hook
node_websocket_hook -->|"uses token"| node_api_client
node_api_client -.->|"sends HTTP requests"| node_fastapi
node_fastapi -->|"routes requests"| node_auth_routes
node_fastapi -->|"mounts routers"| node_clinical_routes
node_fastapi -->|"mounts routers"| node_operations_routes
node_fastapi -->|"initializes database"| node_sql_database
node_fastapi -->|"initializes Redis"| node_redis
node_fastapi -->|"mounts WebSocket"| node_event_stream
node_auth_routes -->|"queries staff"| node_sql_database
node_clinical_routes -.->|"invokes intake"| node_intake_service
node_clinical_routes -.->|"invokes intelligence"| node_intelligence_engine
node_intelligence_engine -->|"delegates orchestration"| node_agent_orchestrator
node_intelligence_engine -->|"reads run messages"| node_sql_database
node_event_stream -.->|"uses pub-sub"| node_redis
node_operations_routes -.->|"invokes operations"| node_resource_workflows

click node_react_app "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/App.jsx"
click node_auth_context "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/context/AuthContext.jsx"
click node_event_context "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/context/EventContext.jsx"
click node_dashboard_panels "https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/frontend/src/components"
click node_api_client "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/api/client.js"
click node_websocket_hook "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/hooks/useWebSocket.js"
click node_fastapi "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/main.py"
click node_auth_routes "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/routers/auth.py"
click node_clinical_routes "https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/routers"
click node_operations_routes "https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/routers"
click node_intake_service "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/services/clinical_intake_service.py"
click node_intelligence_engine "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/services/intelligence_engine_service.py"
click node_agent_orchestrator "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/services/agent_orchestrator.py"
click node_prediction_capability "https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/services"
click node_resource_workflows "https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/services"
click node_sql_database "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/database.py"
click node_redis "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/core/redis.py"
click node_event_stream "https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/routers/events.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_react_app,node_auth_context,node_event_context,node_dashboard_panels,node_api_client,node_websocket_hook toneBlue
class node_fastapi,node_auth_routes,node_clinical_routes,node_operations_routes toneAmber
class node_intake_service toneMint
class node_intelligence_engine,node_agent_orchestrator,node_prediction_capability,node_resource_workflows toneRose
class node_sql_database,node_redis,node_event_stream,node_staff_user toneIndigo
```

## Components

### Command Center UI

- [Dashboard Application](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Authentication State](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Live Event Context](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/context/EventContext.jsx): `frontend/src/context/EventContext.jsx`
- [Operational Panels](https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/frontend/src/components): `frontend/src/components`
- [HTTP API Client](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`
- [WebSocket Hook](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/frontend/src/hooks/useWebSocket.js): `frontend/src/hooks/useWebSocket.js`

### Backend API

- [FastAPI Application](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/main.py): `backend/app/main.py`
- [Staff Authentication](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Clinical And Patient Routes](https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/routers): `backend/app/routers`
- [Operations Routes](https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/routers): `backend/app/routers`

### Clinical Workflow

- [Clinical Intake](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/services/clinical_intake_service.py): `backend/app/services/clinical_intake_service.py`

### Intelligence And Operations

- [Intelligence Execution](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/services/intelligence_engine_service.py): `backend/app/services/intelligence_engine_service.py`
- [Multi-Agent Orchestrator](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/services/agent_orchestrator.py): `backend/app/services/agent_orchestrator.py`
- [Prediction Engine](https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/services): `backend/app/services`
- [Resource And Workflow Services](https://github.com/pranav30r/multi-agent-hospital-management-system/tree/main/backend/app/services): `backend/app/services`

### Persistence And Events

- [SQL Database](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/database.py): `backend/app/database.py`
- [Redis Cache And Pub/Sub](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/core/redis.py): `backend/app/core/redis.py`
- [WebSocket Event Stream](https://github.com/pranav30r/multi-agent-hospital-management-system/blob/main/backend/app/routers/events.py): `backend/app/routers/events.py`

### Other components

- **Hospital Staff**

## Connections

- Hospital Staff → Dashboard Application: uses dashboard (evidence: `frontend/src/App.jsx`)
- Dashboard Application → Authentication State: checks identity (evidence: `frontend/src/App.jsx`)
- Dashboard Application → Operational Panels: renders panels (evidence: `frontend/src/App.jsx`)
- Dashboard Application → Live Event Context: provides events (evidence: `frontend/src/App.jsx`)
- Authentication State → HTTP API Client: stores token (evidence: `frontend/src/context/AuthContext.jsx`)
- Operational Panels → HTTP API Client: requests data
- Live Event Context → WebSocket Hook: subscribes to (evidence: `frontend/src/context/EventContext.jsx`)
- WebSocket Hook → HTTP API Client: uses token (evidence: `frontend/src/hooks/useWebSocket.js`)
- HTTP API Client → FastAPI Application: sends HTTP requests
- FastAPI Application → Staff Authentication: routes requests (evidence: `backend/app/main.py`)
- FastAPI Application → Clinical And Patient Routes: mounts routers (evidence: `backend/app/main.py`)
- FastAPI Application → Operations Routes: mounts routers (evidence: `backend/app/main.py`)
- FastAPI Application → SQL Database: initializes database (evidence: `backend/app/main.py`)
- FastAPI Application → Redis Cache And Pub/Sub: initializes Redis (evidence: `backend/app/main.py`)
- FastAPI Application → WebSocket Event Stream: mounts WebSocket (evidence: `backend/app/main.py`)
- Staff Authentication → SQL Database: queries staff (evidence: `backend/app/routers/auth.py`)
- Clinical And Patient Routes → Clinical Intake: invokes intake
- Clinical And Patient Routes → Intelligence Execution: invokes intelligence
- Intelligence Execution → Multi-Agent Orchestrator: delegates orchestration (evidence: `backend/app/services/intelligence_engine_service.py`)
- Intelligence Execution → SQL Database: reads run messages (evidence: `backend/app/services/intelligence_engine_service.py`)
- WebSocket Event Stream → Redis Cache And Pub/Sub: uses pub-sub
- Operations Routes → Resource And Workflow Services: invokes operations (evidence: `backend/app/routers/auth.py`)
