# shanidevra/heart-disease-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/shanidevra/heart-disease-prediction
- Repository: https://github.com/shanidevra/heart-disease-prediction

## Overview

##### Project type and purpose
- This is a data-science / machine-learning pipeline for heart disease prediction, implemented in a Jupyter notebook (`heart disease predition (1).ipynb`) and powered by a CSV dataset (`heart.data.csv`).
- The goal is to preprocess patient data, select relevant features, train three classification models (SVM, KNN, Neural Network), and compare their accuracy and stability.

##### File structure
- Top-level files only:
- `README.md` – project overview, dataset description, modeling steps, evaluation metrics
- `heart.data.csv` – raw input data
- Jupyter notebook – orchestration of preprocessing, feature selection, model training, evaluation, and visualization
- No dedicated `src/`, `lib/`, or `services/` directories—this is a self-contained analytical workflow.

##### Key insights from the README
- Data Preprocessing stages: missing-value handling, scaling, encoding categorical features, train/test split.
- Three machine-learning techniques: SVM, KNN, Neural Networks.
- Evaluation metrics: accuracy, precision, recall, F1-score, ROC-AUC.
- Emphasis on comparative analysis.

##### Components
a. Data Layer
b. Preprocessing Module
- Data Cleaner (missing-value imputation)
- Feature Scaler / Encoder
- Train/Test Split
c. Feature Selection
- Correlation matrix analysis
- Selected feature subset
d. Modeling Suite
- SVM Trainer
- KNN Trainer
- Neural Network Trainer
e. Evaluation & Comparison
- Metrics Calculator (accuracy, precision, recall, F1, ROC-AUC)
- Model Comparison Dashboard
f. Visualization / Reporting
- Plots in Jupyter (confusion matrices, ROC curves)
- Summary report export

##### Relationships and data flow
- Preprocessing Module → Feature Selection → Modeling Suite
- Each model trainer → Evaluation & Comparison
- Evaluation → Visualization / Reporting

##### Architectural patterns and design principles
- Pipeline pattern: a linear workflow of discrete stages (ETL → modeling → evaluation).
- Modular decomposition: each stage (preprocessing, feature selection, each model) is its own component.

##### Technologies and frameworks to annotate
- Python (language)
- pandas, NumPy (data manipulation)
- scikit-learn (SVM, KNN, metrics)
- TensorFlow / Keras or PyTorch (neural network)
- Jupyter Notebook (orchestration and visualization)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Layer
    Data[(Raw CSV Data Storage)]:::data
    click Data "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart.data.csv"

    %% Preprocessing
    Preprocess["Preprocessing Module\n(Imputation, Scaling,\nEncoding, Train/Test Split)"]:::process
    click Preprocess "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart disease predition (1).ipynb"

    %% Feature Selection
    FeatureSel["Feature Selection\n(Correlation Analysis,\nFeature Subset)"]:::process
    click FeatureSel "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart disease predition (1).ipynb"

    %% Modeling Suite
    subgraph "Modeling Suite"
        direction TB
        SVM["SVM Trainer"]:::model
        click SVM "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart disease predition (1).ipynb"
        KNN["KNN Trainer"]:::model
        click KNN "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart disease predition (1).ipynb"
        NN["Neural Network Trainer"]:::model
        click NN "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart disease predition (1).ipynb"
    end

    %% Evaluation & Reporting
    Eval["Evaluation & Comparison\n(Metrics Calculator)"]:::eval
    click Eval "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart disease predition (1).ipynb"

    Report["Visualization / Reporting\n(Confusion Matrices,\nROC Curves, Summary)"]:::eval
    click Report "https://github.com/shanidevra/heart-disease-prediction/blob/main/heart disease predition (1).ipynb"

    %% Documentation
    Docs["README.md\n(Project Overview & Documentation)"]:::doc
    click Docs "https://github.com/shanidevra/heart-disease-prediction/blob/main/README.md"

    %% Data Flow
    Data -->|"raw data"| Preprocess
    Preprocess -->|"cleaned data"| FeatureSel
    FeatureSel -->|"feature subset"| SVM
    FeatureSel -->|"feature subset"| KNN
    FeatureSel -->|"feature subset"| NN
    SVM -->|"trained model"| Eval
    KNN -->|"trained model"| Eval
    NN -->|"trained model"| Eval
    Eval -->|"evaluation metrics"| Report
    Eval -.->|"tuning feedback"| Preprocess

    %% Styles
    classDef data fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef process fill:#90EE90,stroke:#333,stroke-width:1px
    classDef model fill:#FFA500,stroke:#333,stroke-width:1px
    classDef eval fill:#D8BFD8,stroke:#333,stroke-width:1px
    classDef doc fill:#F0E68C,stroke:#333,stroke-width:1px
```
