# sathvikreddy1363/cardiac_arrhythmia architecture

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

- Interactive diagram: https://gitdiagram.com/sathvikreddy1363/cardiac_arrhythmia
- Repository: https://github.com/sathvikreddy1363/cardiac_arrhythmia

## Overview

This repository is an ECG heartbeat binary-classification project. Its executable workflow loads MIT-BIH data, converts labels to Normal/Abnormal, balances the training set, scales features, trains Logistic Regression and KNN, then evaluates both predictions. The README also describes exploratory analysis and notebook-based work; notebook contents were not sampled, so those activities are not connected to the executable pipeline here. The source excerpts show the pipeline’s calls and data flow.

Main entry points: [`main.py`](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/main.py) (Pipeline runner), [`src/preprocess.py`](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py) (Scale features), [`src/model.py`](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/model.py) (Logistic Regression), [`src/evaluate.py`](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/evaluate.py) (Evaluate predictions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Data Preparation"]
  node_load["Load data<br/>[preprocess.py]"]
  node_binary["Binary labels<br/>[preprocess.py]"]
  node_balance["Balance training<br/>[preprocess.py]"]
  node_scale["Scale features<br/>[preprocess.py]"]
end

subgraph group_models["Modeling"]
  node_logistic["Logistic Regression<br/>[model.py]"]
  node_knn["KNN<br/>[model.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluate["Evaluate predictions<br/>[evaluate.py]"]
end

node_dataset["MIT-BIH data"]
node_main["Pipeline runner<br/>[main.py]"]

node_dataset -->|"provides CSVs"| node_load
node_main -->|"calls"| node_load
node_main -->|"calls"| node_binary
node_main -->|"calls"| node_balance
node_main -->|"calls"| node_scale
node_main -->|"calls"| node_logistic
node_main -->|"calls"| node_knn
node_main -->|"calls"| node_evaluate
node_load -->|"returns data"| node_binary
node_binary -->|"returns labels"| node_balance
node_balance -->|"returns training data"| node_scale
node_scale -->|"provides scaled data"| node_logistic
node_scale -->|"provides scaled data"| node_knn
node_logistic -->|"provides predictions"| node_evaluate
node_knn -->|"provides predictions"| node_evaluate

click node_main "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/main.py"
click node_load "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py"
click node_binary "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py"
click node_balance "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py"
click node_scale "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py"
click node_logistic "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/model.py"
click node_knn "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/model.py"
click node_evaluate "https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/evaluate.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_load,node_binary,node_balance,node_scale toneBlue
class node_logistic,node_knn toneAmber
class node_evaluate toneMint
class node_dataset toneIndigo
class node_main toneTeal
```

## Components

### Data Preparation

- [Load data](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py): `src/preprocess.py`
- [Binary labels](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py): `src/preprocess.py`
- [Balance training](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py): `src/preprocess.py`
- [Scale features](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/preprocess.py): `src/preprocess.py`

### Modeling

- [Logistic Regression](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/model.py): `src/model.py`
- [KNN](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/model.py): `src/model.py`

### Evaluation

- [Evaluate predictions](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/src/evaluate.py): `src/evaluate.py`

### Other components

- **MIT-BIH data**
- [Pipeline runner](https://github.com/sathvikreddy1363/cardiac_arrhythmia/blob/main/main.py): `main.py`

## Connections

- MIT-BIH data → Load data: provides CSVs (evidence: `src/preprocess.py`)
- Pipeline runner → Load data: calls (evidence: `main.py`)
- Pipeline runner → Binary labels: calls (evidence: `main.py`)
- Pipeline runner → Balance training: calls (evidence: `main.py`)
- Pipeline runner → Scale features: calls (evidence: `main.py`)
- Pipeline runner → Logistic Regression: calls (evidence: `main.py`)
- Pipeline runner → KNN: calls (evidence: `main.py`)
- Pipeline runner → Evaluate predictions: calls (evidence: `main.py`)
- Load data → Binary labels: returns data (evidence: `main.py`)
- Binary labels → Balance training: returns labels (evidence: `main.py`)
- Balance training → Scale features: returns training data (evidence: `main.py`)
- Scale features → Logistic Regression: provides scaled data (evidence: `main.py`)
- Scale features → KNN: provides scaled data (evidence: `main.py`)
- Logistic Regression → Evaluate predictions: provides predictions (evidence: `main.py`)
- KNN → Evaluate predictions: provides predictions (evidence: `main.py`)
