So over Christmas I decided to do a bit of Civic Hacking, and slashed a bunch of stuff together to my Echo how to get some useful data from the City- for now, just next bus pickup at stops you like, and the trash pickup for your house. It's barely a 0.1, but it worked just enough to show:
It's really a project in two parts:
The first one, which I think has a lot more potential, is a Django portal so people can create a personalized profile of useful information about themselves. It doesn't actually do much itself, it's just for holding info. I think of it like a very basic Facebook profile but for civic data and without all of the social networking stuff.
The portal serves up a GraphQL endpoint that's protected with OAuth, so people can selectively share their data with applications. Again, think of it like Facebook and sharing your profile data between multiple applications without having to enter it all in again.
The second part is the Alexa Custom Skill/application that knows how to talk to the portal endpoint. Because it uses Account Linking to personalize the skill to each user, it means the skill needs to be an OAuth server too. My Skill OAuth server authenticates to the Portal OAuth server which authenticates the user - think of it like signing into a website using your Facebook login.
The portal and its personalization is the important part here - it's what makes it possible to say "what's my trash pickup" rather than "what's the trash pickup at 202 Demilo way", and it means that anyone else who wants to build an app that knows a user's address in the city can do so in a regular way. Knowing who the user is makes many civic apps way more interesting.
So far the portal only stores two pieces of information - your address and your favorite bus stops. With your address, it can look into the City's data API to pull up your parcel information, and from that figure out which trash schedule you're on - and more importantly, if this week is a recycle pickup or a large item pickup. With your bus stops, it means you can have a stop named "work" or whatever you want to name it and any application and use it - my app then uses Greg Tracy's transit API to figure out what the next bus will be at that stop.
Long-term, I don't want to own the portal. My hope is that someday I can convince the Madison Public Library to take it over, because I want there to be strong, democratic ownership of identity. For now, it's living at
codeformadison.com and at
github.com/epaulson/codeformadison
There is tons more to do on both parts - the portal is terrible terrible Django and is missing virtually all UI, and the code was written with the "Google until you find the right Stack Overflow answer and copy that" development methodology, so it's a little rough. The Alexa side needs better voice interaction (what Amazon calls 'utterances') and proper hosting, since right now I just run it through ngrok on my laptop. (I need to squash a few credentials that are currently hard-coded in right now too)
I'm hoping to show this off at a future meetup somewhere in town later this winter, and I'd love to work with people who are interested in either:
- Helping me fix the portal and add more interesting data
- Helping make the Alexa skill more interesting
- Using the portal for their own app
- Something else
Thanks,
-Erik