Building Simple yet Effective APIs for the City of Cape Town: A Python-Powered Approach
Track: Data Science
Room: Talk Room 1
Time: Oct 06 (Fri): 11:00
If a city were to offer an API to its residents, what should it look like? Perhaps more importantly, what kind of data should these APIs serve up?
Within the City of Cape Town, in the Data Science branch, we've been experimenting in the open, and believe that we have some answers. Our experiences have led us towards simple yet effective HTTP-based data APIs that furnish our citizens with crucial information. Join us in this presentation as we delve into the practical applications of these APIs, with a spotlight on the pivotal role played by the Python ecosystem.
For several years, we've collaborated closely with our colleagues in the Electricity Generation and Distribution department to disseminate a status file, detailing the current load shedding stage in the City. This year, with unprecedented loadshedding, we've taken our efforts to the next level. We're not only providing more comprehensive load shedding schedules in a programmatic format, but we've also automated the generation of these status files. Additionally, we're now broadcasting significant events such as schedule updates or stage changes via a popular PubSub platform with numerous integration points.
In a more recent collaboration with our counterparts in Customer Relations, we've initiated the near real time publication of data regarding "service alerts" – sizeable service disruptions that could potentially affect many residents. This initiative has been spurred by the remarkable changes in the communication landscape over the past few years - consequently, we recognise the need to deliver authoritative and clear information to the public, unencumbered by platforms controlled by 3rd parties.
In both instances, the core offerings essentially consist of small, rapidly mutating JSON files served up by CDNs. The production of these files involves relatively straightforward data pipelines, primarily composed using batteries-included Python. These pipelines are deployed using both localised and serverless infrastructure configurations. We'll also illustrate how this approach proves to be resilient, astonishingly cost-effective, and conducive to rapid development.
Our belief is that the power of this approach lies in its simplicity yet the importance of its content. By delivering critical information to our residents in the simplest possible digital form, we unlock countless possibilities for use - from highly scaleable resident facing websites, to popular apps, this approach has proved itself in practice.