API for querying formula one data, with backwards compatible endpoints for the soon to be deprecated ergast api.
The Ergast compatible API can be found here: http://api.jolpi.ca/ergast/f1/
Our documentation can be found here.
If you are migrating from the ergast api, please check the known differences here.
Rather than import the existing database scheme used by ergast, we use a new scheme which will allow better adaption to changing rulesets, reduce duplication of information, and allow storage of more F1 related data. Many Enumerations are used in the database, the mappings of these values are defined in their respective model files. For example you can find the enumerations for the PointSystem table here
Use of the devcontainer is recommended. If not using, look at .devcontainer/Dockerfile
for required installs.
Current requirements are:
DATABASE_SECRET_URL
environment variable.poetry install
, and activate the venv poetry shell
python manage.py migrate
make load-ergast-data
make import-from-ergast
pytest --create-db
This will fill the database with the latest data from ergast, and create the initial test database so all future tests will run quicker.
To run the server
make run
This will start jolpica-f1 on port 8000. Once it is running you can access the API via browser, curl or any other tools with http://localhost:8000/ergast/f1/
. Any changes made to the source code will be automatically updated, while it is running.
The first time the tests are run it will take upto 2 minutes to populate the database with test data, pytest is configured to reuse this database on future runs, so tests should run much faster on future runs.
To run tests after a migration change you must run with the --create-db
flag to ensure it uses the new migrations.
To run the tests
pytest
For information on contributing to this project please read the contributing guidelines.