# lakshmisainivas/disease-prediction-ml architecture

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

- Interactive diagram: https://gitdiagram.com/lakshmisainivas/disease-prediction-ml
- Repository: https://github.com/lakshmisainivas/disease-prediction-ml

## Overview

This is a small, single-file disease-classification script. It reads a CSV, encodes and scales data, removes rare disease classes, balances the remaining classes, trains a Random Forest, evaluates it, and prints a decoded example prediction. The README describes real-time CLI prediction, but the shown source only predicts on a held-out test set; no interactive input flow is visible.

Main entry points: [`disease_prediction_model.py`](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py) (Test predictions)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_dataset["Disease CSV"]
node_prep["Prepare data"]
node_balance["Balance classes"]
node_split["Train-test split"]
node_model["Random Forest"]
node_predict["Test predictions"]
node_evaluate["Accuracy score"]
node_decode["Decode disease"]
node_output["Printed results"]

node_user -->|"runs script"| node_prep
node_dataset -->|"loads CSV"| node_prep
node_prep -->|"filters data"| node_balance
node_balance -->|"resamples data"| node_split
node_split -->|"provides training data"| node_model
node_model -->|"predicts test labels"| node_predict
node_predict -->|"scores predictions"| node_evaluate
node_predict -->|"maps first label"| node_decode
node_evaluate -->|"prints accuracy"| node_output
node_decode -->|"prints disease"| node_output

click node_prep "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py"
click node_balance "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py"
click node_split "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py"
click node_model "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py"
click node_predict "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py"
click node_evaluate "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py"
click node_decode "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py"
click node_output "https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.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_user toneBlue
class node_dataset toneIndigo
class node_prep,node_balance,node_split,node_model,node_predict,node_evaluate,node_decode,node_output toneTeal
```

## Components

### Other components

- **User**
- **Disease CSV**
- [Prepare data](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`
- [Balance classes](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`
- [Train-test split](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`
- [Random Forest](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`
- [Test predictions](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`
- [Accuracy score](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`
- [Decode disease](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`
- [Printed results](https://github.com/lakshmisainivas/disease-prediction-ml/blob/main/disease_prediction_model.py): `disease_prediction_model.py`

## Connections

- User → Prepare data: runs script (evidence: `README.md`)
- Disease CSV → Prepare data: loads CSV (evidence: `disease_prediction_model.py`)
- Prepare data → Balance classes: filters data (evidence: `disease_prediction_model.py`)
- Balance classes → Train-test split: resamples data (evidence: `disease_prediction_model.py`)
- Train-test split → Random Forest: provides training data (evidence: `disease_prediction_model.py`)
- Random Forest → Test predictions: predicts test labels (evidence: `disease_prediction_model.py`)
- Test predictions → Accuracy score: scores predictions (evidence: `disease_prediction_model.py`)
- Test predictions → Decode disease: maps first label (evidence: `disease_prediction_model.py`)
- Accuracy score → Printed results: prints accuracy (evidence: `disease_prediction_model.py`)
- Decode disease → Printed results: prints disease (evidence: `disease_prediction_model.py`)
