CUTR-at-USF / gtfs-realtime-validator

Java-based tool that validates General Transit Feed Specification (GTFS)-realtime feeds. See https://github.com/MobilityData/gtfs-realtime-validator for the latest!
Other
93 stars 40 forks source link

Can routes be ADDED in GTFS-realtime? #290

Open barbeau opened 6 years ago

barbeau commented 6 years ago

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:

"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:

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?

barbeau commented 6 years ago

I think one of the biggest questions here that I didn't explicitly say above is "what route_short_name and route_long_name should be shown to users for this trip (and any other required fields in GTFS routes.txt)?"

Right now those values don't exist in GTFS-realtime spec, so if the route isn't in the GTFS data the consumer doesn't know this information.

barbeau commented 6 years ago

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.

barbeau commented 6 years ago

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.

barbeau commented 4 years ago

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