# rkhm2004/deepicu-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/rkhm2004/deepicu-tracker
- Repository: https://github.com/rkhm2004/deepicu-tracker

## Overview

DeepICU-Tracker turns ICU measurements into latent risk states, models progression toward Critical, and reports expected time-to-Critical with uncertainty. The principal workflow runs from MIMIC preprocessing through VAE training and state mapping, CTMC estimation, and phase-type inference; Bayesian risk probabilities and visualizations are supporting branches. Edges follow explicit README statements or shown source references; the dashboard is documented as future work and is not represented as implemented.

Main entry points: [`data/processed`](https://github.com/rkhm2004/deepicu-tracker/tree/codex/data/processed) (Processed Trajectories), [`src/inference.py`](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/inference.py) (Risk Inference), [`src/vae/model.py`](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/model.py) (VAE Model), [`src/vae/train.py`](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/train.py) (Risk-State Mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data Preparation"]
  node_parser["Leakage-Safe Parser<br/>[mimic_parser.py]"]
  node_mock["Mock Data Generator<br/>[mock_data.py]"]
  node_processed[("Processed Trajectories")]
end

subgraph group_risk["Risk Modeling"]
  node_vae["VAE Model<br/>[model.py]"]
  node_trainer["VAE Training<br/>[train.py]"]
  node_states["Risk-State Mapping<br/>[train.py]"]
end

subgraph group_prognosis["Prognosis"]
  node_ctmc["CTMC Estimator<br/>[ctmc_estimator.py]"]
  node_mgf["Phase-Type MGF<br/>[mgf_calculator.py]"]
end

subgraph group_outputs["Risk Outputs"]
  node_inference["Risk Inference<br/>[inference.py]"]
  node_bn["Bayesian Risk Network<br/>[train_infer.py]"]
  node_evaluation["Mathematical Evaluation<br/>[evaluation.py]"]
  node_plots["Risk Visualizations<br/>[plot.py]"]
  node_summary["Dataset Summary<br/>[data.py]"]
  node_results[("Inference Results")]
end

node_mimic(("MIMIC ICU Data"))
node_clinical["Clinical Risk Output"]

node_mimic -->|"provides measurements"| node_parser
node_parser -->|"writes trajectories"| node_processed
node_mock -.->|"writes mock data"| node_processed
node_processed -->|"supplies training data"| node_trainer
node_trainer -->|"trains"| node_vae
node_trainer -->|"derives cutoffs"| node_states
node_vae -->|"produces latent scores"| node_states
node_states -->|"supplies state trajectories"| node_ctmc
node_ctmc -->|"provides generator"| node_mgf
node_processed -->|"supplies patient data"| node_inference
node_vae -->|"encodes measurements"| node_inference
node_inference -->|"writes predictions"| node_results
node_mgf -->|"provides countdown statistics"| node_inference
node_inference -->|"reports risk and countdown"| node_clinical
node_states -->|"supplies risk labels"| node_bn
node_processed -->|"supplies features"| node_bn
node_bn -->|"writes BN predictions"| node_results
node_processed -->|"supplies evaluation data"| node_evaluation
node_vae -->|"encodes records"| node_evaluation
node_ctmc -->|"estimates transitions"| node_evaluation
node_results -->|"supplies predictions"| node_plots
node_results -->|"supplies predictions"| node_summary

click node_parser "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/data_pipeline/mimic_parser.py"
click node_mock "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/data_pipeline/mock_data.py"
click node_processed "https://github.com/rkhm2004/deepicu-tracker/tree/codex/data/processed"
click node_vae "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/model.py"
click node_trainer "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/train.py"
click node_states "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/train.py"
click node_ctmc "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/markov_mgf/ctmc_estimator.py"
click node_mgf "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/markov_mgf/mgf_calculator.py"
click node_inference "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/inference.py"
click node_bn "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/bayesian_net/train_infer.py"
click node_evaluation "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/evaluation.py"
click node_plots "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/plot.py"
click node_summary "https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/data.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_parser,node_mock,node_processed toneBlue
class node_vae,node_trainer,node_states toneAmber
class node_ctmc,node_mgf toneMint
class node_inference,node_bn,node_evaluation,node_plots,node_summary,node_results toneRose
class node_mimic,node_clinical toneIndigo
```

## Components

### Data Preparation

- [Leakage-Safe Parser](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/data_pipeline/mimic_parser.py): `src/data_pipeline/mimic_parser.py`
- [Mock Data Generator](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/data_pipeline/mock_data.py): `src/data_pipeline/mock_data.py`
- [Processed Trajectories](https://github.com/rkhm2004/deepicu-tracker/tree/codex/data/processed): `data/processed`

### Risk Modeling

- [VAE Model](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/model.py): `src/vae/model.py`
- [VAE Training](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/train.py): `src/vae/train.py`
- [Risk-State Mapping](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/vae/train.py): `src/vae/train.py`

### Prognosis

- [CTMC Estimator](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/markov_mgf/ctmc_estimator.py): `src/markov_mgf/ctmc_estimator.py`
- [Phase-Type MGF](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/markov_mgf/mgf_calculator.py): `src/markov_mgf/mgf_calculator.py`

### Risk Outputs

- [Risk Inference](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/inference.py): `src/inference.py`
- [Bayesian Risk Network](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/bayesian_net/train_infer.py): `src/bayesian_net/train_infer.py`
- [Mathematical Evaluation](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/evaluation.py): `src/evaluation.py`
- [Risk Visualizations](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/plot.py): `src/plot.py`
- [Dataset Summary](https://github.com/rkhm2004/deepicu-tracker/blob/codex/src/data.py): `src/data.py`
- **Inference Results**

### Other components

- **MIMIC ICU Data**
- **Clinical Risk Output**

## Connections

- MIMIC ICU Data → Leakage-Safe Parser: provides measurements (evidence: `README.md`)
- Leakage-Safe Parser → Processed Trajectories: writes trajectories (evidence: `src/data_pipeline/mimic_parser.py`)
- Mock Data Generator → Processed Trajectories: writes mock data
- Processed Trajectories → VAE Training: supplies training data (evidence: `src/vae/train.py`)
- VAE Training → VAE Model: trains (evidence: `src/vae/train.py`)
- VAE Training → Risk-State Mapping: derives cutoffs (evidence: `src/vae/train.py`)
- VAE Model → Risk-State Mapping: produces latent scores (evidence: `README.md`)
- Risk-State Mapping → CTMC Estimator: supplies state trajectories (evidence: `src/markov_mgf/ctmc_estimator.py`)
- CTMC Estimator → Phase-Type MGF: provides generator (evidence: `README.md`)
- Processed Trajectories → Risk Inference: supplies patient data (evidence: `src/inference.py`)
- VAE Model → Risk Inference: encodes measurements (evidence: `src/inference.py`)
- Risk Inference → Inference Results: writes predictions (evidence: `src/inference.py`)
- Phase-Type MGF → Risk Inference: provides countdown statistics (evidence: `README.md`)
- Risk Inference → Clinical Risk Output: reports risk and countdown (evidence: `README.md`)
- Risk-State Mapping → Bayesian Risk Network: supplies risk labels (evidence: `src/bayesian_net/train_infer.py`)
- Processed Trajectories → Bayesian Risk Network: supplies features (evidence: `src/bayesian_net/train_infer.py`)
- Bayesian Risk Network → Inference Results: writes BN predictions (evidence: `src/bayesian_net/train_infer.py`)
- Processed Trajectories → Mathematical Evaluation: supplies evaluation data (evidence: `src/evaluation.py`)
- VAE Model → Mathematical Evaluation: encodes records (evidence: `src/evaluation.py`)
- CTMC Estimator → Mathematical Evaluation: estimates transitions (evidence: `src/evaluation.py`)
- Inference Results → Risk Visualizations: supplies predictions (evidence: `src/plot.py`)
- Inference Results → Dataset Summary: supplies predictions (evidence: `src/data.py`)
