Hello Samuel,
I think perhaps what you are getting at is, why do we include arrival predictions for the last stop of a trip, and how can a developer filter these out?
As you mention, queries such as
this one for Commuter Rail predictions at North Station include both departure predictions for trains that will be leaving soon from North Station, as well as arrival predictions for trains that are approaching North Station. We also include last-stop arrival predictions in the predictionsByRoute queries such as
this. We include this information because it may be relevant to some app users, such as those who are currently on the train and want to know when they will arrive at North Station.
Unfortunately, there currently is not a good way to filter out predictions that are for the last stop of a trip using only API calls. We do plan on introducing such a feature in a future API update, but we cannot commit to any timeline right now for that. In the meantime, this can be accomplished using the
GTFS file - we recommend using the pickup_type field in the
stop_times.txt file. A pickup_type of 0 indicates a regular stop where passengers may board the train, while a pickup_type of 1 means that this is not a stop where passengers board the train (typically meaning it is the last stop of the trip). If your application uses GTFS, this method can be used to find trip/stop combinations that should be filtered out of the API call results if you are only concerned with passengers waiting on the platform, rather than those on-board the train.
I hope this helps with your development efforts.
Sincerely,
Developer@MBTA