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:
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).
Extract affected stations from GTFS alerts: I am unsure if this would also include upcoming shutdowns or only current shutdowns.
Extract trips from GTFS: I need to review how GTFS works, but it may list all possible trips.
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).
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).
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:
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).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:
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).