This is a simple script to fetch data from the code club partner portal into a CSV file and generate a map. We use this to understand and support our code clubs.
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Copy
.env.exampleto.env - Update the values in
.envwith your actual credentials:AUTHORIZATION_TOKEN=your_authorization_token_here PARTNERSHIP_UUID=your_partnership_uuid_here - To get these, log into the partner portal and inspect the request to graphql, the auth is in the header, the UUID in the payload.
- Copy
-
Run the data fetcher:
python fetch_clubs.py
-
Generate the interactive map:
python generate_clubs_map.py
API is at: https://clubs-api.raspberrypi.org/graphql Nice GraphiQL interface at: https://clubs-api.raspberrypi.org/
Official doc is here: https://docs.google.com/document/d/1un-_y5RS7mZ6_oUMtMdY199watQqOuGGmYnazkQoTeU/edit?tab=t.0#heading=h.6wq2e1ja49y7
Output of my query is imported to a google sheet (manually imported, sheet is access controlled for data protection) https://docs.google.com/spreadsheets/d/1gXj29zh8M5ZzdbwhgVakLtI37yyE8FDAxqHsxNsLdVg/edit?gid=1535358483#gid=1535358483 And then graphed in looker studio.
Internal discussion https://raspberrypifoundation.slack.com/archives/C9378TWKA/p1741090436993299
CodeClub Slack Discussion https://codeclub-org-global.slack.com/archives/C0KPMM6Q7/p1715386683617529
which links to https://github.com/coderdojo-japan/map.coderdojo.jp/blob/1d31d22e724687776600a67c048b64a04adc9bbf/get_data_from_earth.rb https://github.com/CoderDojoNederland/Website/blob/master/src/CoderDojo/CliBundle/Service/ZenApiService.php