Flask and SQLAlchemy-based API backend serving calculated EPA/OPR for all FIRST Tech Challenge teams. Updates automatically every day at 12:00 AM..
Powered by Flask, Postgres and Python 3.12
In order to clone and use the repository locally, you need to:
- Clone the project as you would any other Git repo
- Create a
.envfile in the main directory of this project. - Inside your
.envfile add your FIRST API username and password in the following format:
DATABASE_POSTGRES_URL=[postgres_url]
API_USER=[username]
API_TOKEN=[password]
]
The postgres URL can be found on Vercel by going to Storage -> Connect -> Quickstart -> .env.local -> DATABASE_URLDATABASE_URL
- From a command line interface in the project directory run
pip install -r requirements.txtto install the required python dependencies. - Run
run.pyto start a local Flask server
In order for statistics to work for new seasons, score data needs to be adopted into the three main categories (Auto, Teleop and Endgame) that FIRST uses.
You can change this by:
- Clone the repository using the steps above under Usage
- Follow the steps in the stats-calculator repository for updating to new seasons in this project.
- Follow the steps below on how to calculate data for all teams at once in order to RESET the previous season's database. DISCLAIMER: THIS OVERRIDES ALL EXISTING DATA
DISCLAIMER: THIS OVERRIDES ALL EXISTING DATA
You can recalculate statistics and update your database all at once by:
- Cloning the repository (See relevant steps above)
- Running
run.pyto start a local Flask server - Navigating to
http://127.0.0.1:5000/api/teams/calculateto calculate teams. - Navigating to
http://127.0.0.1:5000/api/events/calculateto calculate events.
Disclaimer a Postgres database is required to be setup in your .env file