# helloharun/car-price-prediction-using-linear-regression architecture

> Architecture diagram of the GitHub repository helloharun/car-price-prediction-using-linear-regression, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/helloharun/car-price-prediction-using-linear-regression
- Repository: https://github.com/helloharun/car-price-prediction-using-linear-regression

## Overview

##### Main system components
- Backend Web Service:
- Contains the machine learning model (best_model.joblib) along with its scaler (scaler.joblib) and additional dataset details (car_details.csv).
- Runs the Flask-based API (as indicated in ml_server.ipynb) which exposes the following endpoints:
▪ GET /sample_request (sample_request.py)
▪ GET /parameters_explanation (parameters_explanation.py)
▪ POST /home (home.py)
- Also may include auxiliary scripts and exploration notebooks (like main_models.ipynb) for model development and testing.

- Frontend Client:
- Implemented via Streamlit (client_app.py located in st_clients), which allows users to interact with the API by sending data and receiving predictions.
- Additional scripts in st_clients (like about_me.py) support supplementary information pages or client-side logic.

##### Important architectural patterns and technologies
- Clearly label that the backend is powered by Python, Flask and Scikit-learn. Indicate data manipulation handled by Pandas.
- Denote that Streamlit is used for the frontend rendering.
- Mention the use of joblib for model persistence.
- RESTful API design, which follows conventional endpoint structures.

##### Final advice
- Every component is clearly labeled to reflect its role. For instance, note which endpoints perform GET vs. POST operations, and ensure that the data flows (request/response cycle) are easy to follow.
- How the ML model is integrated into the RESTful API, which is then consumed by the client app.
- Don’t hesitate to include annotations explaining that the notebooks represent development artifacts rather than runtime components, but they are crucial for understanding the model’s training process.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Backend Components
    subgraph "Backend"
        subgraph "RESTful API Server"
            APIA["GET /sample_request"]:::endpoint
            APIB["GET /parameters_explanation"]:::endpoint
            APIC["POST /home (Predict)"]:::endpoint
        end
        subgraph "ML Model"
            ML1["best_model.joblib"]:::model
            ML2["scaler.joblib"]:::model
        end
        DS["Dataset (car_details.csv)"]:::dataset
    end

    %% Development / Model Training Artifacts
    subgraph "Development / Model Training"
        N1["ml_server.ipynb"]:::notebook
        N2["main_models.ipynb"]:::notebook
    end

    %% Frontend Components
    subgraph "Frontend"
        FE["Streamlit Client Application"]:::client
        FE2["Supplementary Info (about_me.py)"]:::client
    end

    %% Interactions
    FE -->|"GET_request"| APIA
    FE -->|"GET_request"| APIB
    FE -->|"POST_carData"| APIC
    APIC -->|"Returns_prediction"| FE

    %% API using ML model components
    APIC -->|"Invokes_model"| ML1
    APIC -->|"Invokes_scaler"| ML2
    DS -->|"Training_data"| ML1

    %% Development influences model training
    N1 -->|"Trains_model"| ML1
    N2 -->|"Explores_model"| ML1

    %% Styles
    classDef endpoint fill:#FFEEAD,stroke:#333,stroke-width:2px;
    classDef model fill:#C1E1C1,stroke:#333,stroke-width:2px;
    classDef dataset fill:#F6CBC7,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5;
    classDef notebook fill:#D1E8FF,stroke:#333,stroke-width:2px;
    classDef client fill:#FFE4C4,stroke:#333,stroke-width:2px;

    %% Click Events
    click APIA "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/st_clients/sample_request.py"
    click APIB "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/st_clients/parameters_explanation.py"
    click APIC "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/st_clients/home.py"
    click ML1 "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/best_model.joblib"
    click ML2 "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/scaler.joblib"
    click DS "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/car_details.csv"
    click N1 "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/ml_server.ipynb"
    click N2 "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/main_models.ipynb"
    click FE "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/st_clients/client_app.py"
    click FE2 "https://github.com/helloharun/car-price-prediction-using-linear-regression/blob/main/st_clients/about_me.py"
```
