# entbappy/end-to-end-machine-learning-project-with-mlflow architecture

> Architecture diagram of the GitHub repository entbappy/end-to-end-machine-learning-project-with-mlflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/entbappy/end-to-end-machine-learning-project-with-mlflow
- Repository: https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow

## Overview

##### Project type and purpose
- This is an end-to-end machine learning project with two main facets:
- A modular ML pipeline (data ingestion → validation → transformation → training → evaluation) implemented in Python.
- A Flask-based web application (app.py + templates/static) exposing a simple UI for predictions.
- It uses MLflow for experiment tracking and is containerized (Dockerfile) with CI/CD workflows targeting AWS (ECR, EC2, GitHub Actions).

##### File structure
- Top-level files:
- app.py (Flask app entrypoint)
- main.py (CLI entrypoint to kick off training pipeline)
- Dockerfile, .github/workflows/main.yaml (CI/CD)
- config/config.yaml, params.yaml, schema.yaml (YAML-based configuration, hyperparameters, data schema)
- src/mlProject:
- components/ (data_ingestion.py, data_validation.py, etc.)
- pipeline/ (orchestrator scripts for each stage + a prediction pipeline)
- config (configuration manager), entity (data classes), constants, utils
- research/: Jupyter notebooks for prototyping each pipeline stage
- templates/ + static/: Flask UI (index.html, results.html, CSS, JS)

##### README for additional insights
- Describes how to configure config.yaml, schema.yaml, params.yaml
- Outlines a 9-step workflow: update configs, components, pipeline, then run main.py or app.py
- Mentions MLflow tracking server (locally or via DagsHub)
- Details AWS CI/CD: build Docker image → push to ECR → self-hosted runner on EC2 → deploy container

##### Detail
- Every pipeline component and how it’s invoked
- How configuration YAMLs propagate through the system
- MLflow tracking URI and credentials as an external connector
- CI/CD workflow as a side pipeline feeding into AWS

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Configuration Layer
    subgraph "Configuration Layer"
        direction TB
        C1["config/config.yaml"]:::config
        C2["params.yaml"]:::config
        C3["schema.yaml"]:::config
        CM["Configuration Manager"]:::codeModule
    end
    C1 --> CM
    C2 --> CM
    C3 --> CM
    click C1 "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/config/config.yaml"
    click C2 "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/params.yaml"
    click C3 "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/schema.yaml"
    click CM "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/config/configuration.py"

    %% Orchestrator
    ORG["main.py\n(CLI Orchestrator)"]:::codeModule
    click ORG "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/main.py"
    CM --> ORG

    %% Pipeline Modules
    subgraph "ML Pipeline" 
        direction TB
        DI["Data Ingestion"]:::pipeline
        DIst["Stage 01: Data Ingestion"]:::codeModule
        DV["Data Validation"]:::pipeline
        DVst["Stage 02: Data Validation"]:::codeModule
        DT["Data Transformation"]:::pipeline
        DTst["Stage 03: Data Transformation"]:::codeModule
        MT["Model Trainer"]:::pipeline
        MTst["Stage 04: Model Trainer"]:::codeModule
        ME["Model Evaluation"]:::pipeline
        MEst["Stage 05: Model Evaluation"]:::codeModule
    end
    click DI "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/components/data_ingestion.py"
    click DIst "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/pipeline/stage_01_data_ingestion.py"
    click DV "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/components/data_validation.py"
    click DVst "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/pipeline/stage_02_data_validation.py"
    click DT "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/components/data_transformation.py"
    click DTst "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/pipeline/stage_03_data_transformation.py"
    click MT "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/components/model_trainer.py"
    click MTst "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/pipeline/stage_04_model_trainer.py"
    click ME "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/components/model_evaluation.py"
    click MEst "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/pipeline/stage_05_model_evaluation.py"

    ORG --> DIst --> DVst --> DTst --> MTst --> MEst
    DIst --> DI
    DVst --> DV
    DTst --> DT
    MTst --> MT
    MEst --> ME

    %% MLflow Tracking
    subgraph "MLflow"
        direction TB
        MLFS["Tracking Server"]:::storage
        AS["Artifact Store"]:::storage
        DH["DagsHub (Optional)"]:::external
    end
    MEst -->|logs metrics| MLFS
    MLFS --> AS
    MLFS --> DH

    %% Prediction Pipeline & Web App
    subgraph "Web Application"
        direction TB
        Browser["User Browser"]:::external
        WA["Flask App\n(app.py)"]:::codeModule
        PP["Prediction Pipeline"]:::pipeline
        AS
        MLFS
        subgraph "Templates & Static"
            direction TB
            T1["index.html"]:::codeModule
            T2["results.html"]:::codeModule
            S1["styles.css"]:::codeModule
            S2["style.css"]:::codeModule
            JS["scripts.js"]:::codeModule
            IMG["assets/img"]:::codeModule
        end
    end
    click WA "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/app.py"
    click PP "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/src/mlProject/pipeline/prediction.py"
    click T1 "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/templates/index.html"
    click T2 "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/templates/results.html"
    click S1 "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/static/css/styles.css"
    click S2 "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/static/css2/style.css"
    click JS "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/static/js/scripts.js"
    click IMG "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/tree/main/static/assets/img"

    Browser -->|HTTP:5000| WA
    WA --> PP
    PP -->|fetch model| AS
    PP -->|log request| MLFS

    %% CI/CD & Deployment
    subgraph "CI/CD & Deployment"
        direction TB
        GH["GitHub Actions"]:::ci
        DF["Dockerfile"]:::codeModule
        ECR["AWS ECR"]:::external
        EC2["AWS EC2"]:::external
    end
    click GH "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/blob/main/.github/workflows/main.yaml"
    click DF "https://github.com/entbappy/end-to-end-machine-learning-project-with-mlflow/tree/main/Dockerfile"
    GH --> DF
    DF -->|build & push| ECR
    ECR -->|deploy| EC2

    %% Relationships
    ORG --> MLFS

    %% Styles
    classDef config fill:#FCF3CF,stroke:#F1C40F
    classDef codeModule fill:#D6EAF8,stroke:#2980B9
    classDef pipeline fill:#D1F2EB,stroke:#1ABC9C
    classDef storage fill:#F9E79F,stroke:#B7950B
    classDef external fill:#D5D8DC,stroke:#85929E
    classDef ci fill:#E8DAEF,stroke:#8E44AD
```
