# rohitkrish46/vroom-value architecture

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

- Interactive diagram: https://gitdiagram.com/rohitkrish46/vroom-value
- Repository: https://github.com/rohitkrish46/vroom-value

## Overview

##### Main Components
- Web Client: Represents the end-user’s browser where HTML pages get rendered. This corresponds to the files in the “templates” directory (carprice.html, home.html, index.html, predict.html, result.html) and styling from “static/styles.css”.
- Flask Web Server (app.py): This is the backbone of the web application and the entry point for all HTTP requests. It handles routing, form submissions, and rendering templates.
- Machine Learning Inference Module: This component encompasses the pre-trained model (model.pkl) and the preprocessor (preprocessor.pkl) stored under the “models” directory. They are used to generate predictions after processing user input.
- Data Analysis & Experimentation (Notebooks): Although not part of the production path, the “notebooks” folder contains notebooks (EDA.ipynb, Feature_engineering.ipynb) that were used for data exploration and feature engineering, which inform the design of the ML model.
- Optional: External libraries and frameworks like Scikit-learn, Pandas, Numpy, Matplotlib, and Seaborn (as seen in the README) that support the ML and visualization aspects.

##### Relationships & Data Flow
- Flask Server (app.py): The server processes incoming requests. It routes the request to the appropriate endpoint (e.g., home, predict, result). During the prediction process, the server:
– Loads the necessary model and preprocessor if not loaded already.
– Applies preprocessing to the input data.
– Runs the machine learning inference using the selected regression model.
- Response Flow: Once the prediction is generated, it's returned by the Flask application, and the appropriate HTML template is rendered for the user (such as the result page).
- Notebooks in the “notebooks” directory represent offline processes used during the development and benchmarking of various regression models. They have informed the design and tuning of the ML inference component.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The web frontend (HTML/CSS) is decoupled from the backend logic (Flask in app.py) and the machine learning components (models folder). Each part is clearly defined.
- Modularity: The use of pre-saved models (pickle files) suggests that the inference module is designed to be isolated—allowing independent updates or changes without affecting the Flask application’s routing.
- Simplicity: The directory structure shows an uncomplicated, monolithic web application (as opposed to a microservices architecture) making your component boundaries straightforward.

##### Relevant Technologies
- Python and Flask for the web server.
- Scikit-learn for machine learning.
- Pandas, Numpy for data handling.
- Matplotlib, Seaborn for any visualization (primarily used during the data science phase).
- HTML/CSS for client-side rendering.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        WC["Web Client (Browser)"]:::frontend
        T["Templates (HTML)"]:::frontend
        S["Static Assets (CSS)"]:::frontend
        T -.-> WC
        S -.-> WC
    end

    %% Backend Layer
    subgraph "Backend Layer"
        B["Flask Server (app.py)"]:::backend
        WC -->|"HTTP Request"| B
        subgraph "ML Inference Module"
            M["Model (model.pkl)"]:::backend
            P["Preprocessor (preprocessor.pkl)"]:::backend
        end
        B -->|"Load&Predict"| M
        B -->|"Preprocess"| P
        M -->|"Prediction_Result"| B
        P -->|"Prediction_Result"| B
        B -->|"Response_HTML"| WC
    end

    %% Development Artifacts
    subgraph "Data Analysis & Experimentation"
        N1["EDA.ipynb"]:::dev
        N2["Feature_engineering.ipynb"]:::dev
    end
    N1 -->|"Informs_Design"| M
    N1 -->|"Informs_Design"| P
    N2 -->|"Informs_Design"| M
    N2 -->|"Informs_Design"| P

    %% Click Events
    click T "https://github.com/rohitkrish46/vroom-value/tree/main/templates"
    click S "https://github.com/rohitkrish46/vroom-value/blob/main/static/styles.css"
    click B "https://github.com/rohitkrish46/vroom-value/blob/main/app.py"
    click M "https://github.com/rohitkrish46/vroom-value/blob/main/models/model.pkl"
    click P "https://github.com/rohitkrish46/vroom-value/blob/main/models/preprocessor.pkl"
    click N1 "https://github.com/rohitkrish46/vroom-value/blob/main/notebooks/EDA.ipynb"
    click N2 "https://github.com/rohitkrish46/vroom-value/blob/main/notebooks/Feature_engineering.ipynb"

    %% Styles
    classDef frontend fill:#b3cde0,stroke:#03396c,stroke-width:2px;
    classDef backend fill:#fbb4ae,stroke:#c51b7d,stroke-width:2px;
    classDef dev fill:#ccebc5,stroke:#006400,stroke-width:2px;
```
