An app that predicts F1 season standings and race outcomes using historical and live data.
- Predict race outcomes based on historical performance data for both drivers and teams.
- Fetch race data for specific years and Grand Prix events, including lap times, qualifying results, weather conditions, and more.
- Analyze driver trends and performance across multiple races in a season.
- Retrieve season standings and historical data for a detailed view of performance.
- Python 3.9+
- Virtual environment (
venv
) setup - Installed dependencies:
fastapi
uvicorn
fastf1
pytest
(for testing)
- Clone the repository:
git clone https://github.com/your-username/f1-season-predictor.git cd f1-season-predictor
- Set up the virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install the dependencies:
pip install -r requirements.txt
4.Run the app:
uvicorn app.main:app --reload
The app will be running on http://127.0.0.1:8000.
For detailed documentation and usage, please refer to the API documentation at /docs
on the local server.
When making requests to the endpoints that require specifying a driver (e.g., for performance data, trends, etc.), you should use the driver's abbreviation as the driver name.
- VER - Max Verstappen
- HAM - Lewis Hamilton
- SAI - Carlos Sainz
- LEC - Charles Leclerc
- ALO - Fernando Alonso
- PER - Sergio Perez
These abbreviations can be used to query specific data for each driver. For example:
- To get Max Verstappen's performance for the Monaco GP in 2023, use
/prediction/driver-performance/2023/Monaco/VER
- To get the trends for Lewis Hamilton in 2023, use
/prediction/driver-trends/2023/HAM
You can find the full list of driver abbreviations on the official F1 website or other resources that provide current driver lists.
To run the tests for this app, follow these steps:
-
Ensure that the virtual environment is activated:
source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required testing dependencies if you haven't already:
pip install -r requirements.txt
-
Run the tests using pytests:
pytest