# tejask28/2025_f1_predictions architecture

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

- Interactive diagram: https://gitdiagram.com/tejask28/2025_f1_predictions
- Repository: https://github.com/tejask28/2025_f1_predictions

## Overview

##### Main Components
a. Data Sources: Represent the external inputs, including:
- FastF1 API (for historical lap times, race results, telemetry data).
- 2025 Qualifying Session Data.
- Historical F1 race results (used for model training based on 2024 data).
b. Data Collection and Preprocessing:
- Data ingestion scripts/steps that fetch data from these sources.
- Preprocessing routines that transform raw data by converting lap times, normalizing driver names, and other feature engineering tasks.
c. Model Training:
- The Gradient Boosting Machine Learning pipeline that uses the preprocessed data (primarily from 2024 results).
- This component should also reflect the evaluation method (Mean Absolute Error – MAE) used to measure model performance.
d. Prediction and Output:
- The individual Python scripts (prediction1.py, prediction2.py, etc.) that serve as entry points to run the model and output predictions for each race.
- The generation of results such as predicted race times and ranking of drivers.
e. Future Extensions (optional, as indicated in the README):
- Components for integrating additional features like weather conditions, pit stop strategies, or even deep learning model trials.

##### Highlighting Architectural Patterns and Technologies
- Clear linear pipeline: Data Collection → Preprocessing → Model Training → Prediction & Evaluation.
- Although the file structure is flat, conceptually the scripts adhere to a pipeline pattern where components have sequential data flow.

##### Final Touches
- Components are clearly labeled with descriptive names.
- Potential future extensions (like integration of weather data) to show how the design can scale.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Sources"
        A1("FastF1 API"):::datasource
        A2("Qualifying Data (2025)"):::datasource
        A3("Historical Results (2024)"):::datasource
    end

    B("Data Collection & Preprocessing"):::preprocessing

    C("Model Training<br/>(Gradient Boosting Regressor,<br/>trained on 2024 data)"):::training

    D("Prediction & Evaluation<br/>(MAE metric)"):::prediction

    subgraph "Prediction Scripts"
        P1("prediction1.py"):::script
        P2("prediction2.py"):::script
        P3("prediction2_nochange.py"):::script
        P4("prediction2_olddrivers.py"):::script
    end

    A1 -->|"data_ingestion"| B
    A2 -->|"session_ingestion"| B
    A3 -->|"historical_ingestion"| B
    B -->|"feature_transformation"| C
    C -->|"model_deployment"| D
    D -->|"runs_prediction"| P1
    D -->|"runs_prediction"| P2
    D -->|"runs_prediction"| P3
    D -->|"runs_prediction"| P4

    click P1 "https://github.com/tejask28/2025_f1_predictions/blob/main/prediction1.py"
    click P2 "https://github.com/tejask28/2025_f1_predictions/blob/main/prediction2.py"
    click P3 "https://github.com/tejask28/2025_f1_predictions/blob/main/prediction2_nochange.py"
    click P4 "https://github.com/tejask28/2025_f1_predictions/blob/main/prediction2_olddrivers.py"

    classDef datasource fill:#ffcccb,stroke:#000,stroke-width:2px;
    classDef preprocessing fill:#ffe6cc,stroke:#000,stroke-width:2px;
    classDef training fill:#ccffcc,stroke:#000,stroke-width:2px;
    classDef prediction fill:#cce5ff,stroke:#000,stroke-width:2px;
    classDef script fill:#d9d2e9,stroke:#000,stroke-width:2px;
```
