New Bus Predictions Engine -- Reminder about APIs

197 views
Skip to first unread message

Developer at MBTA

unread,
Sep 25, 2018, 1:35:24 PM9/25/18
to MBTA Developers
Dear developers,

As described on our Medium blog, this October we will begin using Swiftly to generate predictions on all MBTA bus routes: https://medium.com/mbta-tech/better-bus-predictions-a-lot-better-64169f1edeee
Along with more frequent bus location updates, which we are also actively developing, this will mean better bus information for our riders and your users. We are very excited about this and hope you are too!

If you are using either of our supported APIs (the V3 API or our GTFS-realtime feed), the transition to the new predictions engine should be completely seamless and require no development action from you

However, because NextBus will no longer be our bus predictions vendor, we cannot guarantee that any MBTA bus predictions will continue to be available in their API after the switchover. If your app happens to query the NextBus API directly about MBTA service, please consider switching to one of the supported APIs above. 

As always, do not hesitate to let us know if you have any questions, concerns, or suggestions! You can reply here or email us at deve...@mbta.com.

Sincerely,
developer@MBTA

Paul Harrington

unread,
Sep 26, 2018, 5:02:12 AM9/26/18
to MBTA Developers
On Tuesday, 25 September 2018 17:35:24 UTC, Developer at MBTA wrote:
As described on our Medium blog, this October we will begin using Swiftly to generate predictions on all MBTA bus routes: https://medium.com/mbta-tech/better-bus-predictions-a-lot-better-64169f1edeee

Great read that, gives a high level but real insight into how there systems work.  On
  1. We then provided them with an actual real-time feed for 2 weeks
was this something akin to the GTFS VehicleLocation feed ? In other words they were supplied with bus GPS coordinates and had to come up with the predictions ? You also link to


which is another good read. On this you say 

What if you had data on where buses were every few seconds? You could watch them come toward you. You could know if they were stopped at a light, or stuck in traffic. You could make your own judgements on how close they were, and how long you would wait.

which poses the question of how often are bus location now updated now in the GTFS Realtime Vehicle Location feed ? In other words if you are allowing a user follow a trip on a map (showing the bus location) how frequently would you need to poll to pick up all bus movements ?

Developer at MBTA

unread,
Sep 27, 2018, 2:29:10 PM9/27/18
to MBTA Developers
Hi Paul,

Yes, they were provided a GTFS VehicleLocation feed. The TripUpdates and VehiclePositions realtime feeds (https://www.mbta.com/developers/gtfs-realtime) are updated every few seconds. The Alerts feed is updated every minute.

Sincerely,
Developer@MBTA

Developer at MBTA

unread,
Oct 4, 2018, 12:09:24 PM10/4/18
to MBTA Developers
New bus predictions are now live! We are observing today and have not seen any issues. But as always, please let us know if you notice anything off.

Thanks,
developer@MBTA

mikeisr...@gmail.com

unread,
Oct 4, 2018, 12:42:53 PM10/4/18
to MBTA Developers
I just made a TripUpdates request and decoded it, I don't see any delay data passed, all came up null. are you adding delays to arrival time instead?

Screen Shot 2018-10-04 at 12.30.18 PM.png

Developer at MBTA

unread,
Oct 4, 2018, 12:57:27 PM10/4/18
to MBTA Developers
Hi there,

`delay` is an optional field in GTFS-Realtime: you should use the `time` value instead, which is a POSIX timestamp.

Sincerely,
Developer@MBTA

mikeisr...@gmail.com

unread,
Oct 9, 2018, 7:59:22 PM10/9/18
to MBTA Developers
Thanks for quick reply. 

I have another issue, I pull these data from protobuf 

route_id: Green-C

trip_id: ADDED-1539105490


there are bunch of similar fields. these are not in the GTFS static feeds trips.txt file, would you be able to update static feeds?


- Mike

mikeisr...@gmail.com

unread,
Oct 9, 2018, 8:29:28 PM10/9/18
to MBTA Developers
a few more;

Green-E

ADDED-1539105505

Red

38066503-21:00-KL

Red

38066534-21:00-KL

Red

38066527-21:00-KL

Green-C

ADDED-1539105472

Green-E

ADDED-1539105580

Red

38066504-21:00-KL

Green-B

ADDED-1539105585

Green-C

ADDED-1539105573

Red

38066451-21:00-KL

Shuttle005

BL-68454509

Orange

ADDED-1539105491

Green-C

ADDED-1539105511

Green-D

ADDED-1539105588

Green-D

ADDED-1539105586

Green-C

ADDED-1539105496

Red

38066481-21:00-KL

Green-B

ADDED-1539105507

Green-D

ADDED-1539105574

Red

38066517-21:00-KL

Shuttle005

BL-121144369

Green-B

ADDED-1539105584

Red

38066540-21:00-KL

Green-E

ADDED-1539105497

Red

38066545-21:00-KL

Green-E

ADDED-1539105579

Green-D

ADDED-1539105576

Red

38066549-21:00-KL

Green-D

ADDED-1539105551

Green-E

ADDED-1539105564

Shuttle005

BL-15279935

Red

38066464-21:00-KL

Red

38066498-21:00-KL

Shuttle005

BL-28285035

Green-B

ADDED-1539105570

Red

38066469-21:00-KL

Red

38066343-21:00-KL

Green-D

ADDED-1539105572

Red

38066482-21:00-KL

Red

38066247-21:00-KL

Green-B

ADDED-1539105447

Green-C

ADDED-1539105482

Orange

ADDED-1539105501

Red

38066523-21:00-KL

Red

38066487-21:00-KL

Green-B

ADDED-1539105479

Green-D

ADDED-1539105568

Andy Monat

unread,
Oct 9, 2018, 9:57:32 PM10/9/18
to massdotd...@googlegroups.com
Hello,

I'm in the process of switching my bus pages from the NextBus API to the MBTA v3 API.

I can get predictions for a stop with a request to eg https://api-v3.mbta.com//predictions?filter[stop]=place-lech&filter[type]=3&include=stop.parent_station. However, if there are no predictions for the stop such as in the late evening for a stop served only by peak-hour buses, then there is also no information about the stop included in the response. I think that is correct based on the json-api specification. I had been hoping to rely on the included stop in the response to get the name and location of the stop. Is there a single request that will include both predictions and stop info, even if there are no predictions returned?

I can work around it by making a second request to /stops if /predictions doesn't return any predictions, but it would be nice to be able to do this in a single request. One way I think could work that fits the json-api spec is if /stops supported include=predictions.

Thanks,
Andy Monat

Developer at MBTA

unread,
Oct 10, 2018, 11:04:42 AM10/10/18
to MBTA Developers
Hi Mike,

The `schedule_relationship` field for these trips is `ADDED`, which means that they're additional trips which are not in the GTFS file.

Hope that helps!
Developer@MBTA

Developer at MBTA

unread,
Oct 10, 2018, 11:06:00 AM10/10/18
to MBTA Developers
Hi Andy,

You're correct that you don't receive the stop information if there aren't any predictions. We'll take a look at adding the ability to include predictions for a particular stop.

Thanks,
Developer@MBTA
Reply all
Reply to author
Forward
0 new messages