Skip to content

Instantly share code, notes, and snippets.

@ryanj
Last active December 22, 2015 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanj/fc7d956909cd5b036dd9 to your computer and use it in GitHub Desktop.
Save ryanj/fc7d956909cd5b036dd9 to your computer and use it in GitHub Desktop.
NYC Shifts Civic Innovation into High-Gear (draft / preview)

Civic Hacking and Innovation

NYC shifts civic innovation into high gear

Last month I stopped by the BetaNYC Hack Night in New York to get a look at some of the latest civic innovation projects being developed on the East Coast.

BetaNYC is one of a growing number of civic-minded technology groups that are working to improve their community by rapidly prototyping software solutions that address common problems in their neighborhood. These groups are often associated with the larger Code for America organization through their volunteer-based, technology Brigade program.

Code for America promotes civic engagement across the country, with the goal of improving the relationship between citizens and their government. Their mission statement reads: "Code for America envisions a government that works by the people, for the people, in the 21st century".

As someone who frequently feels rather detached and powerless regarding the direction in which our government is heading, these aspirations give me hope, and inspire me to act.

I joined Oakland California's OpenOakland Brigade last year, and have participated in plenty of civic hacking events from out on the West Coast since. However, this was my first event on the East Coast, and my first look at CitiBike's data.

Citibike's Open Data

A large part of these "civic hacking" efforts really just involve using modern, open source software tools and data analysis techniques to help gain a greater understanding of the information stored in public records, and in other data made publicly available by civic-focused organizations and groups.

For these folks, the term hacking does not imply theft. Instead, it usually represents working toward a creative, innovative, or unexpected reuse of readily available tools, goods, or information. Or more generally, to fix, upgrade, or improve.

This night's theme focused on making use of the public data from New York's CitiBike bike sharing program - a popular topic, which filled the night's meeting space to capacity.

The meeting format was familiar: We started off with ten minutes of introductory announcements, followed by an hour of fast, 5-minute presentations from local developers who had prepared an application demo to share. The final two hours of the event were left open for general collaboration, team building, and more hacking.

Noel Hidalgo, the NYC Brigade Captain, posted an excellent recap of the night's project presentations on the Code for America blog.

Representatives from groups such as the Department of Transportation, Socrata, and other large public and private sector organizations were also in attendance. These groups were not only there to promote the availability their own data sets, but they were also expected to be able to handle questions about the data, and to collect feedback about the quality and accessibility of the information.

As a visitor from another Brigade city, I was really interested in seeing how we could make our successful apps more portable, allowing us to multiply our wins by enabling other communities to quickly replicate and reuse our project code.

As it turns out, the format of the publicly available NYC bike data is almost an exact match for the data provided by the bike sharing programs in Philadelphia and in Washington DC. This means that a single bike dashboard application (with some slight modifications), may be reusable in a wide variety of communities.

I did some quick work to modify an existing Citibike Dashboard application which was originally written by local Brigade member, Edgar Gonzalez.

CitibikeNYC Dashboard

Edgar's citibike dashboard uses his own Citibike ruby client library to fetch data on the status of selected local bike hubs nearby. Very impressive!

Last month, when I had originally looked into making this application available on OpenShift, we were missing support for setting custom environment variables from outside a hosted application. In the last week, we've added that feature along with quite a few more.

Putting OpenShift's New Custom Environment Variables To Work

The following two lines represent the majority of the effort in getting this application ported to run on OpenShift:

set :port, ENV['OPENSHIFT_RUBY_PORT'] if ENV['OPENSHIFT_RUBY_PORT']
set :bind, ENV['OPENSHIFT_RUBY_IP'] if ENV['OPENSHIFT_RUBY_IP']

While on OpenShift, your application's port and IP address will be provided automatically (read-only).

Now you can define your own custom environment variables while creating an app:

rhc app create citibikes ruby-1.9 --env CITIBIKE_NEARBY_STATIONS="268,257,2010" --from-code=https://github.com/edgar/citibikenyc_dashboard.git

The command output should include a live web URL where your application clone can be accessed.

To update an existing OpenShift-hosted application clone with new list of station ids:

rhc env set CITIBIKE_NEARBY_STATIONS="268,257,258" -a citibikes

Then, restart the application to load your new station id list:

rhc app restart 

This is great because it allows me to run the upstream project source directly, without requiring any downstream modifications in order to configure the app for my needs.

Maintaining a clean and configurable upstream source for these projects should also help improve security by keeping secrets and keys out of the application source, and by providing a central location for people to collaborate and discuss security patches and other issues.

A live demo of my branch of the dashboard is available here: http://citibike-shifter.rhcloud.com/

For more information about the newly added support for user-defined application variables, update your rhc command-line tools to the latest version, and use the included help command to print the usage notes:

gem update rhc
rhc help env

Civic Innovation in Your Neighborhood

The Brigade teams are hard at work on a growing list of applications that can be quickly redeployed in your area. Let us know if you've developed a portable civic application, or if you've redeployed a civic app for use in your own neighborhood - We'd love to hear about it, and help you spread the word.

My stop in NYC was the first in a series of Brigade visits that OpenShift has planned over the coming months. Stay tuned, and hopefully we'll be dropping by a brigade near you soon!

What's Next?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment