transitmatters / shutdown-tracker

A dashboard to track MBTA Shutdowns, and their results
https://mbtashutdowns.info
MIT License
5 stars 2 forks source link

Data source for trip stops #65

Open DaAwesomeP opened 6 months ago

DaAwesomeP commented 6 months ago

I recently implemented #64. This allows for the calendar to filter by line, but it is currently not possible to filter by trips.

Filtering by station names alone along a trip is not effective. For example if you are concerned with trips on the Red Line from Harvard to Davis (and filter by stations Harvard, Porter, and Davis), then a shutdown from Central to Alewife would not be flagged.

There a few ways to solve this:

  1. List the affected stations for each shutdown in shutdowns.json: This is simplest for the static file, but it may be difficult with #27 (although each station does appear to be reliably listed in each notice).
  2. Extract affected stations from GTFS alerts: I am unsure if this would also include upcoming shutdowns or only current shutdowns.
  3. Extract trips from GTFS: I need to review how GTFS works, but it may list all possible trips.
  4. Implement trip logic: this is harder but I think can be done with a list of lists of continuous stretches. This could probably be extracted from GTFS somehow (which may also provide information by trip anyway), or it could just be a static file (not likely to change very often).

    The static file would look something like:

    {
       "red": [
           ["Alewife", "Davis","Porter", "Harvard", "Central", "Kendall/MIT", "Charles/MGH", "Park Street", "Downtown Crossing", "South Station", "Broadway", "Andrew", "JFK/UMass"],
           ["JFK/UMass", "Savin Hill", "Fields Corner", "Shawmut", "Ashmont"],
           ["JFK/UMass", "North Quincy", "Wollaston", "Quincy Center", "Quincy Adamas", "Braintree"]
       ]
    }

    To find all of the stations in a trip, either a) find the stations in one list and take a subset or b) concatenate and de-duplicate the lists containing each of the stations and take a subset. This gets pretty difficult to wrap your head around with the Green Line, but I think it works. For the Green Line we may have to further filter by which Green Line train (B, C, D, and E).

DaAwesomeP commented 5 months ago

EDIT: OK, so we already have this data!

https://github.com/transitmatters/shutdown-tracker/blob/14fed0b358df4b075f0c773a821d445972827c4c/src/constants/stations.json

OLD: I just noticed this bit. Where is this data coming from? image