Realtime trip_update TripDescriptor not matching trips.txt

Hi,
I am the author of a GTFS Realtime integration for a Home Automation product. I am having issues matching the TripDescriptor details in the realtime trip_update feed with the trips.txt static file.

I have downloaded the GTFS Static zip file (full_greater_sydney_gtfs_static_0.zip) from https://opendata.transport.nsw.gov.au/dataset/timetables-complete-gtfs and loaded into a sqlite DB using import-gtfs (https://github.com/BlinkTagInc/node-gtfs)

I am getting realtime trip updates from https://api.transport.nsw.gov.au/v2/gtfs/realtime/sydneytrains

I have download the PB file and decoded using protoc. Here is an extract of a trip update from earlier this evening.

header {
gtfs_realtime_version: “2.0”
incrementality: FULL_DATASET
timestamp: 1716708308
}
entity {
id: “102N.1377.140.130.T.8.80742076”
trip_update {
trip {
trip_id: “102N.1377.140.130.T.8.80742076”
schedule_relationship: SCHEDULED
route_id: “NTH_2a”
}
stop_time_update {
arrival {
delay: 0
}
departure {
delay: 0
}
stop_id: “2077303”
schedule_relationship: SCHEDULED
}
stop_time_update {
arrival {
delay: 0
}
departure {
delay: 0
}
stop_id: “2076231”
schedule_relationship: SCHEDULED
}

In this trip_update, the trip_id is “102N.1377.140.130.T.8.80742076” and the route_id is “NTH_2a”. However, if I look at this trip in the trips.txt file the route_id for this trip_id is “2-T9-sj2-1” and not “NTH_2a” as expected, as shown below.

I get the same result looking in the trips.txt (to eliminate any possible issues with gtfs-import)

Looking at the Google Reference Documentation it states that in “all cases, if route_id is provided in addition to trip_id , then the route_id must be the same route_id as assigned to the given trip in GTFS trips.txt.”.

The Sydney Metro GTFS R Documentation in the description for route_id in 4.1.2 Trip Descriptor that the value should be in trips.txt and routes.txt.

However, the route_id in the trip_update above (“NTH_2a”) is in neither.

Can you tell me what I am doing wrong here?

Regards,
Mark

Hi @markf ,

the GTFS Static zip file (full_greater_sydney_gtfs_static_0.zip) is a bundle that includes static timetables, stop locations, station pathway and route shape information for all transport modes, as well as regional routes, trackwork and transport routes not available in real-time feeds.

The bundle is processed via an internal scheduling system and results in the different route_id’s that you’ve pointed out in your screenshots. Please note the trip_id remains the same as the real-time trip_id.

To match both the route_id & trip_id’s for Sydney trains real-time you’ll have to use the source GTFS bundle file located here:

Public Transport - Timetables - For Realtime - Dataset - TfNSW Open Data Hub and Developer Portal.

The api url is: https://api.transport.nsw.gov.au/v1/gtfs/schedule/sydneytrains