git clone https://github.com/simra/FRCModelingcd FRCModelinggit checkout simra/2025- Install Anaconda Python from here: https://www.anaconda.com/download
- In the VS Code terminal,
conda create --name frcmodeling python=3.10 conda activate frcmodelingpip install -r requirements.txtcd current
-
python fetchMatches.py --year 2024 --resetThis will pull all the data for 2024.
You can optionally pass --reset to re-pull all the data, and --year YEAR to pull data for a year other than 2024.
-
runScoutingReport.py
- backend\ - python flask app - see deploy.sh for build/deploy steps
- frontend\ - react front-end
- Install node.js on your machine from https://nodejs.org/en/download/
- Open a command prompt
cd current\frontend - run
npm installand thennpm run build - Delete
backend\static\buildif it exists - Copy the contents of
buildtobackend\static\build cd ..\backendpip install -r requirements.txtpython -m flask run
Model generation is in OPR.py. See runScoutingReport for an example of how it's used.
The backend uses an incremental, file-based cache (matches_<district>_<year>.pkl) to avoid
redundant round-trips to The Blue Alliance (TBA).
- On the first run the full events list and all per-event matches/teams are fetched from TBA and written to disk.
- On subsequent runs the existing pickle file is loaded and the HTTP
If-Modified-Sinceheader is used for every request:- The events-list endpoint gets the global
Last-Modifiedvalue saved with the cache. - Each event's matches/teams endpoint gets a per-event
Last-Modifiedvalue stored inresult['event_last_modified']. Events that TBA has not updated since the last fetch return HTTP 304 Not Modified and keep their cached data untouched.
- The events-list endpoint gets the global
- A backup of the previous pickle is kept at
<file>.bakbefore each write. - The
/model/<key>/refreshAPI endpoint triggers a full incremental re-fetch and rebuilds the in-memory model.
Pass --reset (CLI) or call fetch_all_matches(reset=True) to force a complete re-fetch,
ignoring all cached timestamps.
The pickle cache is a local file, which is ephemeral on most PaaS platforms (e.g., Azure App Service restarts wipe the local filesystem). To retain the cache between deployments, choose one of the following strategies:
| Option | Effort | Notes |
|---|---|---|
| Persistent volume / Azure Files mount | Low | Set the DATA_FOLDER env-var to the mount path. No code changes required. Recommended for Azure App Service. |
| Azure Blob Storage | Medium | Add azure-storage-blob; download the pkl on startup and upload after each fetch. Survives deployments and scales to multiple instances. |
| Object storage (AWS S3 / GCS) | Medium | Same pattern as Azure Blob using boto3 / google-cloud-storage. |
| SQLite / relational DB | High | Replace pickle with structured storage; enables partial row-level updates but requires a schema migration. |
The simplest production path is to mount an Azure Files share and set
DATA_FOLDER=/mnt/data so the existing pickle-based logic works without any code change.