# erandawi/hotel_reservation_prediction architecture

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

- Interactive diagram: https://gitdiagram.com/erandawi/hotel_reservation_prediction
- Repository: https://github.com/erandawi/hotel_reservation_prediction

## Overview

##### Project type and purpose
- From the file tree and minimal README (“hotel_reservation_prediction”), this is a Python-based full-stack ML application.
- It provides both:
- A model training pipeline (data ingestion → preprocessing → model training → artifact storage)
- A web front-end (Flask app) that serves a UI and uses the trained model to make predictions

##### File structure
- Top-level ML pipeline directories:
- /artifacts — holds raw and processed data plus trained model
- /pipeline — orchestrates the training pipeline (training_pipeline.py)
- /src — core modules (data_ingestion, data_preprocessing, model_training, logger, custom exceptions)
- /config — YAML + Python files with parameters and paths
- Web-app components:
- application.py — Flask app entry point
- /templates + /static — UI (HTML/CSS)
- Supporting files:
- Dockerfile + custom_jenkins/Dockerfile + Jenkinsfile — containerization and CI/CD
- notebook/ — exploratory Jupyter notebook

##### README
- No extra details beyond the project title. We infer architecture from code layout and common ML patterns.

##### Elements
- Clear labels: “Data Ingestion”, “Data Preprocessing”, “Model Training”, “Flask API”, “UI”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Layer
    subgraph "Data Layer"
        RawData["Raw Data"]:::data
        ProcessedData["Processed Data"]:::data
        ModelArtifact["Trained Model File"]:::data
        ModelStore["Model Artifact Store"]:::data
    end

    %% Pipeline Layer
    subgraph "Pipeline Layer"
        PipelineOrch["Training Pipeline Orchestrator"]:::pipeline
        DataIngest["Data Ingestion"]:::pipeline
        DataPrep["Data Preprocessing"]:::pipeline
        ModelTrain["Model Training"]:::pipeline
    end

    %% Configuration Service
    subgraph "Configuration Service"
        ConfigYAML["config.yaml"]:::service
        ConfigModelParams["model_params.py"]:::service
        ConfigPath["path_config.py"]:::service
    end

    %% Service Layer
    subgraph "Service Layer"
        FlaskApp["Flask API"]:::service
    end

    %% Utilities
    subgraph "Utilities"
        Exception["Exception Handling"]:::util
        Logger["Logging Module"]:::util
        Utils["Common Utility Functions"]:::util
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        Index["Index Page"]:::ui
        CSS["Static CSS"]:::ui
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        Jenkins["Jenkinsfile"]:::ci
        DockerBase["Dockerfile"]:::ci
        CustomDocker["custom_jenkins/Dockerfile"]:::ci
        Test1["test_logger.py"]:::ci
        Test2["testing.py"]:::ci
    end

    %% Data Flow
    RawData --> DataIngest
    DataIngest --> ProcessedData
    ProcessedData --> DataPrep
    DataPrep --> ModelTrain
    ModelTrain --> ModelArtifact
    ModelTrain --> ModelStore

    %% Orchestration
    PipelineOrch --> DataIngest
    PipelineOrch --> DataPrep
    PipelineOrch --> ModelTrain

    %% Configuration Injection
    ConfigYAML --> PipelineOrch
    ConfigModelParams --> PipelineOrch
    ConfigPath --> PipelineOrch
    ConfigYAML --> FlaskApp
    ConfigModelParams --> FlaskApp
    ConfigPath --> FlaskApp

    %% Service Integration
    ModelArtifact --> FlaskApp
    Exception --> FlaskApp
    Logger --> FlaskApp
    Utils --> FlaskApp

    %% Presentation Interaction
    Index -->|"HTTP Request"| FlaskApp
    CSS --> Index

    %% CI/CD Integration
    Jenkins --> DockerBase
    Jenkins --> CustomDocker
    Jenkins --> Test1
    Jenkins --> Test2
    DockerBase --> FlaskApp

    %% Click Events
    click RawData "https://github.com/erandawi/hotel_reservation_prediction/tree/main/artifacts/raw"
    click ProcessedData "https://github.com/erandawi/hotel_reservation_prediction/tree/main/artifacts/preprocessed"
    click ModelArtifact "https://github.com/erandawi/hotel_reservation_prediction/blob/main/artifacts/models/lgbm_model.pkl"
    click ModelStore "https://github.com/erandawi/hotel_reservation_prediction/tree/main/artifacts/models"
    click PipelineOrch "https://github.com/erandawi/hotel_reservation_prediction/blob/main/pipeline/training_pipeline.py"
    click DataIngest "https://github.com/erandawi/hotel_reservation_prediction/blob/main/src/data_ingestion.py"
    click DataPrep "https://github.com/erandawi/hotel_reservation_prediction/blob/main/src/data_preprocessing.py"
    click ModelTrain "https://github.com/erandawi/hotel_reservation_prediction/blob/main/src/model_training.py"
    click ConfigYAML "https://github.com/erandawi/hotel_reservation_prediction/blob/main/config/config.yaml"
    click ConfigModelParams "https://github.com/erandawi/hotel_reservation_prediction/blob/main/config/model_params.py"
    click ConfigPath "https://github.com/erandawi/hotel_reservation_prediction/blob/main/config/path_config.py"
    click FlaskApp "https://github.com/erandawi/hotel_reservation_prediction/blob/main/application.py"
    click Index "https://github.com/erandawi/hotel_reservation_prediction/blob/main/templates/index.html"
    click CSS "https://github.com/erandawi/hotel_reservation_prediction/blob/main/static/style.css"
    click Exception "https://github.com/erandawi/hotel_reservation_prediction/blob/main/src/custom_exception.py"
    click Logger "https://github.com/erandawi/hotel_reservation_prediction/blob/main/src/logger.py"
    click Utils "https://github.com/erandawi/hotel_reservation_prediction/blob/main/utils/common_functions.py"
    click DockerBase "https://github.com/erandawi/hotel_reservation_prediction/tree/main/Dockerfile"
    click CustomDocker "https://github.com/erandawi/hotel_reservation_prediction/tree/main/custom_jenkins/Dockerfile"
    click Jenkins "https://github.com/erandawi/hotel_reservation_prediction/tree/main/Jenkinsfile"
    click Test1 "https://github.com/erandawi/hotel_reservation_prediction/blob/main/test_logger.py"
    click Test2 "https://github.com/erandawi/hotel_reservation_prediction/blob/main/testing.py"

    %% Styles
    classDef data fill:#D0E6FF,stroke:#036,stroke-width:1px
    classDef pipeline fill:#DFF2D8,stroke:#080,stroke-width:1px
    classDef service fill:#FFE0CC,stroke:#F50,stroke-width:1px
    classDef ui fill:#FFF7CC,stroke:#CC0,stroke-width:1px
    classDef ci fill:#F0F0F0,stroke:#888,stroke-width:1px
    classDef util fill:#ECECEC,stroke:#555,stroke-width:1px
```
