Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data source for trip stops #65

Open
DaAwesomeP opened this issue May 30, 2024 · 1 comment
Open

Data source for trip stops #65

DaAwesomeP opened this issue May 30, 2024 · 1 comment

Comments

@DaAwesomeP
Copy link
Contributor

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 Pull in data and info for upcoming and current shutdowns #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
Copy link
Contributor Author

DaAwesomeP commented Jun 12, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant