Use GTFS API to recreate "Service Status"

160 views
Skip to first unread message

clevercommute

unread,
Jun 21, 2022, 11:50:49 AMJun 21
to mtadeveloperresources
My dev is trying to use the GTFS API to effectively create a version of the picture below. 

Does anyone have guidance on how to do that? 
I have pasted our troubleshooting code below (and the results we get...which do NOT match the "Service Status")

HowTo.png

$headers = ['x-api-key: XXXXXXXXXXXXXXXXXXX']; 
 $curl = curl_init(); 
 curl_setopt( $curl, CURLOPT_URL, $apiUrl ); 
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 ); 
curl_setopt( $curl, CURLOPT_HTTPHEADER, $headers); 

 try { $results = json_decode(curl_exec($curl), true, 512, JSON_THROW_ON_ERROR); } catch (JsonException $e) 
 echo $e; 
 exit(); 
}

----
What we do get 

suspended
multiple impacts
part suspended
trains rerouted
delays
service change
local to express
express to local
stations skipped
some delays
slow speeds
planned work
good service
on or close
boarding change
weekday service
special schedule
extra service
planned - substitute buses
planned - part suspended
planned - stations skipped
reduced service
special event
no scheduled service
planned - boarding change
saturday schedule
station notice
sunday schedule
weekend schedule


Sam Salkin

unread,
Jun 23, 2022, 11:50:52 AMJun 23
to mtadeveloperresources
Hi there - Internally, we are shifting away from "Service Status" as a concept because classifying a line's status by the most severe incident on the line tends to obscure other alerts impacting a line that may be more relevant to one's travel. You can expect to see this more in customer-facing products down the road.

If you want to recreate this on your end, I'd recommend re-reviewing the documentation for our GTFS Alerts feed. (https://groups.google.com/g/mtadeveloperresources/c/fu3q3n_I2J0/m/LziRXc0aBQAJ). 

The value of the alertType with the highest integer in the sortOrder field for all alerts on a given line would be its "status". The "displayBeforeActive" field is what we use to key off if a Planned Service Change does or doesn't show up in our status box. (For some long-term service changes, we do not publish them in the status box) The absence of the field means it would not show up in the status box. All alerts for unplanned/real-time disruption show up in the status box by default (and have an integer value of 0).

I hope this helps!

clevercommute

unread,
Jun 23, 2022, 6:53:44 PMJun 23
to mtadeveloperresources
Hi 

This is helpful. I will work with my devs to determine feasibility. 

Can you please provide dates for deco of Service Status?
It was 1/2 a year ago that you counseled me away from Service Status, and yet it's still in prod use, and we don't know when it's going away. 

We don't want to build throw-away work, but we have to make business decisions about what/when to build. 

Thanks, 

jge...@gmail.com

unread,
Jun 24, 2022, 2:33:57 PMJun 24
to mtadeveloperresources
Sorry for any confusion. we've been advising folks to move away from it for a few years now. We stopped listing in publicly about a year ago.  

I'm actually surprised it's still working, and wouldn't be surprised if the data hasn't been totally accurate even if it's not broken. The fact it's still up speaks more to some of the challenges on our side wrangling legacy things than any strategy. 

For planning purposes, move to the alerts API. We're working on a guide about how to recreate a service status box using the alerts feed, which we'll have ready early next week and post publicly on our website. 


Tim Fowle

unread,
Jun 27, 2022, 9:03:34 AMJun 27
to mtadeveloperresources
Hello 
Can you just clarify something for me.
You say youve been advising people to move away from the "service status" feeds.  I assumed this meant moving from the very old service status feed to the GTFS-RT alerts or the "Service Alerts" GTFS feed (and its json version).
But you also say you are moving away from ""Service Status" as a concept".
Is this something that will disappear from your homepage https://new.mta.info/
If so is this likely to happen soon (weeks/months) or a longer term aim?


Thanks

clevercommute

unread,
Jun 29, 2022, 10:27:53 PMJun 29
to mtadeveloperresources
Regarding " We're working on a guide about how to recreate a service status box using the alerts feed, which we'll have ready early next week and post publicly on our website.", 

is this still on target for delivery by July 1?

Thank you

clevercommute

unread,
Jul 5, 2022, 9:35:44 PMJul 5
to mtadeveloperresources
Please let me know. Thanks

clevercommute

unread,
Jul 11, 2022, 7:11:52 PMJul 11
to mtadeveloperresources
Hi - 

Can you please let me know? 

Thanks

-Josh 

clevercommute

unread,
Jul 17, 2022, 9:54:25 AMJul 17
to mtadeveloperresources
ETA please. Thank you

Sam Salkin

unread,
Jul 18, 2022, 10:03:34 AMJul 18
to mtadeveloperresources
Hi Josh - we'd published this last week and never provided the link back to the dev list. That's on us. You can read the guide here: https://new.mta.info/developers/service-status-box

--Sam

clevercommute

unread,
Jul 18, 2022, 12:31:45 PMJul 18
to mtadeveloperresources
Thank you. 
We will check it out. 
FYI - there may be 2 small typos in the link you shared 

--Josh 

2022-07-18_12-29-19.png
Reply all
Reply to author
Forward
0 new messages