A little over a year ago, I moved into a new neighborhood in my city. I was really excited about the space and am glad to say I love it even more now after living here a while.

One of the things I was most excited about was trying to be a more active member of my block. While it’s been fun getting to know my neighbors, one of the things I’ve also ended up doing is filing requests with Philly311 - a service where I can ask questions and request non-emergency municipal services.

In addition to 311, I’ve also known about and have been a fan of OpenDataPhilly (ODP) - a portal to access publicly available data produced by the city. In this post, I’ll talk about what i’ve put together to pull data out of ODP - odphilly-tools

Right now, my tool for querying ODP is built around querying 311 data from their cartoDB instance. CartoDB allows for querying the PostgreSQL behind the data using html API queries. So instead of needing special permision to query postgres, I can just query in the url, like https://phl.carto.com/api/v2/sql?q=SELECT * FROM public_cases_fc WHERE service_code = 'SR-IR01'.

Powerful yes, but it’d be helpful to have some functions to make this easier. So I wrote a script with some functions that allow for extracting from their api, one part at a time, to build a dataset of data that I am intersted in.

In my next post, I’ll talk about how I’ll use those data and some changes i’m already workong on with the odphilly-tools.