# sarveshpratap6093-beep/14 architecture

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

- Interactive diagram: https://gitdiagram.com/sarveshpratap6093-beep/14
- Repository: https://github.com/sarveshpratap6093-beep/14

## Overview

This is a compact research prototype, not a deployed service: a command-line workflow reads a CSV, prepares patient-level training and test data, trains and evaluates an XGBoost risk classifier, then accepts one patient's vital signs and prints risk probabilities and an alarm decision. Training and inference share one script and the fitted imputer/model state. The README also mentions MATLAB-generated signals and dataset assets, but their runtime use is not shown; the sampled source does not establish how those assets relate to the CSV input.

Main entry points: [`code.py`](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py) (Patient prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Prediction workflow"]
  node_dataset_load["Load dataset<br/>[code.py]"]
  node_feature_prep["Select vital features<br/>[code.py]"]
  node_vital_input["Vital-sign prompts<br/>[code.py]"]
  node_patient_prediction["Patient prediction<br/>[code.py]"]
  node_alarm_logic["Alarm decision<br/>[code.py]"]
  node_result["Risk and alarm output<br/>[code.py]"]
end

subgraph group_modeling["Modeling and evaluation"]
  node_patient_split["Patient-level split<br/>[code.py]"]
  node_imputation["Median imputation<br/>[code.py]"]
  node_xgboost["XGBoost classifier<br/>[code.py]"]
  node_evaluation["Model evaluation<br/>[code.py]"]
  node_model_artifacts["Saved model files<br/>[code.py]"]
end

node_operator(("Operator"))
node_csv["Patient CSV"]

node_csv -->|"provides rows"| node_dataset_load
node_dataset_load -->|"selects columns"| node_feature_prep
node_feature_prep -->|"splits features"| node_patient_split
node_patient_split -->|"passes partitions"| node_imputation
node_imputation -->|"trains on imputed data"| node_xgboost
node_xgboost -->|"produces predictions"| node_evaluation
node_xgboost -->|"saves model"| node_model_artifacts
node_imputation -->|"saves imputer"| node_model_artifacts
node_operator -->|"enters vitals"| node_vital_input
node_vital_input -->|"calls prediction"| node_patient_prediction
node_patient_prediction -->|"transforms vitals"| node_imputation
node_patient_prediction -->|"predicts risk"| node_xgboost
node_patient_prediction -->|"checks class"| node_alarm_logic
node_patient_prediction -->|"returns risk probabilities"| node_result
node_alarm_logic -->|"sets alarm status"| node_result

click node_dataset_load "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_feature_prep "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_patient_split "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_imputation "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_xgboost "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_evaluation "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_model_artifacts "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_vital_input "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_patient_prediction "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_alarm_logic "https://github.com/sarveshpratap6093-beep/14/blob/main/code.py"
click node_result "https://github.com/sarveshpratap6093-beep/14/blob/main/code.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_dataset_load,node_feature_prep,node_vital_input,node_patient_prediction,node_alarm_logic,node_result toneBlue
class node_patient_split,node_imputation,node_xgboost,node_evaluation,node_model_artifacts toneAmber
class node_operator,node_csv toneIndigo
```

## Components

### Prediction workflow

- [Load dataset](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Select vital features](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Vital-sign prompts](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Patient prediction](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Alarm decision](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Risk and alarm output](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`

### Modeling and evaluation

- [Patient-level split](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Median imputation](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [XGBoost classifier](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Model evaluation](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`
- [Saved model files](https://github.com/sarveshpratap6093-beep/14/blob/main/code.py): `code.py`

### Other components

- **Operator**
- **Patient CSV**

## Connections

- Patient CSV → Load dataset: provides rows (evidence: `code.py`)
- Load dataset → Select vital features: selects columns (evidence: `code.py`)
- Select vital features → Patient-level split: splits features (evidence: `code.py`)
- Patient-level split → Median imputation: passes partitions (evidence: `code.py`)
- Median imputation → XGBoost classifier: trains on imputed data (evidence: `code.py`)
- XGBoost classifier → Model evaluation: produces predictions (evidence: `code.py`)
- XGBoost classifier → Saved model files: saves model (evidence: `code.py`)
- Median imputation → Saved model files: saves imputer (evidence: `code.py`)
- Operator → Vital-sign prompts: enters vitals (evidence: `code.py`)
- Vital-sign prompts → Patient prediction: calls prediction (evidence: `code.py`)
- Patient prediction → Median imputation: transforms vitals (evidence: `code.py`)
- Patient prediction → XGBoost classifier: predicts risk (evidence: `code.py`)
- Patient prediction → Alarm decision: checks class (evidence: `code.py`)
- Patient prediction → Risk and alarm output: returns risk probabilities (evidence: `code.py`)
- Alarm decision → Risk and alarm output: sets alarm status (evidence: `code.py`)
