# nagaraju-2002/heart-desease-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/nagaraju-2002/heart-desease-prediction
- Repository: https://github.com/nagaraju-2002/heart-desease-prediction

## Overview

This repository is a heart-disease classification prototype. Its visible runtime workflow loads a CSV, creates train/test and development splits, then runs four classifier scripts that report test and development performance. The README also describes visualization and real-time predictions, and notebooks appear in the tree, but their contents and any API implementation were not sampled. The input script references `data/heart.csv`, while the tree contains `dataSet/heart.csv`; that mismatch leaves the dataset connection unverified.

Main entry points: [`src/preprocessing.py`](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/preprocessing.py) (Data splitting), [`src/logistic regression.py`](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/logistic%20regression.py) (Model evaluation), [`src/knn.py`](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/knn.py) (KNN classifier), [`src/random forest.py`](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/random%20forest.py) (Random forest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data Preparation"]
  node_dataset[("Heart dataset<br/>[heart.csv]")]
  node_loader["CSV loader<br/>[input.py]"]
  node_splitting["Data splitting<br/>[preprocessing.py]"]
end

subgraph group_models["Classification"]
  node_logistic["Logistic regression"]
  node_knn["KNN classifier<br/>[knn.py]"]
  node_forest["Random forest<br/>[random forest.py]"]
  node_svc["SVM classifier<br/>[svc.py]"]
end

subgraph group_analysis["Analysis and Prediction"]
  node_evaluation["Model evaluation"]
  node_visualization["Risk visualization"]
  node_model_notebook["Model analysis"]
  node_prediction_api["Real-time prediction API"]
end

node_patient(("Patient or analyst"))

node_splitting -->|"imports data"| node_loader
node_logistic -->|"uses splits"| node_splitting
node_knn -->|"uses splits"| node_splitting
node_forest -->|"uses splits"| node_splitting
node_svc -->|"uses splits"| node_splitting
node_logistic -->|"reports metrics"| node_evaluation
node_knn -->|"reports metrics"| node_evaluation
node_forest -->|"reports metrics"| node_evaluation
node_svc -->|"reports metrics"| node_evaluation
node_patient -.->|"requests prediction"| node_prediction_api
node_dataset -.->|"analyzes risk factors"| node_visualization

click node_dataset "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/dataSet/heart.csv"
click node_loader "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/input.py"
click node_splitting "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/preprocessing.py"
click node_logistic "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/logistic%20regression.py"
click node_knn "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/knn.py"
click node_forest "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/random%20forest.py"
click node_svc "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/svc.py"
click node_evaluation "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/logistic%20regression.py"
click node_visualization "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/jupyter_notebook/AnalysisOfHeartDisease.ipynb"
click node_model_notebook "https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/jupyter_notebook/ModelAndEvaluationOfHeartDisease.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_loader,node_splitting toneBlue
class node_logistic,node_knn,node_forest,node_svc toneAmber
class node_evaluation,node_visualization,node_model_notebook,node_prediction_api toneMint
class node_patient toneIndigo
```

## Components

### Data Preparation

- [Heart dataset](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/dataSet/heart.csv): `dataSet/heart.csv`
- [CSV loader](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/input.py): `src/input.py`
- [Data splitting](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/preprocessing.py): `src/preprocessing.py`

### Classification

- [Logistic regression](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/logistic%20regression.py): `src/logistic regression.py`
- [KNN classifier](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/knn.py): `src/knn.py`
- [Random forest](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/random%20forest.py): `src/random forest.py`
- [SVM classifier](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/svc.py): `src/svc.py`

### Analysis and Prediction

- [Model evaluation](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/src/logistic%20regression.py): `src/logistic regression.py`
- [Risk visualization](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/jupyter_notebook/AnalysisOfHeartDisease.ipynb): `jupyter_notebook/AnalysisOfHeartDisease.ipynb`
- [Model analysis](https://github.com/nagaraju-2002/heart-desease-prediction/blob/main/jupyter_notebook/ModelAndEvaluationOfHeartDisease.ipynb): `jupyter_notebook/ModelAndEvaluationOfHeartDisease.ipynb`
- **Real-time prediction API**

### Other components

- **Patient or analyst**

## Connections

- Data splitting → CSV loader: imports data (evidence: `src/preprocessing.py`)
- Logistic regression → Data splitting: uses splits (evidence: `src/logistic regression.py`)
- KNN classifier → Data splitting: uses splits (evidence: `src/knn.py`)
- Random forest → Data splitting: uses splits (evidence: `src/random forest.py`)
- SVM classifier → Data splitting: uses splits (evidence: `src/svc.py`)
- Logistic regression → Model evaluation: reports metrics (evidence: `src/logistic regression.py`)
- KNN classifier → Model evaluation: reports metrics (evidence: `src/knn.py`)
- Random forest → Model evaluation: reports metrics (evidence: `src/random forest.py`)
- SVM classifier → Model evaluation: reports metrics (evidence: `src/svc.py`)
- Patient or analyst → Real-time prediction API: requests prediction (evidence: `README.md`)
- Heart dataset → Risk visualization: analyzes risk factors (evidence: `README.md`)
