Adding events to the chapters map

Project details

We already use the forum API to populate the chapters map dynamically with chapter info such as country tag (nl), group members and the chapters website. But we can enhance it further by adding Activism > Events, which include the correct metadata when adding an event. Everyone will be able to create new events and these events will then automatically show up on the map, as it should for a grassroots movement.

Project description

This can and will be done in a few steps. A Python script will be created to fetch and transform the data to be used in the chapters map, more details in the checklist.

Your personal background

I izzz IT person and built and maintain this forum already from scratch. I got this.

Estimated timeline

Should be finished by the end of 2025.

Resources

  • A proof of concept might take an afternoon (making it work)
  • Fine tuning it and including it in infrastructure as code might take about 2 weeks (making it perfect)
  • The public API of the forum

Checklist

Get a list of all topics, which can be done with the public API: https://tzm.one/c/11.json
Then, loop through all topic IDs and fetch the first post, e.g. https://tzm.one/t/48918/1.json, from that JSON structure, fetch the event name (if not set, replace it with the topic title), event date and event location
Store the above in a Python class called Event to apply object oriented programming
Enrich the Event object with longitude and latitude coordinates
Write a JSON file with this information, which should then be used in the JavaScript from the chapters map.
Perfect the code
Setup a schedule to run the script to keep the events on the map current
Include everything in the infrastructure as code repository
Add all historical events with location so they show up on the map

Proof of concept already looks good! I will perfect it more this month and also add event metadata to other events, they will then automatically be added to the map. Grassroots by design :flexed_biceps:

Done :tada: But adding all historical events is something I’ll do over a longer period of time. I’ll add some here and there. But of course, anyone can help out with this :wink:

Seems to work great :call_me_hand:

Dec 15 15:47:12 tzmc1 systemd[1]: Starting fetch_events.service - Fetch events JSON data...
Dec 15 15:47:49 tzmc1 fetch_events[670674]: --- Step 1: Fetching Details ---
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53944: 'ZDay 2010 New York City' (Date: 2010-03-13)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53943: 'ZDay 2009 New York City' (Date: 2009-03-15)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53942: 'ZDay 2015 Berlin' (Date: 2015-03-14)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53941: 'European Meetup 2015 Rotterdam' (Date: 2015-12-11)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53940: 'ZDay 2014 Rotterdam' (Date: 2014-03-15)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53939: 'ZDay 2013 Rotterdam' (Date: 2013-03-10)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53938: 'ZDay 2012 Rotterdam' (Date: 2012-06-22)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53937: 'ZDay 2016 Amsterdam' (Date: 2016-04-16)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53936: 'ZDay 2017 Maastricht' (Date: 2017-03-11)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53935: 'ZDay 2010 Amsterdam' (Date: 2010-03-13)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53934: 'ZDay 2018 Germany' (Date: 2018-03-26)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53933: 'ZDay Australia 2017' (Date: 2017-03-25)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 53932: 'ZDay Argentina 2019' (Date: 2019-03-23)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: Event 48918: '"Zeitgeist: Requiem" film premiere' (Date: 2024-03-15)
Dec 15 15:47:49 tzmc1 fetch_events[670674]: --- Step 2: Geocoding Locations ---
Dec 15 15:47:52 tzmc1 fetch_events[670674]: Geocoding 53944... -> Success
Dec 15 15:47:55 tzmc1 fetch_events[670674]: Geocoding 53943... -> Success
Dec 15 15:47:58 tzmc1 fetch_events[670674]: Geocoding 53942... -> Success
Dec 15 15:48:00 tzmc1 fetch_events[670674]: Geocoding 53941... -> Success
Dec 15 15:48:04 tzmc1 fetch_events[670674]: Geocoding 53940... -> Success
Dec 15 15:48:07 tzmc1 fetch_events[670674]: Geocoding 53939... -> Success
Dec 15 15:48:10 tzmc1 fetch_events[670674]: Geocoding 53938... -> Success
Dec 15 15:48:13 tzmc1 fetch_events[670674]: Geocoding 53937... -> Success
Dec 15 15:48:15 tzmc1 fetch_events[670674]: Geocoding 53936... -> Success
Dec 15 15:48:18 tzmc1 fetch_events[670674]: Geocoding 53935... -> Success
Dec 15 15:48:21 tzmc1 fetch_events[670674]: Geocoding 53934... -> Success
Dec 15 15:48:24 tzmc1 fetch_events[670674]: Geocoding 53933... -> Success
Dec 15 15:48:27 tzmc1 fetch_events[670674]: Geocoding 53932... -> Success
Dec 15 15:48:32 tzmc1 fetch_events[670674]: Geocoding 48918... -> Success
Dec 15 15:48:32 tzmc1 fetch_events[670674]: --- Step 3: Saving to GeoJSON ---
Dec 15 15:48:32 tzmc1 fetch_events[670674]: Saved 14 events to /var/lib/chapters_map/current_events.json

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.