# dileep8349862878/flight_price_ml_project architecture

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

- Interactive diagram: https://gitdiagram.com/dileep8349862878/flight_price_ml_project
- Repository: https://github.com/dileep8349862878/flight_price_ml_project

## Overview

##### Main Components
- Data Storage: The “Data” directory containing train.csv, test.csv, and val.csv.
- Model Training Module: The “Model_training.ipynb” notebook (and possibly components in the “jupyter” folder) that processes the datasets and produces a model file (model.joblib).
- ML Model: The serialized model (model.joblib) which includes the learned weights and parameters to predict flight prices.
- Web Application Backend: The Python scripts (app.py and form.py) that load the ML model and handle requests.
- Presentation Layer (Frontend): The HTML templates in the “template” folder that render the UI (home, prediction page, layout).
- Dependencies & Configuration: Files like requirements.txt (defining libraries to be used) and configuration files such as .gitignore.

##### Relationships and Interactions
- Data flows from the “Data” directory into the training phase via “Model_training.ipynb”, resulting in the model file.
- The Web Application (app.py) uses the model.joblib (loaded into memory) to process input data from users.
- User form inputs are managed by form.py, possibly including input validation, before being passed to the prediction function.
- The results from the prediction process are rendered using HTML templates, forming the connection to the UI.
- The overall flow: Data → Model Training → Model Output → Web App (Backend) → Form Handling → UI Rendering.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Distinct roles for data handling/training versus serving predictions (i.e., ML model is trained independently, and the web app is focused on user interaction and prediction).
- MVC-like Approach: Although a full MVC isn’t strictly implemented, you have separate components for "business logic" (the Python code handling predictions) and "presentation" (HTML templates).
- Use of Serialization: The ML model is saved using joblib, encapsulating the training phase from runtime inference.
- Loose Coupling: By separating training/notebook exploration (jupyter folder and Model_training.ipynb) from the production code (app.py, form.py, and templates), you make the system more maintainable.

##### Relevant Technologies and Frameworks
- Python (for backend and training components)
- Flask or a similar lightweight web framework (suggested by the presence of app.py and the “template” folder with HTML files)
- Joblib (for model serialization)
- Jupyter notebooks (for data exploration and model training)
- Pandas, scikit-learn, etc. (likely present as dependencies inside requirements.txt)

## Diagram (Mermaid)

```mermaid
graph TD
    %% Nodes
    User["User"]:::user

    subgraph "Data Layer"
        DataFolder["Data Storage\n(train.csv, test.csv, val.csv)"]:::data
    end

    subgraph "ML Training Layer"
        Notebook["Model_training.ipynb"]:::training
        Jupyter["jupyter/"]:::training
    end

    subgraph "Model Serving Layer"
        ModelFile["model.joblib"]:::model
    end

    subgraph "Web Application Backend"
        App["app.py"]:::backend
        Form["form.py"]:::backend
    end

    subgraph "Presentation Layer"
        Templates["HTML Templates\n(home.html, layout.html, predict.html)"]:::frontend
    end

    subgraph "Dependencies & Config"
        Req["requirements.txt"]:::deps
        Gitignore[".gitignore"]:::deps
    end

    %% Data flow arrows
    DataFolder -->|"ProvidesData"| Notebook
    DataFolder -->|"ProvidesData"| Jupyter

    Notebook -->|"TrainsModel"| ModelFile
    Jupyter -->|"SupportsTraining"| ModelFile

    User -->|"submits_request"| Form
    Form -->|"handles_input"| App
    ModelFile -->|"loaded_by"| App
    App -->|"renders_output"| Templates
    Templates -->|"displays_to"| User

    %% Click Events
    click DataFolder "https://github.com/dileep8349862878/flight_price_ml_project/tree/master/Data/"
    click Notebook "https://github.com/dileep8349862878/flight_price_ml_project/blob/master/Model_training.ipynb"
    click Jupyter "https://github.com/dileep8349862878/flight_price_ml_project/tree/master/jupyter/"
    click ModelFile "https://github.com/dileep8349862878/flight_price_ml_project/blob/master/model.joblib"
    click App "https://github.com/dileep8349862878/flight_price_ml_project/blob/master/app.py"
    click Form "https://github.com/dileep8349862878/flight_price_ml_project/blob/master/form.py"
    click Templates "https://github.com/dileep8349862878/flight_price_ml_project/tree/master/template/"
    click Req "https://github.com/dileep8349862878/flight_price_ml_project/blob/master/requirements.txt"
    click Gitignore "https://github.com/dileep8349862878/flight_price_ml_project/blob/master/.gitignore"

    %% Styles
    classDef data fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef training fill:#90ee90,stroke:#000,stroke-width:2px;
    classDef model fill:#ffff99,stroke:#000,stroke-width:2px;
    classDef backend fill:#ffa500,stroke:#000,stroke-width:2px;
    classDef frontend fill:#ffccff,stroke:#000,stroke-width:2px;
    classDef deps fill:#d3d3d3,stroke:#000,stroke-width:2px;
    classDef user fill:#dda0dd,stroke:#000,stroke-width:2px;
```
