MobilityData / gtfs-realtime-validator

Java-based tool that validates General Transit Feed Specification (GTFS)-realtime feeds
Other
41 stars 10 forks source link

Can routes be ADDED in GTFS-realtime? #49

Open isabelle-dr opened 2 years ago

isabelle-dr commented 2 years ago

Issue by barbeau October 11, 2017 Originally opened as https://github.com/CUTR-at-USF/gtfs-realtime-validator/issues/290


Summary:

Right now we have rule E004, which flags route_ids that appear in the GTFS-realtime feed but not the GTFS data.

I saw the following ADDED trip in STIF's feeds (caveat - it's actually a 3rd party, not their official feed - see https://groups.google.com/d/msg/onebusaway-developers/3lDMoMeF2zQ/u5UXvx5TAgAJ), which has a route_id that doesn't appear in RATP's GTFS data:

GTFS - http://ratp.spiralo.net/stif_gtfs_enhanced_rer_latest.zip GTFS-realtime Trip Updates - http://stif.spiralo.net/STIF

"id": "3",
"trip_update": {
"trip": {
  "trip_id": "SNCF-ACCES:VehicleJourney::11102017-24-TLN-106-7-233000:LOC",
  "start_time": "1507757580",
  "start_date": "20171011",
  "schedule_relationship": "ADDED",
  "route_id": "800850012:T11"
},
"stop_time_update": [
  {
    "arrival": {
      "time": 1507757560
    },
    "departure": {
      "time": 1507757580
    },
    "stop_id": "StopPoint:8769734:800:T11"
  }
],
"vehicle": {
  "id": "Unmatched_SNCF-ACCES:VehicleJourney::11102017-24-TLN-106-7-233000:LOC"
},
"timestamp": 1507695818
}

From a quick scan, it looks like the only reference in GTFS-realtime for ADDED is for trips: https://developers.google.com/transit/gtfs-realtime/reference/#enum_schedulerelationship_1

...says:

ADDED - An extra trip that was added in addition to a running schedule, for example, to replace a broken vehicle or to respond to sudden passenger load.

Is adding a new route via GTFS-realtime allowed?

I think we need community clarification on this. If it is allowed, we need to modify E004 to check if the ScheduleRelationship is ADDED, and if so no error should be logged.

Steps to reproduce:

Run the normal server validator on RATP's data:

GTFS - http://ratp.spiralo.net/stif_gtfs_enhanced_rer_latest.zip GTFS-realtime Trip Updates - http://stif.spiralo.net/STIF Expected behavior:

All route_ids that appear in the GTFS-realtime feed should appear in the GTFS data

Observed behavior:

There is an ADDED trip that includes a route_id that doesn't appear in the GTFS data - is this ok?

isabelle-dr commented 2 years ago

Comment by barbeau October 11, 2017


So in GTFS-realtime TripDescriptor, here's the current definition of route_id:

The route_id from the GTFS that this selector refers to. If trip_id is omitted, route_id must be provided.

I have always interpreted this as saying that the route_id must match a route_id in the GTFS data.

isabelle-dr commented 2 years ago

Comment by barbeau October 19, 2017


Quick informal poll of people at Transit Data Workshop says no, right now you shouldn't add routes via GTFS-realtime.

There does seem to be interest in fleshing this out, though, especially in context of changing trip stop sequence order/geometry/adding stops on the fly.

isabelle-dr commented 2 years ago

Comment by barbeau Feb 17, 2020


We have a draft spec for GTFS-ServiceChanges (v3.1) which is a good way to add new routes in real-time: http://bit.ly/gtfs-service-changes-v3_1