This is the portal with the statistics of the Italian Olympiads of Informatics!
The rankings of all the years are stored in a Google Spreadsheet (yeah, excel-as-a-database!).
Inside utils/make_db
there is a script that fetches this spreadsheet and build the actual data store, which is a collection of JSON files.
You can find the data at ./data
.
The frontend is written with Next.js and at build time it reads all the JSON files and produces a statically generated site (SSG). The result of the export is then put inside a Docker container with nginx for serving it, and then deployed on Kubernetes.
- Clone this repository
$ git clone https://github.com/algorithm-ninja/oii-stats.git
- Enter the
frontend/
directory
$ cd frontend
- Start the dev Next.js server
$ yarn dev
- Any changes should trigger an automatic page reload thanks to Next.js
The
data/
directory should never be updated by hand, any change will be overwritten by the scripts.
-
Get the ID of the Google Spreadsheet with the rankings. In the OII folder the file name starts with
Classifiche delle nazionali
. You can find the ID from the file URL:https://docs.google.com/spreadsheets/d/$SPREADSHEET_ID/edit
-
Enter the
utils/make_db
directory
$ cd utils/make_db
- Login to gcloud with
$ gcloud auth application-default login --scopes=openid,https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/spreadsheets
$ gcloud auth application-default set-quota-project A_GCP_PROJECT_ID
- Create a virtual environment
$ python3 -m venv venv
$ source venv/bin/activate
$ pip install -r requirements.txt
- Generate the new database by running
$ ./run.py $SPREADSHEET_ID ../../data --drop