City-Go-Round is a website where visitors can find public transit applications (apps) that work in their city. Visitors also see a list of which transit agencies make their data publicly available to software developers… and which agencies do not.
Did you know that there are 748 transit agencies in the U.S., only 84 of which provide their schedule data to software developers? Amongst the largest offending transit agencies are the MTA New York City, the New Jersey Transit Corporation, and the Metro-North Commuter Railroad Company in New York. These agencies collectively represent nearly 18 billion passenger miles of “unopened data.”
We strongly believe that the next wave of innovation in transit will happen in software, and we believe that a key precondition for that wave to get rolling is for government agencies to make their data available to the public. To encourage openness, visitors to our web site can add their names to a petition for open public transit data in their city.
Warning: Geek Talk Goes Here
As part of a push for openness in transit data and development, we’ve made the City-Go-Round web site 100% open source. It is licensed under the BSD license and the full source code is available at my CityGoRound GitHub repository. If you have improvements you’d like to make – large or small, visual or back-end – please fork our code and send pull requests my way. You might also want to join the Open Transit Data Google Group, where we discuss issues of open transit advocacy as well as specific technical issues with GTFS feeds and the City-Go-Round web site.
City-Go-Round is a Django + App Engine application. As I mentioned in an earlier post about Django and App Engine, picking the “right approach” for Django on App Engine can be a bit tricky. We decided to use the pre-installed version of Django 1.1 and we’ve been quite happy with that decision.
In my earlier post, I also mentioned that I had done work to support secure sessions and users on top of App Engine. I intend to write a full post about this code, but if you’re curious about how it works you can find the code in the CityGoRound GitHub repository. Briefly, the key pieces of code include:
- securedictionary.py :: This code is a modified version of the Werkzeug Secure Cookie code. Instead of specifically dealing with cookies, my secure dictionary allows you to take a (presumably small) dictionary and turn it into a secure string that can’t be edited without breaking a hash check.
- middleware.py :: This is where the magic happens. This file contains Django-style middleware for both secure sessions (
AppEngineSecureSessionMiddleware) and basic user management (
AppEngineGenericUserMiddleware.) Unlike standard Django users, you can essentially use any App Engine data store model you’d like to represent the user. Just make sure your model is imported as
Userinto this file.
- context.py :: The
appengine_usercontext processor ensures that the current user is part of all request contexts.
I’ll write more about sessions and users on Django + App Engine soon, but hopefully this code will get you started.