# ayushigupta9723/swiggy-food-delivery-time-prediction architecture

> Architecture diagram of the GitHub repository ayushigupta9723/swiggy-food-delivery-time-prediction, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayushigupta9723/swiggy-food-delivery-time-prediction
- Repository: https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction

## Overview

##### Project type and purpose
- This is a full end-to-end Machine Learning plus MLOps project (“Swiggy Delivery Time Prediction”) that ingests raw data, processes it, trains multiple models, tracks experiments, registers a best model, packages the inference API in Docker, and deploys it on AWS EC2 via a CI/CD pipeline.

##### File structure
- Top-level:
- data/ (raw → processing with DVC)
- src/ (modular ML pipeline code: data_cleaning, data_preparation, features, train, evaluation, register_model)
- notebooks/ (EDA & experimentation)
- models/ (persisted artifacts)
- reports/ (metrics & figures)
- Scripts/ (utility scripts, e.g., promote_model_to_prod.py)
- app.py (Flask/FastAPI service for inference)
- dvc.yaml & dvc.lock (DVC pipeline stages)
- .github/workflows/ci_cd.yaml (GitHub Actions CI/CD)
- Dockerfile (container definition)
- requirements.txt, setup.py
- tests/ & test_environment.py (unit/integration tests)

##### README for additional insights
- It describes the DVC pipeline stages (Preprocess, Feature Engg, Train, Evaluate, Registry), MLflow + DagsHub tracking, GitHub Actions automated workflow (install, DVC pull, dvc repro, pytest, promote model, build & push Docker, deploy on EC2).
- It lists the end-to-end flow from data collection to deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Version Control & CI/CD
    subgraph "Version Control & CI/CD"
        GitHubRepo["GitHub Repository"]:::pipeline
        CI_CD["GitHub Actions CI/CD"]:::pipeline
    end

    %% Data Versioning & Storage
    subgraph "Data Versioning & Storage"
        DVCYaml["dvc.yaml"]:::data
        DVCLock["dvc.lock"]:::data
        DataRaw["data/raw/"]:::data
        DVCRemote["DVC Remote Storage (S3/DagsHub)"]:::external
    end

    %% ML Pipeline Stages
    subgraph "ML Pipeline (DVC Stages)"
        Preprocess["Preprocess Stage"]:::pipeline
        FeatureEng["Feature Engineering Stage"]:::pipeline
        TrainStage["Training Stage"]:::pipeline
        EvalStage["Evaluation Stage"]:::pipeline
        RegisterStage["Model Registration Stage"]:::pipeline
    end

    %% Experiment Tracking & Registry
    subgraph "Experiment Tracking & Registry"
        MLflowServer["MLflow Tracking Server"]:::registry
        DagsHub["DagsHub Backend"]:::external
        ModelRegistry["MLflow Model Registry"]:::registry
    end

    %% Artifacts & Reports
    subgraph "Artifacts & Reports"
        ModelArtifacts["models/"]:::data
        Reports["reports/"]:::data
    end

    %% Deployment & Serving
    subgraph "Deployment & Serving"
        DockerBuild["Docker Build & Push"]:::deploy
        ECR["AWS ECR"]:::external
        EC2["AWS EC2"]:::external
        AppAPI["Inference Service (app.py)"]:::deploy
        Users["Users/Clients"]:::external
    end

    %% Utility & Tests
    subgraph "Utility Scripts & Tests"
        PromoteScript["promote_model_to_prod.py"]:::pipeline
        DataCleanUtils["data_clean_utils.py"]:::pipeline
        UnitTests["tests/"]:::pipeline
        TestEnv["test_environment.py"]:::pipeline
        RegistryTests["tests/model_registry.py"]:::pipeline
    end

    %% Documentation & Config
    subgraph "Documentation & Config"
        Notebooks["notebooks/"]:::external
        Docs["docs/"]:::external
        Readme["README.md"]:::external
        MakefileNode["Makefile"]:::pipeline
        Params["params.yaml"]:::data
        ReqTxt["requirements.txt"]:::pipeline
        Setup["setup.py"]:::pipeline
        DockerfileNode["Dockerfile"]:::deploy
    end

    %% Connections
    GitHubRepo -->|push code| CI_CD
    CI_CD -->|use dvc pull| DVCYaml
    CI_CD -->|use dvc pull| DVCLock
    CI_CD -->|runs dvc repro| Preprocess
    Preprocess -->|runs| FeatureEng
    FeatureEng -->|runs| TrainStage
    TrainStage -->|runs| EvalStage
    EvalStage -->|runs| RegisterStage
    DVCYaml --> Preprocess
    DVCLock --> Preprocess
    DataRaw --> Preprocess
    RegisterStage -->|logs| MLflowServer
    MLflowServer -->|stores| ModelRegistry
    MLflowServer -->|uses backend| DagsHub
    RegisterStage --> ModelArtifacts
    EvalStage --> Reports

    CI_CD -->|run tests| UnitTests
    CI_CD -->|run tests| TestEnv
    CI_CD -->|run tests| RegistryTests
    CI_CD -->|invoke| PromoteScript
    PromoteScript --> RegisterStage

    CI_CD -->|build & push| DockerBuild
    DockerBuild --> ECR
    ECR --> EC2
    EC2 --> AppAPI
    AppAPI -->|loads prod model| ModelRegistry
    Users -->|HTTP request| EC2
    AppAPI -->|response| Users

    %% Click Events
    click CI_CD "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/.github/workflows/ci_cd.yaml"
    click DVCYaml "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/dvc.yaml"
    click DVCLock "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/dvc.lock"
    click DataRaw "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/data/raw/"
    click Preprocess "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/src/data/data_cleaning.py"
    click FeatureEng "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/src/features/data_preprocessing.py"
    click TrainStage "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/src/models/train.py"
    click EvalStage "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/src/models/evaluation.py"
    click RegisterStage "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/src/models/register_model.py"
    click RegistryTests "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/tests/model_registry.py"
    click ModelArtifacts "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/models/"
    click Reports "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/reports/"
    click AppAPI "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/app.py"
    click DockerfileNode "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/Dockerfile"
    click ReqTxt "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/requirements.txt"
    click Setup "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/setup.py"
    click PromoteScript "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/Scripts/promote_model_to_prod.py"
    click DataCleanUtils "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/Scripts/data_clean_utils.py"
    click UnitTests "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/tests/"
    click TestEnv "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/test_environment.py"
    click Notebooks "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/notebooks/"
    click Docs "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/docs/"
    click Readme "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/README.md"
    click MakefileNode "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/tree/main/Makefile"
    click Params "https://github.com/ayushigupta9723/swiggy-food-delivery-time-prediction/blob/main/params.yaml"

    %% Styles
    classDef pipeline fill:#AED6F1,stroke:#1B4F72,color:#1B2631
    classDef data fill:#A9DFBF,stroke:#1D8348,color:#1B2631
    classDef registry fill:#F9E79F,stroke:#B7950B,color:#1B2631
    classDef deploy fill:#D2B4DE,stroke:#884EA0,color:#1B2631
    classDef external fill:#E5E7E9,stroke:#566573,color:#1B2631
```
