# adibuzz/xgboost_early_readmission_paper architecture

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

- Interactive diagram: https://gitdiagram.com/adibuzz/xgboost_early_readmission_paper
- Repository: https://github.com/adibuzz/xgboost_early_readmission_paper

## Overview

This repository is a research workflow for predicting 28-day readmission with XGBoost. The user runs cross-validation first; it preprocesses the dataset, selects the fold with the highest test recall, and writes the selected features and indices for the second script. That script retrains the selected-feature model and reports evaluation metrics and visualizations, including SHAP feature importance. The graph reflects the two scripts and shared preprocessing; the dataset and generated files are runtime inputs and outputs, not repository modules.

Main entry points: [`final_refined_dataframe.py`](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py) (Final model run), [`main.py`](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/main.py) (Cross-validation run), [`pre_processing_steps.py`](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/pre_processing_steps.py) (Data preprocessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_validation["Cross-validation"]
  node_cv["Cross-validation run<br/>[main.py]"]
  node_folds["Fold training and evaluation<br/>[main.py]"]
  node_cvresults["Fold results"]
  node_selection["Best-fold selection<br/>[main.py]"]
  node_checkpoint["Selected fold data"]
end

subgraph group_modeling["Final modeling"]
  node_finalrun["Final model run"]
  node_finalmodel["Selected-feature XGBoost"]
  node_evaluation["Test evaluation"]
  node_interpretation["Model interpretation"]
  node_visuals["Evaluation plots"]
end

subgraph group_prep["Shared preprocessing"]
  node_preprocess["Data preprocessing"]
end

node_researcher(("Researcher"))
node_dataset[("Clinical dataset")]

node_researcher -->|"runs first"| node_cv
node_researcher -->|"runs next"| node_finalrun
node_dataset -->|"provides data"| node_cv
node_cv -->|"calls"| node_preprocess
node_cv -->|"runs folds"| node_folds
node_folds -->|"compares recall"| node_selection
node_cv -->|"writes"| node_cvresults
node_selection -->|"writes selection"| node_checkpoint
node_checkpoint -->|"provides selection"| node_finalrun
node_dataset -->|"provides data"| node_finalrun
node_finalrun -->|"calls"| node_preprocess
node_finalrun -->|"trains"| node_finalmodel
node_finalrun -->|"evaluates"| node_evaluation
node_finalrun -->|"computes SHAP"| node_interpretation
node_evaluation -->|"writes plots"| node_visuals
node_interpretation -->|"writes plot"| node_visuals

click node_cv "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/main.py"
click node_preprocess "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/pre_processing_steps.py"
click node_folds "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/main.py"
click node_selection "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/main.py"
click node_finalrun "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py"
click node_finalmodel "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py"
click node_evaluation "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py"
click node_interpretation "https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.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_cv,node_folds,node_cvresults,node_selection,node_checkpoint toneBlue
class node_finalrun,node_finalmodel,node_evaluation,node_interpretation,node_visuals,node_dataset toneAmber
class node_preprocess toneMint
class node_researcher toneIndigo
```

## Components

### Cross-validation

- [Cross-validation run](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/main.py): `main.py`
- [Fold training and evaluation](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/main.py): `main.py`
- **Fold results**
- [Best-fold selection](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/main.py): `main.py`
- **Selected fold data**

### Final modeling

- [Final model run](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py): `final_refined_dataframe.py`
- [Selected-feature XGBoost](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py): `final_refined_dataframe.py`
- [Test evaluation](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py): `final_refined_dataframe.py`
- [Model interpretation](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/final_refined_dataframe.py): `final_refined_dataframe.py`
- **Evaluation plots**

### Shared preprocessing

- [Data preprocessing](https://github.com/adibuzz/xgboost_early_readmission_paper/blob/main/pre_processing_steps.py): `pre_processing_steps.py`

### Other components

- **Researcher**
- **Clinical dataset**

## Connections

- Researcher → Cross-validation run: runs first (evidence: `README.md`)
- Researcher → Final model run: runs next (evidence: `README.md`)
- Clinical dataset → Cross-validation run: provides data (evidence: `main.py`)
- Cross-validation run → Data preprocessing: calls (evidence: `main.py`)
- Cross-validation run → Fold training and evaluation: runs folds (evidence: `main.py`)
- Fold training and evaluation → Best-fold selection: compares recall (evidence: `main.py`)
- Cross-validation run → Fold results: writes (evidence: `main.py`)
- Best-fold selection → Selected fold data: writes selection (evidence: `main.py`)
- Selected fold data → Final model run: provides selection (evidence: `final_refined_dataframe.py`)
- Clinical dataset → Final model run: provides data (evidence: `final_refined_dataframe.py`)
- Final model run → Data preprocessing: calls (evidence: `final_refined_dataframe.py`)
- Final model run → Selected-feature XGBoost: trains (evidence: `final_refined_dataframe.py`)
- Final model run → Test evaluation: evaluates (evidence: `final_refined_dataframe.py`)
- Final model run → Model interpretation: computes SHAP (evidence: `final_refined_dataframe.py`)
- Test evaluation → Evaluation plots: writes plots (evidence: `final_refined_dataframe.py`)
- Model interpretation → Evaluation plots: writes plot (evidence: `final_refined_dataframe.py`)
