Skip to content

s2t2/branford_station

Repository files navigation

Branford Station

This application finds sources of General Transit Feed Specification (GTFS) open transit data from community-maintained sites like the GTFS Data Exchange and the Google Transit Data Feed Wiki, periodically checks feed sources to confirm current data or download new data, and makes the data available for public consumption through an API and front-end interface.

Usage

Find data sources

bundle exec rake station_attendant:find_data_exchange_feeds
bundle exec rake station_attendant:find_google_transit_data_feeds

Consume data from source

bundle exec rake station_attendant:find_and_consume_and_load

Other sources

You may also specify one or more feed source urls for ad-hoc consumption.

Download feed files onto filesystem.

FeedConsumer.perform(:source_urls => ["http://www.shorelineeast.com/google_transit.zip", "http://web.mta.info/developers/data/mnr/google_transit.zip"])

Or load files into database.

FeedConsumer.perform(:load => true, :source_urls => ["http://www.shorelineeast.com/google_transit.zip", "http://web.mta.info/developers/data/mnr/google_transit.zip"])

API Endpoints

Once persisted, make HTTP requests or view GTFS data in a browser using the endpoint urls listed below.

  • /agencies (lists all participating transit agencies)
  • /agencies/:agency_abbrev (lists all train stations serviced by a given agency)
  • /agencies/:agency_abbrev/stations/:station_abbrev (lists upcoming departures from a given station)

These endpoints return HTML by default. To request a JSON response instead, suffix .json to the endpoint url.

Contributing

To request a new feature, create an issue.

To deliver a new feature, fork the repo, make your changes, add tests if possible, and submit a pull request.

Development Environment Setup

Install dependencies for a Ruby on Rails application.

  • ruby (via rbenv)
  • bundler
  • rails
  • mysql (or postgres, etc. according to database.yml)

Obtain source code.

git clone git@github.com:s2t2/branford_station.git
cd branford_station

Set-up the database.

bundle exec rake db:create
bundle exec rake db:migrate

Consume a few gtfs feeds.

FeedConsumer.perform(:source_urls => ["http://www.shorelineeast.com/google_transit.zip", "http://web.mta.info/developers/data/mnr/google_transit.zip"], :load => true)

Start a web server.

rails server

View in browser at [localhost:3000].

Production Environment Setup

Thanks to HOSTING ORGANIZATION HERE for hosting this application in production.

Releases

No releases published

Packages

No packages published

Languages