# ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning architecture

> Architecture diagram of the GitHub repository ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning
- Repository: https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning

## Overview

##### Project Type and Purpose
- Type: Full-stack web application with an ML inference component
- Purpose: Allow end users to submit patient features via a web form; run a pre-trained RandomForest model to predict diabetes; render results

##### File Structure
- Top‐level files:
– app.py (Flask routes & controller logic)
– “Diabetes Predictor – Deployment.py” (likely deployment or wrapper script)
– Procfile (Heroku entry point: e.g., gunicorn app:app)
– requirements.txt (Python dependencies)
– diabetes-prediction-rfc-model.pkl (serialized sklearn model)
- Directories:
– static/ (CSS, JS, images)
– templates/ (Jinja2 HTML templates: index.html, result.html)
– Resource/ (e.g., logos, docs, external assets)
- No database directory—state is ephemeral; all data comes from model file

##### Relationships and Data Flow
1. Browser → HTTP GET “/” → Flask route → index.html
2. Browser fills form → HTTP POST “/predict” → Flask route
3. Flask route → Model loader → RandomForest predict → result
4. Flask → Jinja2 → result.html → Browser
- That static/ assets may be fetched in parallel.

##### Architectural Patterns
- MVC‐like separation:
– Model = serialized sklearn model
– View = HTML templates + static assets
– Controller = Flask routes in app.py
- Single‐process, single‐dyno (no microservices)
- Inference is synchronous; low throughput but can scale by adding dynos

## Diagram (Mermaid)

```mermaid
graph TD
    %% Client Layer
    Browser["Web Browser"]:::client

    %% Deployment & Infra
    Git["Git Repository / Heroku Build"]:::infra
    Resource["External Resources"]:::infra

    %% Heroku Dyno Boundary
    subgraph "Heroku Dyno"
        %% Infrastructure Files
        Proc["Procfile"]:::infra
        Req["requirements.txt"]:::infra
        DeployScript["Deployment Script"]:::infra

        %% Application Server
        WS["Gunicorn WSGI & Flask App"]:::server

        %% Presentation Layer
        subgraph "Presentation Layer"
            Static["Static Assets (static/)"]:::static
            Index["templates/index.html"]:::static
            Result["templates/result.html"]:::static
        end

        %% Application Logic & ML
        subgraph "Application Logic & Inference"
            Controller["Flask Controller (app.py)"]:::server
            ModelLoader["Model Loader"]:::ml
            Predictor["Prediction Service"]:::ml
            ModelFile["RandomForest Model (diabetes-prediction-rfc-model.pkl)"]:::ml
        end
    end

    %% Data Flow
    Browser -->|"GET /"| Controller
    Controller -->|"render(template)"| Index
    Controller -->|"render(template)"| Result
    Browser -->|"fetch assets"| Static
    Browser -->|"POST /predict"| Controller
    Controller -->|"load(model)"| ModelFile
    Controller -->|"predict() call"| Predictor
    Predictor -->|"uses"| ModelLoader
    Predictor -->|"returns result"| Controller
    Controller -->|"render(template)"| Result

    %% Deployment Flow
    Git -->|"push & build"| WS

    %% Click Events
    click Controller "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/blob/master/app.py"
    click ModelFile "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/blob/master/diabetes-prediction-rfc-model.pkl"
    click Index "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/blob/master/templates/index.html"
    click Result "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/blob/master/templates/result.html"
    click Static "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/tree/master/static/"
    click Proc "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/tree/master/Procfile"
    click Req "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/blob/master/requirements.txt"
    click DeployScript "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/blob/master/Diabetes Predictor - Deployment.py"
    click Resource "https://github.com/ditikrushna/end-to-end-diabetes-prediction-application-using-machine-learning/tree/master/Resource/"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef server fill:#90EE90,stroke:#333,stroke-width:1px
    classDef ml fill:#FFA500,stroke:#333,stroke-width:1px
    classDef static fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef infra fill:#DDA0DD,stroke:#333,stroke-width:1px
```
