# saranshvaidya0/icu_early_warning_system_presentation architecture

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

- Interactive diagram: https://gitdiagram.com/saranshvaidya0/icu_early_warning_system_presentation
- Repository: https://github.com/saranshvaidya0/icu_early_warning_system_presentation

## Overview

This repository combines an ICU early-warning web application with an offline MIMIC-III research and model-evaluation pipeline. In the web workflow, clinicians use the dashboard or predictor; the frontend sends requests and receives live telemetry from the FastAPI backend, which manages patient state, computes risk and alerts, and exposes analytics. The research workflow prepares time-series data, trains recurrent and XGBoost models, and visualizes evaluation results. Web-app components are supported by sampled source and README; research connections rely on the SOURCE INDEX and README, so unsampled details are not inferred.

Main entry points: [`frontend/src/api/client.ts`](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/api/client.ts) (API client), [`frontend/src/App.tsx`](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/App.tsx) (Web app routes), [`backend/main.py`](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/main.py) (FastAPI routes), [`src/preprocessing/main_preprocessing.py`](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/main_preprocessing.py) (Time-series preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Clinical web app"]
  node_frontend_app["Web app routes<br/>[App.tsx]"]
  node_live_hook["Live ICU state<br/>[useLiveICU.ts]"]
  node_dashboard["Command dashboard<br/>[DashboardPage.tsx]"]
  node_patient_detail["Patient deep-dive"]
  node_prediction_page["Clinical predictor<br/>[PredictPage.tsx]"]
  node_analytics_page["Model benchmarks<br/>[AnalyticsPage.tsx]"]
  node_api_client["API client<br/>[client.ts]"]
  node_icu_types["ICU data types<br/>[icu.ts]"]
end

subgraph group_server["Monitoring and prediction"]
  node_api_server["FastAPI routes<br/>[main.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
  node_simulator["Patient simulator<br/>[simulator.py]"]
  node_predictor["Risk prediction<br/>[predictor.py]"]
  node_analytics["Benchmark analytics<br/>[analytics.py]"]
end

subgraph group_research_data["Research data preparation"]
  node_preprocess_main["Time-series preprocessing"]
  node_record_collection["Record collection<br/>[collect_records.py]"]
  node_bin_impute["Binning and imputation<br/>[bin_and_impute.py]"]
  node_rnn_preprocess["RNN preprocessing"]
  node_xgb_preprocess["XGBoost preprocessing"]
end

subgraph group_research_models["Modeling and evaluation"]
  node_rnn_model["LSTM and GRU models<br/>[rnn.py]"]
  node_rnn_training["RNN training<br/>[train_rnn.py]"]
  node_xgb_training["XGBoost training<br/>[train_xgboost.py]"]
  node_rnn_experiments["RNN experiments<br/>[rnn_experiments.py]"]
  node_xgb_experiments["XGBoost experiments"]
  node_plots["Evaluation plots<br/>[plots.py]"]
  node_visualization_util["Visualization utilities<br/>[util.py]"]
end

node_clinician(("Clinical user"))
node_mimic[("MIMIC-III data")]

node_clinician -->|"uses"| node_frontend_app
node_frontend_app -->|"loads state"| node_live_hook
node_frontend_app -->|"routes to"| node_dashboard
node_frontend_app -->|"routes to"| node_patient_detail
node_frontend_app -->|"routes to"| node_prediction_page
node_frontend_app -->|"routes to"| node_analytics_page
node_live_hook -->|"fetches data"| node_api_client
node_dashboard -->|"requests data"| node_api_client
node_patient_detail -->|"requests data"| node_api_client
node_prediction_page -->|"submits vitals"| node_api_client
node_analytics_page -->|"requests benchmarks"| node_api_client
node_api_client -->|"calls HTTP API"| node_api_server
node_live_hook -->|"receives telemetry"| node_api_server
node_api_server -->|"serves patient state"| node_simulator
node_api_server -->|"runs prediction"| node_predictor
node_api_server -->|"loads benchmarks"| node_analytics
node_api_server -->|"validates payloads"| node_schemas
node_simulator -->|"computes risk"| node_predictor
node_simulator -->|"builds responses"| node_schemas
node_api_client -->|"uses types"| node_icu_types
node_mimic -.->|"supplies ICU data"| node_preprocess_main
node_preprocess_main -->|"uses collection"| node_record_collection
node_preprocess_main -->|"uses transforms"| node_bin_impute
node_rnn_preprocess -->|"uses processed data"| node_preprocess_main
node_xgb_training -->|"uses features"| node_xgb_preprocess
node_rnn_training -->|"loads sequences"| node_rnn_preprocess
node_rnn_experiments -->|"runs training"| node_rnn_training
node_rnn_experiments -->|"uses models"| node_rnn_model
node_xgb_experiments -->|"runs training"| node_xgb_training
node_xgb_experiments -->|"uses plots"| node_plots
node_plots -->|"uses utilities"| node_visualization_util

click node_frontend_app "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/App.tsx"
click node_live_hook "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/hooks/useLiveICU.ts"
click node_dashboard "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_patient_detail "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/PatientDetailPage.tsx"
click node_prediction_page "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/PredictPage.tsx"
click node_analytics_page "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/AnalyticsPage.tsx"
click node_api_client "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/api/client.ts"
click node_icu_types "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/types/icu.ts"
click node_api_server "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/main.py"
click node_schemas "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/schemas.py"
click node_simulator "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/services/simulator.py"
click node_predictor "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/services/predictor.py"
click node_analytics "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/services/analytics.py"
click node_preprocess_main "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/main_preprocessing.py"
click node_record_collection "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/collect_records.py"
click node_bin_impute "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/bin_and_impute.py"
click node_rnn_preprocess "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/rnn_preprocessing.py"
click node_xgb_preprocess "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/xgboost_preprocessing.py"
click node_rnn_model "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/models/rnn.py"
click node_rnn_training "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/train_rnn.py"
click node_xgb_training "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/train_xgboost.py"
click node_rnn_experiments "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/experiments/rnn_experiments.py"
click node_xgb_experiments "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/experiments/xgboost_experiments.py"
click node_plots "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/visualization/plots.py"
click node_visualization_util "https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/visualization/util.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_frontend_app,node_live_hook,node_dashboard,node_patient_detail,node_prediction_page,node_analytics_page,node_api_client,node_icu_types,node_clinician toneBlue
class node_api_server,node_schemas,node_simulator,node_predictor,node_analytics,node_mimic toneAmber
class node_preprocess_main,node_record_collection,node_bin_impute,node_rnn_preprocess,node_xgb_preprocess toneMint
class node_rnn_model,node_rnn_training,node_xgb_training,node_rnn_experiments,node_xgb_experiments,node_plots,node_visualization_util toneRose
```

## Components

### Clinical web app

- [Web app routes](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Live ICU state](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/hooks/useLiveICU.ts): `frontend/src/hooks/useLiveICU.ts`
- [Command dashboard](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Patient deep-dive](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/PatientDetailPage.tsx): `frontend/src/pages/PatientDetailPage.tsx`
- [Clinical predictor](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/PredictPage.tsx): `frontend/src/pages/PredictPage.tsx`
- [Model benchmarks](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/pages/AnalyticsPage.tsx): `frontend/src/pages/AnalyticsPage.tsx`
- [API client](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [ICU data types](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/frontend/src/types/icu.ts): `frontend/src/types/icu.ts`

### Monitoring and prediction

- [FastAPI routes](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/main.py): `backend/main.py`
- [API schemas](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/schemas.py): `backend/schemas.py`
- [Patient simulator](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/services/simulator.py): `backend/services/simulator.py`
- [Risk prediction](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/services/predictor.py): `backend/services/predictor.py`
- [Benchmark analytics](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/backend/services/analytics.py): `backend/services/analytics.py`

### Research data preparation

- [Time-series preprocessing](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/main_preprocessing.py): `src/preprocessing/main_preprocessing.py`
- [Record collection](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/collect_records.py): `src/preprocessing/collect_records.py`
- [Binning and imputation](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/bin_and_impute.py): `src/preprocessing/bin_and_impute.py`
- [RNN preprocessing](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/rnn_preprocessing.py): `src/preprocessing/rnn_preprocessing.py`
- [XGBoost preprocessing](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/preprocessing/xgboost_preprocessing.py): `src/preprocessing/xgboost_preprocessing.py`

### Modeling and evaluation

- [LSTM and GRU models](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/models/rnn.py): `src/models/rnn.py`
- [RNN training](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/train_rnn.py): `src/train_rnn.py`
- [XGBoost training](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/train_xgboost.py): `src/train_xgboost.py`
- [RNN experiments](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/experiments/rnn_experiments.py): `src/experiments/rnn_experiments.py`
- [XGBoost experiments](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/experiments/xgboost_experiments.py): `src/experiments/xgboost_experiments.py`
- [Evaluation plots](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/visualization/plots.py): `src/visualization/plots.py`
- [Visualization utilities](https://github.com/saranshvaidya0/icu_early_warning_system_presentation/blob/main/src/visualization/util.py): `src/visualization/util.py`

### Other components

- **Clinical user**
- **MIMIC-III data**

## Connections

- Clinical user → Web app routes: uses
- Web app routes → Live ICU state: loads state (evidence: `frontend/src/App.tsx`)
- Web app routes → Command dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Patient deep-dive: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Clinical predictor: routes to (evidence: `frontend/src/App.tsx`)
- Web app routes → Model benchmarks: routes to (evidence: `frontend/src/App.tsx`)
- Live ICU state → API client: fetches data (evidence: `frontend/src/hooks/useLiveICU.ts`)
- Command dashboard → API client: requests data (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Patient deep-dive → API client: requests data (evidence: `frontend/src/pages/PatientDetailPage.tsx`)
- Clinical predictor → API client: submits vitals (evidence: `frontend/src/pages/PredictPage.tsx`)
- Model benchmarks → API client: requests benchmarks (evidence: `frontend/src/pages/AnalyticsPage.tsx`)
- API client → FastAPI routes: calls HTTP API (evidence: `frontend/src/api/client.ts`)
- Live ICU state → FastAPI routes: receives telemetry
- FastAPI routes → Patient simulator: serves patient state (evidence: `backend/main.py`)
- FastAPI routes → Risk prediction: runs prediction (evidence: `backend/main.py`)
- FastAPI routes → Benchmark analytics: loads benchmarks (evidence: `backend/main.py`)
- FastAPI routes → API schemas: validates payloads (evidence: `backend/main.py`)
- Patient simulator → Risk prediction: computes risk (evidence: `backend/services/simulator.py`)
- Patient simulator → API schemas: builds responses (evidence: `backend/services/simulator.py`)
- API client → ICU data types: uses types (evidence: `frontend/src/api/client.ts`)
- MIMIC-III data → Time-series preprocessing: supplies ICU data
- Time-series preprocessing → Record collection: uses collection (evidence: `src/preprocessing/main_preprocessing.py`)
- Time-series preprocessing → Binning and imputation: uses transforms (evidence: `src/preprocessing/main_preprocessing.py`)
- RNN preprocessing → Time-series preprocessing: uses processed data (evidence: `src/preprocessing/rnn_preprocessing.py`)
- XGBoost training → XGBoost preprocessing: uses features (evidence: `src/train_xgboost.py`)
- RNN training → RNN preprocessing: loads sequences (evidence: `src/train_rnn.py`)
- RNN experiments → RNN training: runs training (evidence: `src/experiments/rnn_experiments.py`)
- RNN experiments → LSTM and GRU models: uses models (evidence: `src/experiments/rnn_experiments.py`)
- XGBoost experiments → XGBoost training: runs training (evidence: `src/experiments/xgboost_experiments.py`)
- XGBoost experiments → Evaluation plots: uses plots (evidence: `src/experiments/xgboost_experiments.py`)
- Evaluation plots → Visualization utilities: uses utilities (evidence: `src/visualization/plots.py`)
