# m4nu7/fsdsregressionproject architecture

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

- Interactive diagram: https://gitdiagram.com/m4nu7/fsdsregressionproject
- Repository: https://github.com/m4nu7/fsdsregressionproject

## Overview

##### Project type and purpose
- This is an end-to-end machine-learning application with two main use cases:
a. Training a model from raw data (via a training pipeline in `src/pipeline/training_pipeline.py` and Jupyter notebooks)
b. Serving predictions through a simple web interface (Flask app in `application.py` with HTML templates).
- It also includes CI/CD (GitHub Actions), containerization (Dockerfile), and AWS Elastic Beanstalk deployment (`.ebextensions`).

##### File structure
- Top-level:
- `application.py` – Flask entrypoint for prediction service
- `src/` – core Python code
– `components/` – building blocks: data_ingestion, data_transformation, model_trainer
– `pipeline/` – orchestration: training vs. prediction pipelines
– `utils.py`, `logger.py`, `exception.py` – shared helpers
- `artifacts/` – stored data and serialized objects (`raw.csv`, `train.csv`, `test.csv`, `model.pkl`, `preprocessor.pkl`)
- `notebooks/` – exploratory data analysis & model-training experiments
- `templates/` – front-end HTML for input form and results
- `Dockerfile` + `.ebextensions/` – container build and AWS deployment
- `.github/workflows/main.yaml` – CI pipeline definition
- `requirements.txt`, `setup.py` – dependencies & packaging

##### README
- Minimal instructions for environment setup
- Confirms Python 3.8, pip dependencies, conda environment

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Model Serving Layer
    subgraph "Model Serving"
        UI["User Interface (Browser)"]:::infra
        App["Web Server (Flask App)"]:::code
        Pred["Prediction Pipeline"]:::code
        Artifacts["Model & Preprocessor Artifacts"]:::data
    end

    %% Model Development Layer
    subgraph "Model Development"
        TP["Training Pipeline"]:::code
        subgraph "Components"
            DI["Data Ingestion"]:::code
            DT["Data Transformation"]:::code
            MT["Model Trainer"]:::code
        end
        Raw["raw.csv"]:::data
        TrainCSV["train.csv"]:::data
        TestCSV["test.csv"]:::data
        Model["model.pkl"]:::data
        Preproc["preprocessor.pkl"]:::data
    end

    %% Notebook Environment
    subgraph "Notebook Environment"
        EDA["EDA Notebook"]:::code
        MTE["Model Training Notebook"]:::code
        Gem["gemstone.csv"]:::data
    end

    %% Infrastructure
    subgraph "Infrastructure"
        CICD["CI/CD Pipeline"]:::infra
        Docker["Docker Container"]:::infra
        EB["AWS Elastic Beanstalk"]:::infra
    end

    %% Data and Control Flows
    UI -->|"HTTP POST"| App
    App -->|"calls"| Pred
    Pred -->|"loads"| Artifacts
    App -->|"returns prediction"| UI

    Raw --> DI --> DT --> MT
    MT -->|outputs| TrainCSV
    MT -->|outputs| TestCSV
    MT -->|outputs| Model
    MT -->|outputs| Preproc

    EDA -->|"triggers"| TP
    MTE -->|"triggers"| TP
    Gem --> EDA
    Gem --> MTE

    CICD -->|"builds image"| Docker
    Docker -->|"deploys"| EB
    CICD -->|"deploys to"| EB
    EB -->|"hosts"| App

    %% Click Events
    click UI "https://github.com/m4nu7/fsdsregressionproject/blob/main/templates/index.html"
    click UI "https://github.com/m4nu7/fsdsregressionproject/blob/main/templates/form.html"
    click UI "https://github.com/m4nu7/fsdsregressionproject/blob/main/templates/results.html"
    click App "https://github.com/m4nu7/fsdsregressionproject/blob/main/application.py"
    click Pred "https://github.com/m4nu7/fsdsregressionproject/blob/main/src/pipeline/prediction_pipeline.py"
    click TP "https://github.com/m4nu7/fsdsregressionproject/blob/main/src/pipeline/training_pipeline.py"
    click DI "https://github.com/m4nu7/fsdsregressionproject/blob/main/src/components/data_ingestion.py"
    click DT "https://github.com/m4nu7/fsdsregressionproject/blob/main/src/components/data_transformation.py"
    click MT "https://github.com/m4nu7/fsdsregressionproject/blob/main/src/components/model_trainer.py"
    click Raw "https://github.com/m4nu7/fsdsregressionproject/blob/main/artifacts/raw.csv"
    click TrainCSV "https://github.com/m4nu7/fsdsregressionproject/blob/main/artifacts/train.csv"
    click TestCSV "https://github.com/m4nu7/fsdsregressionproject/blob/main/artifacts/test.csv"
    click Model "https://github.com/m4nu7/fsdsregressionproject/blob/main/artifacts/model.pkl"
    click Preproc "https://github.com/m4nu7/fsdsregressionproject/blob/main/artifacts/preprocessor.pkl"
    click EDA "https://github.com/m4nu7/fsdsregressionproject/blob/main/notebooks/EDA.ipynb"
    click MTE "https://github.com/m4nu7/fsdsregressionproject/blob/main/notebooks/Model_Training.ipynb"
    click Gem "https://github.com/m4nu7/fsdsregressionproject/blob/main/notebooks/data/gemstone.csv"
    click CICD "https://github.com/m4nu7/fsdsregressionproject/blob/main/.github/workflows/main.yaml"
    click Docker "https://github.com/m4nu7/fsdsregressionproject/tree/main/Dockerfile"
    click EB "https://github.com/m4nu7/fsdsregressionproject/blob/main/.ebextensions/python.config"

    %% Styles
    classDef code fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef data fill:#90EE90,stroke:#000,stroke-width:1px
    classDef infra fill:#FFA500,stroke:#000,stroke-width:1px
```
