Hi,
I am trying to figure out why some trip_ids (excluding UNSCHEDULED or ADDED trips) returned in the Vehicle Position API do not correspond to any trip_id within the trips.txt GTFS file. I have logged all instances where this is the case and was wondering what to do in these cases.
sydneytrains ==============================
SCHEDULED - NT31.1933.101.28.X.7.84251050
REPLACEMENT - NT36.1933.101.12.X.7.84250998
SCHEDULED - NT35.1933.101.12.X.7.84251062
SCHEDULED - NP24.1933.101.28.P.6.84246759
SCHEDULED - 1233.1933.101.4.W.0.84247772
SCHEDULED - HM13.1933.101.4.I.1.84247335
SCHEDULED - 1157.1933.101.28.W.0.84250362
CANCELED - 124M.1933.101.12.A.8.84249863
SCHEDULED - 149F.1933.101.4.A.8.84249810
REPLACEMENT - 191F.1933.101.4.B.8.84247898
SCHEDULED - KN51.1933.101.4.N.2.84246830
SCHEDULED - W315.1933.101.4.V.8.84268165
UNSCHEDULED - NonTimetabled.STND
SCHEDULED - 50AE.1933.101.4.M.4.84246483
SCHEDULED - HN60.1933.101.4.N.4.84247408
REPLACEMENT - 127J.1933.101.12.A.8.84247362
SCHEDULED - 37-J.1933.101.4.K.8.84249027
SCHEDULED - SN59.1933.101.4.N.4.84247694
SCHEDULED - SN49.1933.101.4.N.2.84246685
UNSCHEDULED - NonTimetabled.-4H-
UNSCHEDULED - NonTimetabled.N174
UNSCHEDULED - NonTimetabled.N168
UNSCHEDULED - NonTimetabled.N172
UNSCHEDULED - NonTimetabled.928-
SCHEDULED - 171Z.957.146.2.A.8.83150117
SCHEDULED - 182Z.957.146.2.A.8.83148056
SCHEDULED - 552T.957.146.2.A.8.83149204
SCHEDULED - 163Z.957.146.2.A.8.83151202
UNSCHEDULED - NonTimetabled.3964
UNSCHEDULED - NonTimetabled.215H
UNSCHEDULED - NonTimetabled.4T
SCHEDULED - 25-E.1933.101.28.B.8.84246163
UNSCHEDULED - NonTimetabled.MC--
SCHEDULED - 93-B.1933.101.28.A.8.84248259
SCHEDULED - 93-C.1933.101.28.A.8.84247858
SCHEDULED - 86-C.1933.101.28.A.8.84249841
SCHEDULED - 104D.1933.101.28.T.8.84249417
SCHEDULED - 104C.1933.101.28.T.8.84249418
SCHEDULED - 123L.1933.101.12.A.8.84247322
CANCELED - 124L.1933.101.12.A.8.84250982
UNSCHEDULED - NonTimetabled.452-
SCHEDULED - 2134.1933.101.12.W.0.84246724
SCHEDULED - CA14.1933.101.12.W.0.84247349
=================================================
nswtrains ==============================
SCHEDULED - 168.091224.127.1513
SCHEDULED - 172.091224.127.1500
SCHEDULED - 176.091224.127.1430
SCHEDULED - 371.091224.1.1415
SCHEDULED - 513.091224.127.1420
SCHEDULED - 522.091224.21.1423
SCHEDULED - 532.091224.85.1415
SCHEDULED - 540.091224.1.1235
SCHEDULED - 545.091224.1.1000
SCHEDULED - 589.091224.127.1415
REPLACEMENT - 719.091224.85.1445
SCHEDULED - 725.091224.127.1455
SCHEDULED - 727.091224.21.1415
SCHEDULED - 731.091224.127.1415
REPLACEMENT - 733.091224.85.1415
SCHEDULED - 755.091224.127.1440
SCHEDULED - 782.091224.127.1450
SCHEDULED - 791.091224.37.1450
SCHEDULED - NP23.1933.091224.28.P.6.84247189
REPLACEMENT - NP24.1933.091224.28.P.6.84246759
SCHEDULED - NP43.959.091224.124.P.2.83169709
SCHEDULED - NT32.1933.091224.28.X.7.84247140
SCHEDULED - NT33.1933.091224.28.X.7.84250847
SCHEDULED - NT35.1933.091224.12.X.7.84251062
SCHEDULED - NT36.1933.091224.12.X.7.84250998
=================================================
metro ==============================
ADDED - M1-I-CUD_DN-SYD_UP-1-20241209-035616:X
=================================================
lightrail/cbdandsoutheast ==============================
=================================================
lightrail/innerwest ==============================
=================================================
lightrail/newcastle ==============================
=================================================
ferries/sydneyferries ==============================
=================================================
Thanks
Hi,
I realised that the trips were either RTTA_DEF, RTTA_REV, NonTimetabled, Out of Service or ADDED but I was still wondering how to handle ADDED trips as they do not have route information available.
I’ve also been experiencing this issue over the last few days.
A few trips (from the realtime data today at timestamp=1736136692
), e.g. 730Z.1431.117.2.A.8.84342699
, 730Y.1431.117.2.A.8.84342691
, are marked with schedule_relationship=0/SCHEDULED
but yet the Sydney Trains GTFS data from Sun, 05 Jan 2025 14:01:08 GMT
does not include them.
I also can see that these run numbers tend to have different trips with valid data, but that’s not particularly helpful since there can be a variety of trips for one run number.
Marcie
January 10, 2025, 3:52am
4
Hi @ethanhe3 and @snowbound_balcony ,
Thanks for your queries.
@ethanhe3 - as per Sydney Trains Documentation , ADDED trips should have a corresponding route_id:
@snowbound_balcony do you have a screenshot of those trips? They could be non revenue trips.
@Marcie Yes, they can be RRTA_DEF/RTTA_REV. But not exclusively:
DEBUG:__main__:Could not find (scheduled) trip for trip_id: 610R.677.126.32.T.8.84624116 trip {
trip_id: "610R.677.126.32.T.8.84624116"
route_id: "ESI_2d"
}
stop_time_update {
arrival {
time: 1736434985
}
stop_id: "2230211"
}
stop_time_update {
arrival {
delay: 0
time: 1736436600
}
stop_id: "2220362"
}
vehicle {
[transit_realtime.tfnsw_vehicle_descriptor] {
vehicle_model: "T"
}
}
timestamp: 1736436504
or this one:
DEBUG:__main__:Could not find (scheduled) trip for trip_id: 298H.677.126.56.H.8.83892129 trip {
trip_id: "298H.677.126.56.H.8.83892129"
route_id: "CCN_2b"
}
stop_time_update {
arrival {
time: 1736423701
}
departure {
time: 1736425861
}
stop_id: "229354"
}
stop_time_update {
arrival {
time: 1736426010
}
departure {
time: 1736426040
}
stop_id: "2303151"
}
stop_time_update {
arrival {
time: 1736426220
}
departure {
time: 1736426250
}
stop_id: "229271"
}
stop_time_update {
arrival {
time: 1736426400
}
departure {
time: 1736426430
}
stop_id: "2289331"
}
stop_time_update {
arrival {
time: 1736426550
}
departure {
time: 1736426580
}
stop_id: "2289341"
}
stop_time_update {
arrival {
time: 1736426820
}
departure {
time: 1736426850
}
stop_id: "2285361"
}
stop_time_update {
arrival {
time: 1736427066
}
departure {
time: 1736427096
}
stop_id: "2284171"
}
stop_time_update {
arrival {
time: 1736427240
}
departure {
time: 1736427270
}
stop_id: "2284181"
}
stop_time_update {
arrival {
time: 1736427360
}
departure {
time: 1736427390
}
stop_id: "2284161"
}
stop_time_update {
arrival {
time: 1736427630
}
departure {
time: 1736427660
}
stop_id: "2283231"
}
stop_time_update {
arrival {
time: 1736427900
}
departure {
time: 1736427930
}
stop_id: "2283221"
}
stop_time_update {
arrival {
time: 1736428440
}
departure {
time: 1736428470
}
stop_id: "2264191"
}
stop_time_update {
arrival {
time: 1736428710
}
departure {
time: 1736428740
}
stop_id: "2264201"
}
stop_time_update {
arrival {
time: 1736429076
}
departure {
time: 1736429106
}
stop_id: "2259931"
}
stop_time_update {
arrival {
time: 1736429460
}
departure {
time: 1736429490
}
stop_id: "2259921"
}
stop_time_update {
arrival {
time: 1736429790
}
departure {
time: 1736429820
}
stop_id: "2259942"
}
stop_time_update {
arrival {
time: 1736429970
}
departure {
time: 1736430000
}
stop_id: "2259911"
}
stop_time_update {
arrival {
time: 1736430312
}
departure {
time: 1736430342
}
stop_id: "2258111"
}
stop_time_update {
arrival {
time: 1736430492
}
departure {
time: 1736430522
}
stop_id: "2250801"
}
stop_time_update {
arrival {
time: 1736430630
}
departure {
time: 1736430660
}
stop_id: "2250821"
}
stop_time_update {
arrival {
time: 1736430762
}
departure {
time: 1736430792
}
stop_id: "2250811"
}
stop_time_update {
arrival {
time: 1736431020
}
stop_id: "2250791"
}
vehicle {
[transit_realtime.tfnsw_vehicle_descriptor] {
vehicle_model: "H"
}
}
timestamp: 1736431546
This is from the GTFS feeds which I redownloaded just then, and current realtime data.
There’s also a fair amount which don’t have stop data at all, despite being scheduled/replacement trips (which is invalid per both the official GTFS spec and per the tfnsw modified one)
DEBUG:__main__:Could not find (scheduled) trip for trip_id: 27-P.677.126.36.B.8.83895213 trip {
trip_id: "27-P.677.126.36.B.8.83895213"
schedule_relationship: SCHEDULED
route_id: "IWL_1a"
}
vehicle {
[transit_realtime.tfnsw_vehicle_descriptor] {
vehicle_model: "B"
}
}
timestamp: 1736432357
DEBUG:__main__:Replacement trip with no stops, 45-F.677.129.64.K.8.83893624: trip {
trip_id: "45-F.677.129.64.K.8.83893624"
schedule_relationship: REPLACEMENT
route_id: "RTTA_DEF"
}
vehicle {
[transit_realtime.tfnsw_vehicle_descriptor] {
vehicle_model: "K"
}
}
timestamp: 1736465094
If it helps at all, I’ve attached what I’m seeing in the realtime feed, my debug output, and also the static GTFS feed (which is the current one from your website — sorry for the triple compression, but it needed it to fit under 8MB)
realtime-data-and-output.zip (91.8 KB)
data3.zip (7.7 MB)
Marcie
January 13, 2025, 12:07am
6
Hi @snowbound_balcony , I’ve raised with Sydney trains. I’ll let you know what they come back with.
Thanks,
Marcela
1 Like