# ravibabu226/ml-major_project architecture

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

- Interactive diagram: https://gitdiagram.com/ravibabu226/ml-major_project
- Repository: https://github.com/ravibabu226/ml-major_project

## Overview

CardioPulse AI is a Django clinical heart-disease risk assessment platform backed by trained hybrid and stacking classifiers. The main workflow is clinician sign-in, entry and validation of 13 patient features, inference, and optionally saving and viewing the assessment. The application also provides prediction history, dashboard summaries, model insights/performance, and authenticated REST endpoints. Training and evaluation form an offline model lifecycle. The graph follows the README and sampled code; unsampled view and URL wiring is represented only where documented or directly supported by the excerpts.

Main entry points: [`predictions/views.py`](https://github.com/ravibabu226/ml-major_project/blob/main/predictions/views.py) (Prediction views and API), [`ml/train.py`](https://github.com/ravibabu226/ml-major_project/blob/main/ml/train.py) (Training and evaluation), [`accounts/views.py`](https://github.com/ravibabu226/ml-major_project/blob/main/accounts/views.py) (Account views), [`config/urls.py`](https://github.com/ravibabu226/ml-major_project/blob/main/config/urls.py) (Django routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web and identity"]
  node_routing["Django routing<br/>[urls.py]"]
  node_account_views["Account views<br/>[views.py]"]
  node_account_forms["Account forms<br/>[forms.py]"]
  node_user_store[("Django user store<br/>[models.py]")]
  node_templates["Web pages"]
end

subgraph group_assessment["Clinical assessment"]
  node_prediction_views["Prediction views and API<br/>[views.py]"]
  node_assessment_form["Assessment form<br/>[forms.py]"]
  node_validation["Feature validation<br/>[preprocessing.py]"]
  node_inference["Ensemble inference<br/>[predict.py]"]
  node_api_serializers["API serializers<br/>[serializers.py]"]
end

subgraph group_ml["ML lifecycle"]
  node_pipeline["Trained pipeline"]
  node_train["Training and evaluation<br/>[train.py]"]
  node_dataset["Clinical dataset<br/>[heart.csv]"]
  node_preprocess["Training preprocessing<br/>[preprocessing.py]"]
  node_evaluation_data["Model metrics and insights<br/>[evaluate.py]"]
end

subgraph group_records["Records and insights"]
  node_services["Prediction services<br/>[services.py]"]
  node_prediction_model[("Prediction records<br/>[models.py]")]
  node_database[("SQLite database<br/>[settings.py]")]
end

node_clinician(("Clinician"))
node_browser(("Web browser / API client"))

node_clinician -->|"uses"| node_browser
node_browser -->|"sends requests"| node_routing
node_routing -->|"dispatches accounts"| node_account_views
node_routing -->|"dispatches app"| node_prediction_views
node_account_views -->|"validates input"| node_account_forms
node_account_views -->|"authenticates users"| node_user_store
node_account_views -->|"renders auth pages"| node_templates
node_prediction_views -->|"binds assessment"| node_assessment_form
node_assessment_form -->|"validates features"| node_validation
node_prediction_views -->|"requests prediction"| node_inference
node_inference -->|"loads models"| node_pipeline
node_prediction_views -->|"saves and aggregates"| node_services
node_services -->|"creates and queries"| node_prediction_model
node_prediction_views -->|"queries history"| node_prediction_model
node_prediction_model -->|"persists records"| node_database
node_user_store -->|"persists accounts"| node_database
node_prediction_views -->|"serializes API data"| node_api_serializers
node_prediction_views -->|"renders results and dashboards"| node_templates
node_prediction_views -->|"reads model metrics"| node_evaluation_data
node_services -->|"syncs evaluated metrics"| node_evaluation_data
node_train -->|"loads training data"| node_dataset
node_train -->|"fits transformations"| node_preprocess
node_train -->|"serializes fitted models"| node_pipeline
node_train -->|"writes evaluation artifacts"| node_evaluation_data

click node_routing "https://github.com/ravibabu226/ml-major_project/blob/main/config/urls.py"
click node_account_views "https://github.com/ravibabu226/ml-major_project/blob/main/accounts/views.py"
click node_account_forms "https://github.com/ravibabu226/ml-major_project/blob/main/accounts/forms.py"
click node_prediction_views "https://github.com/ravibabu226/ml-major_project/blob/main/predictions/views.py"
click node_assessment_form "https://github.com/ravibabu226/ml-major_project/blob/main/predictions/forms.py"
click node_validation "https://github.com/ravibabu226/ml-major_project/blob/main/ml/preprocessing.py"
click node_inference "https://github.com/ravibabu226/ml-major_project/blob/main/ml/predict.py"
click node_pipeline "https://github.com/ravibabu226/ml-major_project/blob/main/ml/trained_models/trained_pipeline.joblib"
click node_train "https://github.com/ravibabu226/ml-major_project/blob/main/ml/train.py"
click node_dataset "https://github.com/ravibabu226/ml-major_project/blob/main/ml/data/heart.csv"
click node_preprocess "https://github.com/ravibabu226/ml-major_project/blob/main/ml/preprocessing.py"
click node_evaluation_data "https://github.com/ravibabu226/ml-major_project/blob/main/ml/evaluate.py"
click node_services "https://github.com/ravibabu226/ml-major_project/blob/main/predictions/services.py"
click node_prediction_model "https://github.com/ravibabu226/ml-major_project/blob/main/predictions/models.py"
click node_user_store "https://github.com/ravibabu226/ml-major_project/blob/main/accounts/models.py"
click node_templates "https://github.com/ravibabu226/ml-major_project/tree/main/templates"
click node_api_serializers "https://github.com/ravibabu226/ml-major_project/blob/main/predictions/serializers.py"
click node_database "https://github.com/ravibabu226/ml-major_project/blob/main/config/settings.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_routing,node_account_views,node_account_forms,node_user_store,node_templates,node_browser toneBlue
class node_prediction_views,node_assessment_form,node_validation,node_inference,node_api_serializers toneAmber
class node_pipeline,node_train,node_dataset,node_preprocess,node_evaluation_data toneMint
class node_services,node_prediction_model,node_database toneRose
class node_clinician toneIndigo
```

## Components

### Web and identity

- [Django routing](https://github.com/ravibabu226/ml-major_project/blob/main/config/urls.py): `config/urls.py`
- [Account views](https://github.com/ravibabu226/ml-major_project/blob/main/accounts/views.py): `accounts/views.py`
- [Account forms](https://github.com/ravibabu226/ml-major_project/blob/main/accounts/forms.py): `accounts/forms.py`
- [Django user store](https://github.com/ravibabu226/ml-major_project/blob/main/accounts/models.py): `accounts/models.py`
- [Web pages](https://github.com/ravibabu226/ml-major_project/tree/main/templates): `templates`

### Clinical assessment

- [Prediction views and API](https://github.com/ravibabu226/ml-major_project/blob/main/predictions/views.py): `predictions/views.py`
- [Assessment form](https://github.com/ravibabu226/ml-major_project/blob/main/predictions/forms.py): `predictions/forms.py`
- [Feature validation](https://github.com/ravibabu226/ml-major_project/blob/main/ml/preprocessing.py): `ml/preprocessing.py`
- [Ensemble inference](https://github.com/ravibabu226/ml-major_project/blob/main/ml/predict.py): `ml/predict.py`
- [API serializers](https://github.com/ravibabu226/ml-major_project/blob/main/predictions/serializers.py): `predictions/serializers.py`

### ML lifecycle

- [Trained pipeline](https://github.com/ravibabu226/ml-major_project/blob/main/ml/trained_models/trained_pipeline.joblib): `ml/trained_models/trained_pipeline.joblib`
- [Training and evaluation](https://github.com/ravibabu226/ml-major_project/blob/main/ml/train.py): `ml/train.py`
- [Clinical dataset](https://github.com/ravibabu226/ml-major_project/blob/main/ml/data/heart.csv): `ml/data/heart.csv`
- [Training preprocessing](https://github.com/ravibabu226/ml-major_project/blob/main/ml/preprocessing.py): `ml/preprocessing.py`
- [Model metrics and insights](https://github.com/ravibabu226/ml-major_project/blob/main/ml/evaluate.py): `ml/evaluate.py`

### Records and insights

- [Prediction services](https://github.com/ravibabu226/ml-major_project/blob/main/predictions/services.py): `predictions/services.py`
- [Prediction records](https://github.com/ravibabu226/ml-major_project/blob/main/predictions/models.py): `predictions/models.py`
- [SQLite database](https://github.com/ravibabu226/ml-major_project/blob/main/config/settings.py): `config/settings.py`

### Other components

- **Clinician**
- **Web browser / API client**

## Connections

- Clinician → Web browser / API client: uses
- Web browser / API client → Django routing: sends requests
- Django routing → Account views: dispatches accounts
- Django routing → Prediction views and API: dispatches app
- Account views → Account forms: validates input
- Account views → Django user store: authenticates users
- Account views → Web pages: renders auth pages
- Prediction views and API → Assessment form: binds assessment
- Assessment form → Feature validation: validates features
- Prediction views and API → Ensemble inference: requests prediction
- Ensemble inference → Trained pipeline: loads models
- Prediction views and API → Prediction services: saves and aggregates
- Prediction services → Prediction records: creates and queries
- Prediction views and API → Prediction records: queries history
- Prediction records → SQLite database: persists records
- Django user store → SQLite database: persists accounts
- Prediction views and API → API serializers: serializes API data
- Prediction views and API → Web pages: renders results and dashboards
- Prediction views and API → Model metrics and insights: reads model metrics
- Prediction services → Model metrics and insights: syncs evaluated metrics
- Training and evaluation → Clinical dataset: loads training data
- Training and evaluation → Training preprocessing: fits transformations
- Training and evaluation → Trained pipeline: serializes fitted models
- Training and evaluation → Model metrics and insights: writes evaluation artifacts
