GithubHelp home page GithubHelp logo

fagan2888 / nyc-subway-turnstile-data Goto Github PK

View Code? Open in Web Editor NEW

This project forked from toddwschneider/nyc-subway-turnstile-data

0.0 0.0 0.0 42 KB

NYC Subway Turnstile Data

License: MIT License

Ruby 99.32% HTML 0.68%

nyc-subway-turnstile-data's Introduction

NYC Subway Turnstile Data

Download NYC subway turnstile data files from the MTA's website and load them into a database

Hastily put together in March 2020, structured as a Rails app but the only functionality is to download files and load them into a Postgres table called turnstile_observations

The repo does not currently support the MTA file formats for the time period 5/5/2010โ€“10/11/2014

Dashboard

See here for a dashboard with up-to-date graphs. Data updates weekly on Saturday mornings.

Initialize database

bundle exec rake db:setup

Station => Borough mapping

lib/stations.csv includes a manual mapping of station to borough name for every observed unique combination of station/line_names/division in the raw data. It is used to seed the stations table, which can then be joined to the turnstile_observations table to calculate aggregates by borough

Example usage

From the Rails console, import a single file:

TurnstileObservation.import_turnstile_observations(date: "2020-03-21".to_date)

Import all files:

TurnstileObservation.
  all_available_dates.
  select { |d| d >= TurnstileObservation::FIRST_DATE_WITH_NEW_FORMAT }.
  each { |d| TurnstileObservation.import_turnstile_observations(date: d) }

After importing files, you have to run another query to set the net_entries and net_exits colums:

TurnstileObservation.set_net_entries_and_net_exits

nyc-subway-turnstile-data's People

Contributors

dependabot[bot] avatar toddwschneider avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.