### Run Initial Project Setup Source: https://github.com/jolpica/jolpica-f1/blob/main/CONTRIBUTING.md Execute this command to set up Python dependencies and pre-commit hooks. If not using the devcontainer, ensure uv is installed and the virtual environment is activated. ```bash make setup ``` -------------------------------- ### Install jolpica-schemas Source: https://github.com/jolpica/jolpica-f1/blob/main/libraries/jolpica-schemas/README.md Install the package using uv sync from the root project dependencies. ```bash uv sync ``` -------------------------------- ### Get Constructors by Grid Position Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/constructors.md Filters for constructors which had a driver racing for them start a race in a specific grid position. ```APIDOC ## GET /ergast/f1/grid/{gridPosition}/constructors/ ### Description Filters for constructors which had a driver racing for them start a race in a specific grid position. ### Method GET ### Endpoint `/ergast/f1/grid/{gridPosition}/constructors/` ### Parameters #### Path Parameters - **gridPosition** (String/Number) - Required - The grid position (e.g., '1'). ### Response #### Success Response (200) - **MRData.ConstructorTable.Constructors** (Array) - The list of constructors whose drivers started in the specified grid position. ``` -------------------------------- ### Get Constructors by Driver Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/constructors.md Filters for constructors that had a specific driver race for them. ```APIDOC ## GET /ergast/f1/drivers/{driverId}/constructors/ ### Description Filters for constructors that had a specific driver race for them. ### Method GET ### Endpoint `/ergast/f1/drivers/{driverId}/constructors/` ### Parameters #### Path Parameters - **driverId** (String) - Required - The ID of the driver (e.g., 'hamilton'). ### Response #### Success Response (200) - **MRData.ConstructorTable.Constructors** (Array) - The list of constructors associated with the specified driver. ``` -------------------------------- ### Get Max Verstappen's Laps in 2021 Abu Dhabi GP Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/laps.md This example shows how to retrieve all lap data for a specific driver in a particular race. The response is in JSON format and includes details for each lap. ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/2021/22/drivers/max_verstappen/laps/", "limit": "30", "offset": "0", "total": "58", "RaceTable": { "season": "2021", "round": "22", "driverId": "max_verstappen", "Races": [ { "season": "2021", "round": "22", "url": "http://en.wikipedia.org/wiki/2021_Abu_Dhabi_Grand_Prix", "raceName": "Abu Dhabi Grand Prix", "Circuit": { "circuitId": "yas_marina", "url": "http://en.wikipedia.org/wiki/Yas_Marina_Circuit", "circuitName": "Yas Marina Circuit", "Location": { "lat": "24.4672", "long": "54.6031", "locality": "Abu Dhabi", "country": "UAE" } }, "date": "2021-12-12", "time": "13:00:00Z", "Laps": [ { "number": "1", "Timings": [ { "driverId": "max_verstappen", "position": "2", "time": "1:32.800" } ] }, { "number": "2", "Timings": [ { "driverId": "max_verstappen", "position": "2", "time": "1:29.103" } ] }, { "number": "3", "Timings": [ { "driverId": "max_verstappen", "position": "2", "time": "1:28.827" } ] }, { "number": "4", "Timings": [ { "driverId": "max_verstappen", "position": "2", "time": "1:29.026" } ] }, ... ] } ] } } } ``` -------------------------------- ### Get circuits by constructor Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/circuits.md Filters for circuits that the specified constructor has participated in a race at. ```APIDOC ## GET /ergast/f1/constructors/{constructorId}/circuits/ ### Description Filters for only circuits that the specified constructor has participated in a race at. ### Method GET ### Endpoint `/ergast/f1/constructors/{constructorId}/circuits/` ### Parameters #### Path Parameters - **constructorId** (String) - Required - The ID of the constructor. ### Response #### Success Response (200 OK) - **MRData.CircuitTable.Circuits** (Array) - The list of circuits the constructor has participated in. ### Request Example `/ergast/f1/constructors/williams/circuits/` ``` -------------------------------- ### Get Constructors by Circuit Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/constructors.md Filters for constructors who have participated in a race at a given circuit. ```APIDOC ## GET /ergast/f1/circuits/{circuitId}/constructors/ ### Description Filters for constructors who have participated in a race at a given circuit. ### Method GET ### Endpoint `/ergast/f1/circuits/{circuitId}/constructors/` ### Parameters #### Path Parameters - **circuitId** (String) - Required - The ID of the circuit (e.g., 'bahrain'). ### Response #### Success Response (200) - **MRData.ConstructorTable.Constructors** (Array) - The list of constructors that participated in the specified circuit. ``` -------------------------------- ### Get drivers by Constructor Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/drivers.md Filters drivers to include only those who have raced for a specified constructor. ```APIDOC ## GET /ergast/f1/constructors/{constructorId}/drivers/ ### Description Filters for only drivers who have raced for a specified constructor. ### Method GET ### Endpoint `/ergast/f1/constructors/{constructorId}/drivers/` ### Parameters #### Path Parameters - **constructorId** (String) - Required - The ID of the constructor (e.g., `williams`). ### Response #### Success Response (200 OK) - **MRData.DriverTable.Drivers** (Array) - The list of drivers for the specified constructor. ### Request Example `https://api.jolpi.ca/ergast/f1/constructors/williams/drivers/` ``` -------------------------------- ### Get Seasons by Constructor Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/seasons.md Retrieves a list of seasons featuring a specified constructor. ```APIDOC ## GET /ergast/f1/constructors/{constructorId}/seasons/ ### Description Filters for only seasons featuring a specified constructor. ### Method GET ### Endpoint /ergast/f1/constructors/{constructorId}/seasons/ ### Parameters #### Path Parameters - **constructorId** (string) - Required - The ID of the constructor (e.g., 'alfa', 'williams'). ### Response #### Success Response (200 OK) - **MRData.SeasonTable.Seasons** (Array) - The list of seasons featuring the specified constructor. ### Request Example `https://api.jolpi.ca/ergast/f1/constructors/alfa/seasons/` ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/constructors/alfa/seasons/", "limit": "30", "offset": "0", "total": "16", "SeasonTable": { "constructorId": "alfa", "Seasons": [ { "season": "1950", "url": "http://en.wikipedia.org/wiki/1950_Formula_One_season" }, { "season": "1951", "url": "http://en.wikipedia.org/wiki/1951_Formula_One_season" }, { "season": "1963", "url": "http://en.wikipedia.org/wiki/1963_Formula_One_season" }, { "season": "1965", "url": "http://en.wikipedia.org/wiki/1965_Formula_One_season" }, ...more ] } } } ``` ``` -------------------------------- ### Get Constructors by Status Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/constructors.md Filters for constructors who had a driver finish a race with a specific status ID. ```APIDOC ## GET /ergast/f1/status/{statusId}/constructors/ ### Description Filters for constructors who had a driver finish a race with a specific `statusId`. ### Method GET ### Endpoint `/ergast/f1/status/{statusId}/constructors/` ### Parameters #### Path Parameters - **statusId** (String/Number) - Required - The ID of the race status (e.g., '2'). ### Response #### Success Response (200) - **MRData.ConstructorTable.Constructors** (Array) - The list of constructors associated with the specified status ID. ``` -------------------------------- ### Get Laps for a Specific Race Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/laps.md Retrieve all lap data for a given race. Specify the season and round number to get the desired race's lap information. Data starts from the 1996 season. ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/1997/11/laps/", "limit": "30", "offset": "0", "total": "1297", "RaceTable": { "season": "1997", "round": "11", "Races": [ { "season": "1997", "round": "11", "url": "http://en.wikipedia.org/wiki/1997_Hungarian_Grand_Prix", "raceName": "Hungarian Grand Prix", "Circuit": { "circuitId": "hungaroring", "url": "http://en.wikipedia.org/wiki/Hungaroring", "circuitName": "Hungaroring", "Location": { "lat": "47.5789", "long": "19.2486", "locality": "Budapest", "country": "Hungary" } }, "date": "1997-08-10", "Laps": [ { "number": "1", "Timings": [ { "driverId": "michael_schumacher", "position": "1", "time": "1:24.350" }, { "driverId": "damon_hill", "position": "2", "time": "1:26.068" }, { "driverId": "irvine", "position": "3", "time": "1:27.457" }, ...more drivers first lap ] }, ...more laps ] } ] } } } ``` -------------------------------- ### Get drivers by Grid Position Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/drivers.md Filters drivers to include only those who started a race from a specific grid position. ```APIDOC ## GET /ergast/f1/grid/{gridPosition}/drivers/ ### Description Filters for only drivers who have started a race in a specific grid position. ### Method GET ### Endpoint `/ergast/f1/grid/{gridPosition}/drivers/` ### Parameters #### Path Parameters - **gridPosition** (Integer) - Required - The starting grid position (e.g., `1`). ### Response #### Success Response (200 OK) - **MRData.DriverTable.Drivers** (Array) - The list of drivers who started from the specified grid position. ### Request Example `https://api.jolpi.ca/ergast/f1/grid/1/drivers/` ``` -------------------------------- ### Run jolpica-f1 Tests Source: https://github.com/jolpica/jolpica-f1/blob/main/CONTRIBUTING.md Executes the project tests. The first run may take up to 2 minutes to populate the database. Use the --create-db flag after migration changes. ```bash pytest ``` -------------------------------- ### Get Race Results by Grid Position Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/results.md Filters race results for drivers who started in a specific grid position. ```APIDOC ## GET /ergast/f1/{season}/grid/{gridPosition}/results/ ### Description Filters for only race results for drivers starting in a specified grid position. ### Method GET ### Endpoint /ergast/f1/{season}/grid/{gridPosition}/results/ ### Parameters #### Path Parameters - **season** (String) - Required - The year of the season (e.g., '2024'). - **gridPosition** (String) - Required - The grid position (e.g., '9'). ### Query Parameters [Available Query Parameters](/docs/README.md#query-parameters) ### Response #### Success Response (200 OK) - **MRData.RaceTable** (Object) - Contains race table data filtered by grid position. - **MRData.RaceTable.Races** (Array) - A list of race objects, each containing drivers who started at the specified grid position. ### Response Example { "MRData": { "RaceTable": { "season": "2023", "round": "1", "Races": [ { "season": "2023", "round": "1", "url": "http://en.wikipedia.org/wiki/2023_Bahrain_Grand_Prix", "raceName": "Bahrain Grand Prix", "Circuit": { "circuitId": "bahrain", "url": "http://en.wikipedia.org/wiki/Bahrain_International_Circuit", "circuitName": "Bahrain International Circuit", "Location": { "lat": "26.0325", "long": "50.5103" } }, "date": "2023-03-05", "time": "15:00:00Z", "Results": [ { "number": "27", "position": "8", "positionText": "8", "points": "4", "Driver": { "driverId": "huelkenberg", "permanentNumber": "27", "code": "HUL", "url": "http://en.wikipedia.org/wiki/Nico_H%C3%BClkenberg", "givenName": "Nico", "familyName": "Hülkenberg", "dateOfBirth": "1987-08-19", "nationality": "German" }, "Constructor": { "constructorId": "haas", "url": "http://en.wikipedia.org/wiki/Haas_F1_Team", "name": "Haas", "nationality": "American" }, "grid": "9", "laps": "55", "status": "Finished" } ] } ] } } } ``` -------------------------------- ### Run Tests with Database Creation Source: https://github.com/jolpica/jolpica-f1/blob/main/CONTRIBUTING.md Execute tests after setting up the initial test database. This command ensures a clean database state for all tests, improving subsequent test execution speed. ```bash pytest --create-db ``` -------------------------------- ### Run jolpica-f1 Server Source: https://github.com/jolpica/jolpica-f1/blob/main/CONTRIBUTING.md Starts the jolpica-f1 server on port 8000. API is accessible via http://localhost:8000/ergast/f1/. Source code changes are automatically updated. ```bash make run ``` -------------------------------- ### Get Sprint Results by Grid Position Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/sprint.md Filters sprint race results for drivers who started the sprint in a specified grid position. ```APIDOC ## GET /grid/{gridPosition}/sprint/ ### Description Filters sprint race results for drivers starting the sprint in a specified grid position. ### Method GET ### Endpoint /ergast/f1/grid/{gridPosition}/sprint/ ### Parameters #### Path Parameters - **gridPosition** (string) - Required - The starting grid position for the sprint (e.g., '1'). #### Query Parameters [Available Query Parameters](/docs/README.md#query-parameters) ### Response #### Success Response (200 OK) - **MRData.RaceTable.Races** (array) - List of races where drivers starting at the specified grid position achieved sprint results. #### Response Example ```json { "MRData": { "RaceTable": { "Races": [ { "season": "2024", "round": "1", "url": "http://en.wikipedia.org/wiki/2024_Bahrain_Grand_Prix", "raceName": "Bahrain Grand Prix", "Circuit": { "circuitId": "bahrain", "url": "http://en.wikipedia.org/wiki/Bahrain_International_Circuit", "circuitName": "Bahrain International Circuit", "Location": { "country": "Bahrain", "lat": "26.0325", "long": "50.5103" } }, "date": "2024-03-02", "time": "18:00:00", "SprintResults": [ { "number": "1", "position": "1", "positionText": "1", "points": "8", "Driver": { "driverId": "max_verstappen", "permanentNumber": "33", "code": "VER", "url": "http://en.wikipedia.org/wiki/Max_Verstappen", "givenName": "Max", "familyName": "Verstappen", "dateOfBirth": "1997-07-30", "nationality": "Dutch" }, "Constructor": { "constructorId": "red_bull", "url": "http://en.wikipedia.org/wiki/Red_Bull_Racing", "name": "Red Bull", "nationality": "Austrian" }, "grid": "1", "laps": "19", "status": "Finished" } ] } ] } } } ``` ``` -------------------------------- ### Restore Data from Dump Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/database_dumps.md Import your data using your preferred method after migrations have been applied. An example script is provided for restoring from a CSV dump. ```bash python scripts/restore_from_csv_dump.sh ``` -------------------------------- ### Get Max Verstappen's Laps in 2021 Abu Dhabi Grand Prix Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/laps.md Retrieves all lap data for a specific driver in a given Grand Prix. This example shows how to get Max Verstappen's laps from the 2021 Abu Dhabi Grand Prix. ```APIDOC ## GET /ergast/f1/2021/22/drivers/max_verstappen/laps/ ### Description Retrieves all lap data for Max Verstappen in the 22nd round (Abu Dhabi Grand Prix) of the 2021 Formula 1 season. ### Method GET ### Endpoint `/ergast/f1/2021/22/drivers/max_verstappen/laps/` ### Response #### Success Response (200) - **MRData** (object) - Contains the F1 data. - **RaceTable** (object) - **Races** (array) - **Laps** (array) - An array of lap objects. - **number** (string) - The lap number. - **Timings** (array) - **driverId** (string) - The ID of the driver. - **position** (string) - The driver's position during that lap. - **time** (string) - The lap time. ### Response Example ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/2021/22/drivers/max_verstappen/laps/", "limit": "30", "offset": "0", "total": "58", "RaceTable": { "season": "2021", "round": "22", "driverId": "max_verstappen", "Races": [ { "season": "2021", "round": "22", "url": "http://en.wikipedia.org/wiki/2021_Abu_Dhabi_Grand_Prix", "raceName": "Abu Dhabi Grand Prix", "Circuit": { "circuitId": "yas_marina", "url": "http://en.wikipedia.org/wiki/Yas_Marina_Circuit", "circuitName": "Yas Marina Circuit", "Location": { "lat": "24.4672", "long": "54.6031", "locality": "Abu Dhabi", "country": "UAE" } }, "date": "2021-12-12", "time": "13:00:00Z", "Laps": [ { "number": "1", "Timings": [ { "driverId": "max_verstappen", "position": "2", "time": "1:32.800" } ] }, { "number": "2", "Timings": [ { "driverId": "max_verstappen", "position": "2", "time": "1:29.103" } ] } ] } ] } } } ``` ``` -------------------------------- ### Get 1972 Season Driver Standings Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/driverStandings.md Retrieves the driver standings for the 1972 Formula 1 season. This is a basic example of fetching standings for a specific year. ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/1972/driverstandings/", "limit": "30", "offset": "0", "total": "42", "StandingsTable": { "season": "1972", "round": "12", "StandingsLists": [ { "season": "1972", "round": "12", "DriverStandings": [ { "position": "1", "positionText": "1", "points": "61", "wins": "5", "Driver": { "driverId": "emerson_fittipaldi", "url": "http://en.wikipedia.org/wiki/Emerson_Fittipaldi", "givenName": "Emerson", "familyName": "Fittipaldi", "dateOfBirth": "1946-12-12", "nationality": "Brazilian" }, "Constructors": [ { "constructorId": "team_lotus", "url": "http://en.wikipedia.org/wiki/Team_Lotus", "name": "Team Lotus", "nationality": "British" } ] }, { "position": "2", "positionText": "2", "points": "45", "wins": "4", "Driver": { "driverId": "stewart", "url": "http://en.wikipedia.org/wiki/Jackie_Stewart", "givenName": "Jackie", "familyName": "Stewart", "dateOfBirth": "1939-06-11", "nationality": "British" }, "Constructors": [ { "constructorId": "tyrrell", "url": "http://en.wikipedia.org/wiki/Tyrrell_Racing", "name": "Tyrrell", "nationality": "British" } ] }, ... ] } ] } } } ``` -------------------------------- ### Update to Main Branch and Apply Migrations Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/database_dumps.md After importing data, checkout the main branch, pull the latest changes, and run migrations again. This ensures the database is up-to-date with the current schema. ```bash git checkout main && git pull && python manage.py migrate ``` -------------------------------- ### Restore Database from CSV Dump Source: https://github.com/jolpica/jolpica-f1/blob/main/CONTRIBUTING.md Import data into the database using a CSV dump. The script expects the dump file to be named 'jolpica-f1-csv.zip' in the project root. Customize connection parameters (host, database name, username) as needed and set the PGPASSWORD environment variable for authentication. ```bash sh scripts/restore_from_csv_dump.sh localhost jolpica postgres ``` -------------------------------- ### Apply Formula One Migrations Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/database_dumps.md Run migrations for the formula one app after checking out the correct commit. This applies the necessary schema changes up to that specific point in history. ```bash python manage.py migrate formula_one ``` -------------------------------- ### Get circuits by driver result position Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/circuits.md Retrieves circuits where a race had a specific driver finishing position. This example shows how to find circuits with a 29th place driver result. ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/results/29/circuits/", "limit": "30", "offset": "0", "total": "1", "CircuitTable": { "position": "29", "Circuits": [ { "circuitId": "indianapolis", "url": "http://en.wikipedia.org/wiki/Indianapolis_Motor_Speedway", "circuitName": "Indianapolis Motor Speedway", "Location": { "lat": "39.795", "long": "-86.2347", "locality": "Indianapolis", "country": "USA" } } ] } } } ``` -------------------------------- ### Get Drivers by Season and Circuit Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/drivers.md Filters drivers who participated in a specific season and raced at a given circuit. Note that this may exclude drivers who participated in the race weekend but did not start the race. ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/2024/circuits/albert_park/drivers/", "limit": "30", "offset": "0", "total": "19", "DriverTable": { "season": "2024", "circuitId": "albert_park", "Drivers": [ { "driverId": "albon", "permanentNumber": "23", "code": "ALB", "url": "http://en.wikipedia.org/wiki/Alexander_Albon", "givenName": "Alexander", "familyName": "Albon", "dateOfBirth": "1996-03-23", "nationality": "Thai" }, { "driverId": "alonso", "permanentNumber": "14", "code": "ALO", "url": "http://en.wikipedia.org/wiki/Fernando_Alonso", "givenName": "Fernando", "familyName": "Alonso", "dateOfBirth": "1981-07-29", "nationality": "Spanish" }, ...more ] } } } ``` -------------------------------- ### Create Database Tables Source: https://github.com/jolpica/jolpica-f1/blob/main/CONTRIBUTING.md This command generates all necessary database tables for development. Ensure your PostgreSQL database is accessible via the DATABASE_SECRET_URL environment variable. ```python python manage.py migrate ``` -------------------------------- ### Get Pitstops for a Specific Race and Lap Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/pitstops.md Retrieve pitstop data for a given race, filtered by a specific lap. This example shows pitstops that occurred on lap 12 of the 4th round of the 2019 season. ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/2019/4/laps/12/pitstops/", "limit": "30", "offset": "0", "total": "3", "RaceTable": { "season": "2019", "round": "4", "lap": "12", "Races": [ { "season": "2019", "round": "4", "url": "http://en.wikipedia.org/wiki/2019_Azerbaijan_Grand_Prix", "raceName": "Azerbaijan Grand Prix", "Circuit": { "circuitId": "baku", "url": "http://en.wikipedia.org/wiki/Baku_City_Circuit", "circuitName": "Baku City Circuit", "Location": { "lat": "40.3725", "long": "49.8533", "locality": "Baku", "country": "Azerbaijan" } }, "date": "2019-04-28", "time": "12:10:00Z", "PitStops": [ { "driverId": "bottas", "lap": "12", "stop": "1", "time": "16:35:24", "duration": "20.006" }, { "driverId": "sainz", "lap": "12", "stop": "1", "time": "16:35:58", "duration": "19.755" }, { "driverId": "albon", "lap": "12", "stop": "1", "time": "16:36:16", "duration": "20.720" } ] } ] } } } ``` -------------------------------- ### Get Available Database Dumps Information Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/data/dumps.md Use this endpoint to fetch details about the currently available database dumps. The response includes information on dump types, latest and delayed dump objects, and the delay in days. ```json { "available_types": [ "csv" ], "latest_dumps": { "csv": { "dump_type": "csv", "file_hash": "ca1d224586c0fce6d3010b17169d4a1f2f8451fff0d80911573e130d03744507", "file_size": 6619294, "uploaded_at": "2025-09-21T13:45:20.930056Z", "download_url": "https://api.jolpi.ca/data/dumps/download/latest/?dump_type=csv" } }, "delayed_dumps": { "csv": { "dump_type": "csv", "file_hash": "1a40350d0f9cd463db29f7326788173c09eb45d79cdc360ade089fbb41aece3b", "file_size": 6600710, "uploaded_at": "2025-09-07T15:01:43.250560Z", "download_url": "https://api.jolpi.ca/data/dumps/download/delayed/?dump_type=csv" } }, "delay_days": 14 } ``` -------------------------------- ### Django and Environment Setup for Jalpica API Source: https://github.com/jolpica/jolpica-f1/blob/main/tests/notebook.ipynb Configures Django settings and environment variables, including enabling asynchronous operations. This is essential for running Django applications and interacting with the database. ```python import os import django os.environ.setdefault("DJANGO_SETTINGS_MODULE", "jolpica_api.settings") os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" django.setup() ``` -------------------------------- ### Constructors Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/README.md Retrieves information about Formula 1 constructors. ```APIDOC ## GET /ergast/f1/constructors/ ### Description Retrieves a list of Formula 1 constructors. ### Method GET ### Endpoint /ergast/f1/constructors/ ### Query Parameters #### Query Parameters - **limit** (integer) - Optional - Maximum number of results returned. Defaults to 30. Max is 100. - **offset** (integer) - Optional - Allows you to offset the results by the specified number for pagination. Defaults to 0. ``` -------------------------------- ### Get Specific Constructor Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/constructors.md Filters for only a specified constructor by their ID. ```APIDOC ## GET /ergast/f1/constructors/{constructorId}/ ### Description Filters for only a specified constructor by their ID. ### Method GET ### Endpoint `/ergast/f1/constructors/{constructorId}/` ### Parameters #### Path Parameters - **constructorId** (String) - Required - The unique ID of the constructor (e.g., 'williams'). ### Response #### Success Response (200) - **MRData.ConstructorTable.Constructors** (Array) - A list containing the specified constructor object. ``` -------------------------------- ### Get Seasons by Specific Year Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/seasons.md Filters for a specified season by year. ```APIDOC ## GET /ergast/f1/{season}/seasons/ ### Description Filters for a specified season by year. ### Method GET ### Endpoint /ergast/f1/{season}/seasons/ ### Parameters #### Path Parameters - **season** (string) - Required - The year of the season (e.g., '2024') or 'current' to get the current season. ### Response #### Success Response (200 OK) - **MRData.SeasonTable.Seasons** (Array) - The list of seasons matching the specified year. ### Request Example `https://api.jolpi.ca/ergast/f1/2024/seasons/` ``` -------------------------------- ### Get List of All Constructors Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/constructors.md Retrieves a list of all constructors in Formula 1 history, ordered alphabetically by constructorId. ```APIDOC ## GET /ergast/f1/constructors/ ### Description Retrieves a list of all constructors in Formula 1 history, ordered alphabetically by `constructorId`. ### Method GET ### Endpoint `/ergast/f1/constructors/` ### Response #### Success Response (200) - **MRData.ConstructorTable.Constructors** (Array) - The list of all constructors returned. ### Response Example ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/constructors/", "limit": "30", "offset": "0", "total": "212", "ConstructorTable": { "Constructors": [ { "constructorId": "adams", "url": "http://en.wikipedia.org/wiki/Adams_(constructor)", "name": "Adams", "nationality": "American" }, { "constructorId": "afm", "url": "http://en.wikipedia.org/wiki/Alex_von_Falkenhausen_Motorenbau", "name": "AFM", "nationality": "German" }, ...more ] } } } ``` ``` -------------------------------- ### Get circuit by circuitId Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/circuits.md Filters for only the circuit that matches the specified `circuitId`. ```APIDOC ## GET /ergast/f1/circuits/{circuitId}/ ### Description Filters for only the circuit that matches the specified `circuitId`. ### Method GET ### Endpoint `/ergast/f1/circuits/{circuitId}/` ### Parameters #### Path Parameters - **circuitId** (String) - Required - The unique ID of the circuit. ### Response #### Success Response (200 OK) - **MRData.CircuitTable.Circuits** (Array) - A list containing the single matching circuit object. ### Request Example `/ergast/f1/2024/circuits/albert_park/circuits/` ``` -------------------------------- ### Get Seasons by Circuit Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/seasons.md Retrieves a list of seasons featuring a specified circuit. ```APIDOC ## GET /ergast/f1/circuits/{circuitId}/seasons/ ### Description Filters for only seasons featuring a specified circuit. ### Method GET ### Endpoint /ergast/f1/circuits/{circuitId}/seasons/ ### Parameters #### Path Parameters - **circuitId** (string) - Required - The ID of the circuit (e.g., 'monza'). ### Response #### Success Response (200 OK) - **MRData.SeasonTable.Seasons** (Array) - The list of seasons featuring the specified circuit. ### Request Example `https://api.jolpi.ca/ergast/f1/circuits/monza/seasons/` ``` -------------------------------- ### Import Schemas in Python Source: https://github.com/jolpica/jolpica-f1/blob/main/libraries/jolpica-schemas/README.md Import necessary Pydantic schemas for data import and API responses. ```python from jolpica_schemas.data_import import F1Import, CircuitImport from jolpica_schemas.f1_api.alpha.circuit import CircuitSummary ``` -------------------------------- ### Get information about the currently available database dumps Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/data/dumps.md Retrieves a list of available dump types, details about the latest and delayed dumps, and the delay period in days. ```APIDOC ## GET /data/dumps/download/ ### Description Retrieves information about available database dumps, including types, latest dumps, delayed dumps, and the delay period. ### Method GET ### Endpoint /data/dumps/download/ ### Response #### Success Response (200 OK) - **available_types** (Array) - The list of available types of dumps (csv, etc) - **delay_days** (Number) - The number of days by which delayed dumps are delayed. - **delayed_dumps** (Object) - Mapping of dump type to the latest delayed Database Dump Object. - **latest_dumps** (Object) - Mapping of dump type to the latest Database Dump Object. **Database Dump Object**: - **dump_type** (String) - The type of the dump - **file_hash** (String) - The SHA256 hash of the dump - **file_size** (Number) - The file size of the dump in bytes - **uploaded_at** (String) - The date and time at which the dump was created (ISO 8601 timestamp) - **download_url** (String) - The download URL for this dump ### Response Example ```json { "available_types": [ "csv" ], "latest_dumps": { "csv": { "dump_type": "csv", "file_hash": "ca1d224586c0fce6d3010b17169d4a1f2f8451fff0d80911573e130d03744507", "file_size": 6619294, "uploaded_at": "2025-09-21T13:45:20.930056Z", "download_url": "https://api.jolpi.ca/data/dumps/download/latest/?dump_type=csv" } }, "delayed_dumps": { "csv": { "dump_type": "csv", "file_hash": "1a40350d0f9cd463db29f7326788173c09eb45d79cdc360ade089fbb41aece3b", "file_size": 6600710, "uploaded_at": "2025-09-07T15:01:43.250560Z", "download_url": "https://api.jolpi.ca/data/dumps/download/delayed/?dump_type=csv" } }, "delay_days": 14 } ``` ``` -------------------------------- ### Get Seasons by Driver Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/seasons.md Retrieves a list of seasons featuring a specified driver. ```APIDOC ## GET /ergast/f1/drivers/{driverId}/seasons/ ### Description Filters for only seasons featuring a specified driver. ### Method GET ### Endpoint /ergast/f1/drivers/{driverId}/seasons/ ### Parameters #### Path Parameters - **driverId** (string) - Required - The ID of the driver (e.g., 'hamilton'). ### Response #### Success Response (200 OK) - **MRData.SeasonTable.Seasons** (Array) - The list of seasons featuring the specified driver. ### Request Example `https://api.jolpi.ca/ergast/f1/drivers/hamilton/seasons/` ``` -------------------------------- ### Get circuits by driver Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/circuits.md Filters for circuits that the specified driver has participated in a race at. ```APIDOC ## GET /ergast/f1/drivers/{driverId}/circuits/ ### Description Filters for only circuits that the specified driver has participated in a race at. ### Method GET ### Endpoint `/ergast/f1/drivers/{driverId}/circuits/` ### Parameters #### Path Parameters - **driverId** (String) - Required - The ID of the driver. ### Response #### Success Response (200 OK) - **MRData.CircuitTable.Circuits** (Array) - The list of circuits the driver has participated in. ### Request Example `/ergast/f1/drivers/hamilton/circuits/` ``` -------------------------------- ### Get all constructors in F1 history Source: https://github.com/jolpica/jolpica-f1/blob/main/docs/endpoints/constructors.md Retrieves a list of all constructors that have participated in Formula 1 history. The response includes constructor ID, URL, name, and nationality. ```json { "MRData": { "xmlns": "", "series": "f1", "url": "http://api.jolpi.ca/ergast/f1/constructors/", "limit": "30", "offset": "0", "total": "212", "ConstructorTable": { "Constructors": [ { "constructorId": "adams", "url": "http://en.wikipedia.org/wiki/Adams_(constructor)", "name": "Adams", "nationality": "American" }, { "constructorId": "afm", "url": "http://en.wikipedia.org/wiki/Alex_von_Falkenhausen_Motorenbau", "name": "AFM", "nationality": "German" }, ...more ] } } } ```