# prayesh13/mlops-mini-project architecture

> Architecture diagram of the GitHub repository prayesh13/mlops-mini-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/prayesh13/mlops-mini-project
- Repository: https://github.com/prayesh13/mlops-mini-project

## Overview

Based on our review of the file tree and README, the project is clearly an MLOps mini-project built around the cookiecutter data science template. It is designed both to develop and experiment with machine learning models (via the src, notebooks, models directories) and also to integrate MLOps tools (such as DVC for data versioning, MLflow for experiment tracking—evidenced by the mlruns folder—and even a simple Flask web app for deployment).

##### Main Components
- Data Layer and Versioning:
– Include DVC (dvc.yaml, dvc.lock, .dvc folder) which ensures reproducibility through data pipelines.
– Represent the raw/intermediate/processed data components as described in the README (even if not explicitly in the file tree, they are implied to follow the cookiecutter structure).
- Source Code for Model Development:
– The src directory is organized into sub-components:
▪ Data Ingestion and Preprocessing (scripts within src/data)
▪ Feature Engineering (in src/features)
▪ Model building, evaluation, and registration (in src/model)
▪ Visualization tools (in src/visualization)
- Experimentation and Notebooks:
– The notebooks directory denotes exploratory experiments, rapid prototyping, and iterational model improvements.
- Model Artifacts and Deployment:
– The models directory holds trained models.
– The mlruns directory (MLflow) for tracking experiments.
– The flask-app directory contains a Flask application (including app.py and a preprocessing utility) that likely serves as an interface for predictions or demonstrations.
- Additional support and tooling:
– Makefile and tox.ini indicate build automation and testing environments.
– setup.py for pip-installable package creation.
– Documentation is maintained in the docs folder.

##### Relationships and Data Flow
– Show how data originates (raw data possibly stored under a conventional “data” structure implied by the README) and is then versioned through DVC pipelines.
- Flow into Preprocessing:
– Represent the pipeline from data ingestion (src/data/data_ingestion.py) into preprocessing (src/data/data_preprocessing.py).
- Feature Engineering to Model Training:
– Illustrate how features are created in the src/features module (feature_engineering.py) before they feed into the model training process (src/model/model_building.py) and evaluation (src/model/model_evaluation.py).
- Model Deployment and Experiment Tracking:
– Include MLflow’s role via the mlruns folder.
– Show the direction of data flow from the trained model to the Flask application (flask-app/app.py) which may serve predictions.
- Notebook and Reporting Components:

##### Architectural Patterns and Design Principles
- Modular Pipeline:
– The project breaks tasks into well-defined modules (data, features, model, visualization) reflecting a pipeline architecture.
- Versioning & Experiment Tracking:
– The integration of DVC and MLflow indicates emphasis on reproducibility and robust experiment management.
- Separation of Concerns:
– The Flask app is isolated from the model training code, suggesting a design that separates production deployment from the experimental/development pipelines.
- Automation:
– Makefile and tox integration reinforce the emphasis on automation in data and model preparation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data & Versioning
    subgraph "Data & Versioning"
        RD["Raw Data (Raw/Intermediate)"]:::data
        DVC_YAML["dvc.yaml"]:::data
        DVC_LOCK["dvc.lock"]:::data
        DVC_FOLDER[".dvc folder"]:::data
        RD --> DVC_YAML
        RD --> DVC_LOCK
        RD --> DVC_FOLDER
    end

    %% Data Processing
    subgraph "Data Processing"
        DIP["Data Ingestion & Preprocessing"]:::data
    end

    %% Feature Engineering
    subgraph "Feature Engineering"
        FE["Feature Engineering"]:::data
    end

    %% Model Execution
    subgraph "Model Execution"
        MB["Model Building"]:::model
        ME["Model Evaluation"]:::model
        MR["Model Registration"]:::model
        MB --> ME
        ME --> MR
    end

    %% Experiment Tracking and Model Artifacts
    subgraph "Experiment & Artifacts"
        MLF["MLflow Tracking"]:::exp
        MA["Model Artifacts"]:::model
    end

    %% Deployment
    subgraph "Deployment"
        FA["Flask App"]:::deploy
    end

    %% Experimentation
    subgraph "Experimentation"
        NB["Notebooks"]:::exp
    end

    %% Supporting & Automation
    subgraph "Supporting & Automation"
        MF["Makefile"]:::support
        TI["tox.ini"]:::support
        SP["setup.py"]:::support
        DC["Docs"]:::support
    end

    %% Data Flow
    RD --> DIP
    DIP --> FE
    FE --> MB
    NB --> MB
    MR --> MA
    ME --> MLF
    MA --> FA

    %% Supporting Tools linking (dashed lines indicate support)
    MF --- DIP
    TI --- DIP
    SP --- DIP
    DC --- DIP

    %% Click Events
    click DVC_YAML "https://github.com/prayesh13/mlops-mini-project/blob/master/dvc.yaml"
    click DVC_LOCK "https://github.com/prayesh13/mlops-mini-project/blob/master/dvc.lock"
    click DVC_FOLDER "https://github.com/prayesh13/mlops-mini-project/blob/master/.dvc"
    click DIP "https://github.com/prayesh13/mlops-mini-project/tree/master/src/data/"
    click FE "https://github.com/prayesh13/mlops-mini-project/tree/master/src/features/"
    click MB "https://github.com/prayesh13/mlops-mini-project/blob/master/src/model/model_building.py"
    click ME "https://github.com/prayesh13/mlops-mini-project/blob/master/src/model/model_evaluation.py"
    click MR "https://github.com/prayesh13/mlops-mini-project/blob/master/src/model/register_model.py"
    click NB "https://github.com/prayesh13/mlops-mini-project/tree/master/notebooks/"
    click MLF "https://github.com/prayesh13/mlops-mini-project/tree/master/mlruns/"
    click MA "https://github.com/prayesh13/mlops-mini-project/tree/master/models/"
    click FA "https://github.com/prayesh13/mlops-mini-project/tree/master/flask-app/"
    click MF "https://github.com/prayesh13/mlops-mini-project/tree/master/Makefile"
    click TI "https://github.com/prayesh13/mlops-mini-project/blob/master/tox.ini"
    click SP "https://github.com/prayesh13/mlops-mini-project/blob/master/setup.py"
    click DC "https://github.com/prayesh13/mlops-mini-project/tree/master/docs/"

    %% Styles
    classDef data fill:#b3e5fc,stroke:#0277bd,stroke-width:2px;
    classDef model fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef exp fill:#fff9c4,stroke:#f9a825,stroke-width:2px;
    classDef deploy fill:#ffccbc,stroke:#d84315,stroke-width:2px;
    classDef support fill:#d1c4e9,stroke:#673ab7,stroke-width:2px;
```
