jolpica / jolpica-f1

Apache License 2.0
92 stars 4 forks source link

jolpica-f1

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/

Documentation

Our documentation can be found here.

Ergast Differences

If you are migrating from the ergast api, please check the known differences here.

Database Scheme

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. Database Scheme for jolpica-f1 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

Development

Initial Setup

Prerequisite

Use of the devcontainer is recommended. If not using, look at .devcontainer/Dockerfile for required installs.
Current requirements are:

Data Import

Running the Server

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.

Running Tests

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

Reporting Bugs / Contributing

For information on contributing to this project please read the contributing guidelines.