# yashedbin/ml_diabetes_risk_predictor architecture

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

- Interactive diagram: https://gitdiagram.com/yashedbin/ml_diabetes_risk_predictor
- Repository: https://github.com/yashedbin/ml_diabetes_risk_predictor

## Overview

This is a course-project diabetes-risk prediction system, not a clinical tool. Its main workflow is patient input in the Streamlit app, shared feature transformation, and predictions from selectable or all-model classifiers; a separate training workflow prepares data, fits models, and exports metrics and artifacts for the app. The README also documents notebook-based EDA and experiments. Source excerpts show the app, preprocessing, and training code; notebook implementation details were not sampled, so its internal relationships are not inferred.

Main entry points: [`app.py`](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py) (Streamlit frontend), [`train.py`](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/train.py) (Model training), [`preprocessing.py`](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/preprocessing.py) (Cleaning and features), [`models`](https://github.com/yashedbin/ml_diabetes_risk_predictor/tree/main/models) (Classifier artifacts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_dataset["Diabetes dataset"]
  node_preprocessing["Cleaning and features<br/>[preprocessing.py]"]
  node_splits["Train/test splits"]
end

subgraph group_training["Model training"]
  node_training_job["Model training<br/>[train.py]"]
  node_classifiers[("Classifier artifacts")]
  node_metrics["Evaluation metrics<br/>[metrics.json]"]
end

subgraph group_inference["Risk prediction app"]
  node_app["Streamlit frontend<br/>[app.py]"]
  node_patient_input["Patient details<br/>[app.py]"]
  node_model_inference["Model inference<br/>[app.py]"]
  node_risk_output["Risk results<br/>[app.py]"]
  node_model_comparison["Model comparison<br/>[app.py]"]
end

subgraph group_analysis["Exploration"]
  node_notebook["EDA and experiments<br/>[notebook.ipynb]"]
end

node_user(("User"))

node_dataset -->|"loads and cleans"| node_preprocessing
node_preprocessing -->|"saves splits"| node_splits
node_training_job -->|"loads transformed data"| node_splits
node_training_job -->|"uses split loader"| node_preprocessing
node_training_job -->|"exports models"| node_classifiers
node_training_job -->|"writes scores"| node_metrics
node_user -->|"uses"| node_app
node_app -->|"collects details"| node_patient_input
node_patient_input -->|"transforms features"| node_preprocessing
node_app -->|"loads models"| node_classifiers
node_app -->|"loads metrics"| node_metrics
node_app -->|"runs selected models"| node_model_inference
node_model_inference -->|"predicts with"| node_classifiers
node_model_inference -->|"produces predictions"| node_risk_output
node_app -->|"shows comparison"| node_model_comparison
node_user -->|"runs EDA"| node_notebook

click node_dataset "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/diabetes_prediction_dataset.csv"
click node_preprocessing "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/preprocessing.py"
click node_splits "https://github.com/yashedbin/ml_diabetes_risk_predictor/tree/main/data"
click node_training_job "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/train.py"
click node_classifiers "https://github.com/yashedbin/ml_diabetes_risk_predictor/tree/main/models"
click node_metrics "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/models/metrics.json"
click node_app "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py"
click node_patient_input "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py"
click node_model_inference "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py"
click node_risk_output "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py"
click node_model_comparison "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py"
click node_notebook "https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/notebook.ipynb"

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,node_preprocessing,node_splits,node_user toneBlue
class node_training_job,node_classifiers,node_metrics toneAmber
class node_app,node_patient_input,node_model_inference,node_risk_output,node_model_comparison toneMint
class node_notebook toneRose
```

## Components

### Data preparation

- [Diabetes dataset](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/diabetes_prediction_dataset.csv): `diabetes_prediction_dataset.csv`
- [Cleaning and features](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/preprocessing.py): `preprocessing.py`
- [Train/test splits](https://github.com/yashedbin/ml_diabetes_risk_predictor/tree/main/data): `data`

### Model training

- [Model training](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/train.py): `train.py`
- [Classifier artifacts](https://github.com/yashedbin/ml_diabetes_risk_predictor/tree/main/models): `models`
- [Evaluation metrics](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/models/metrics.json): `models/metrics.json`

### Risk prediction app

- [Streamlit frontend](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py): `app.py`
- [Patient details](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py): `app.py`
- [Model inference](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py): `app.py`
- [Risk results](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py): `app.py`
- [Model comparison](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/app.py): `app.py`

### Exploration

- [EDA and experiments](https://github.com/yashedbin/ml_diabetes_risk_predictor/blob/main/notebook.ipynb): `notebook.ipynb`

### Other components

- **User**

## Connections

- Diabetes dataset → Cleaning and features: loads and cleans (evidence: `preprocessing.py`)
- Cleaning and features → Train/test splits: saves splits (evidence: `preprocessing.py`)
- Model training → Train/test splits: loads transformed data (evidence: `train.py`)
- Model training → Cleaning and features: uses split loader (evidence: `train.py`)
- Model training → Classifier artifacts: exports models (evidence: `train.py`)
- Model training → Evaluation metrics: writes scores (evidence: `train.py`)
- User → Streamlit frontend: uses (evidence: `README.md`)
- Streamlit frontend → Patient details: collects details (evidence: `app.py`)
- Patient details → Cleaning and features: transforms features (evidence: `app.py`)
- Streamlit frontend → Classifier artifacts: loads models (evidence: `app.py`)
- Streamlit frontend → Evaluation metrics: loads metrics (evidence: `app.py`)
- Streamlit frontend → Model inference: runs selected models (evidence: `app.py`)
- Model inference → Classifier artifacts: predicts with (evidence: `app.py`)
- Model inference → Risk results: produces predictions (evidence: `app.py`)
- Streamlit frontend → Model comparison: shows comparison (evidence: `app.py`)
- User → EDA and experiments: runs EDA (evidence: `README.md`)
