From c69e45c65499d37386714ec2b76521d4d3cfb2d3 Mon Sep 17 00:00:00 2001 From: u239901 Date: Thu, 30 Jan 2025 13:15:25 +0100 Subject: [PATCH 1/3] Addition of original_trip_id The original_trip_id is added to both GTFS Schedule and GTFS Realtime. This field allows the association of trips across different realtime and schedule standards, e.g., NeTEx and SIRI. It also allows matching between schedule and realtime. --- gtfs-realtime/spec/en/reference.md | 1 + gtfs/spec/en/reference.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/gtfs-realtime/spec/en/reference.md b/gtfs-realtime/spec/en/reference.md index 6e0e39df..4fdc2f75 100644 --- a/gtfs-realtime/spec/en/reference.md +++ b/gtfs-realtime/spec/en/reference.md @@ -466,6 +466,7 @@ TripDescriptor.route_id cannot be used within an Alert EntitySelector to specify | **start_date** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Conditionally required | One | The start date of this trip instance in YYYYMMDD format. For scheduled trips (trips not defined in GTFS frequencies.txt), this field must be provided to disambiguate trips that are so late as to collide with a scheduled trip on a next day. For example, for a train that departs 8:00 and 20:00 every day, and is 12 hours late, there would be two distinct trips on the same time. This field can be provided but is not mandatory for schedules in which such collisions are impossible - for example, a service running on hourly schedule where a vehicle that is one hour late is not considered to be related to schedule anymore. This field is required for frequency-based trips defined in GTFS frequencies.txt. If trip_id is omitted, start_date must be provided. | | **schedule_relationship** | [ScheduleRelationship](#enum-schedulerelationship-1) | Optional | One | The relation between this trip and the static schedule. If TripDescriptor is provided in an Alert `EntitySelector`, the `schedule_relationship` field is ignored by consumers when identifying the matching trip instance. | **modified_trip** | [ModifiedTripSelector](#message-modifiedtripselector) | Optional | One | Linkage to any modifications done to this trip (shape changes, removal or addition of stops). If this field is provided, the `trip_id`, `route_id`, `direction_id`, `start_time`, `start_date` fields of the `TripDescriptor` MUST be left empty, to avoid confusion by consumers that aren't looking for the `ModifiedTripSelector` value. +| **original_trip_id** | [string](https://protobuf.dev/programming-guides/proto2/#scalar) | Optional | One | Uniquely identifies one or more trips per operating day and across different days of a scheduled year (see also GTFS Schedule definition). It allows to compare and match GTFS-trips with similar constructs from other standards (e.g. NeTEx/SIRI) or with schedule. GTFS Realtime data can even be used without GTFS Schedule data. | ## _enum_ ScheduleRelationship diff --git a/gtfs/spec/en/reference.md b/gtfs/spec/en/reference.md index 88adb37f..c83d03ca 100644 --- a/gtfs/spec/en/reference.md +++ b/gtfs/spec/en/reference.md @@ -261,7 +261,7 @@ Primary key (`trip_id`) | `shape_id` | Foreign ID referencing `shapes.shape_id` | **Conditionally Required** | Identifies a geospatial shape describing the vehicle travel path for a trip.

Conditionally Required:
- **Required** if the trip has a continuous pickup or drop-off behavior defined either in [routes.txt](#routestxt) or in [stop_times.txt](#stop_timestxt).
- Optional otherwise. | | `wheelchair_accessible` | Enum | Optional | Indicates wheelchair accessibility. Valid options are:

`0` or empty - No accessibility information for the trip.
`1` - Vehicle being used on this particular trip can accommodate at least one rider in a wheelchair.
`2` - No riders in wheelchairs can be accommodated on this trip. | | `bikes_allowed` | Enum | Optional | Indicates whether bikes are allowed. Valid options are:

`0` or empty - No bike information for the trip.
`1` - Vehicle being used on this particular trip can accommodate at least one bicycle.
`2` - No bicycles are allowed on this trip. | - +| `original_trip_id` | ID | Optional | Identifies a logical composition of one or more trips. Unique per operating day, which can be longer than 24hrs. Can reoccur across different days of a scheduled year. Can be used to compare and match GTFS trips with similar constructs from other standards (e.g. SIRI/NeTEx) or with realtime. For example, two trips that operate the same sequence of stops on Saturdays and Sundays but deviate by 1 minute in their arrival time at the final stop. Those trips can have the same original_trip_id, but not the same trip_id. | #### Example: Blocks and service day The example below is valid, with distinct blocks every day of the week. From 75f74228fd2af19b06945751c93f6d9b24bbefb2 Mon Sep 17 00:00:00 2001 From: u239901 Date: Thu, 30 Jan 2025 13:18:51 +0100 Subject: [PATCH 2/3] Added newline --- gtfs/spec/en/reference.md | 1 + 1 file changed, 1 insertion(+) diff --git a/gtfs/spec/en/reference.md b/gtfs/spec/en/reference.md index c83d03ca..caae5a2d 100644 --- a/gtfs/spec/en/reference.md +++ b/gtfs/spec/en/reference.md @@ -262,6 +262,7 @@ Primary key (`trip_id`) | `wheelchair_accessible` | Enum | Optional | Indicates wheelchair accessibility. Valid options are:

`0` or empty - No accessibility information for the trip.
`1` - Vehicle being used on this particular trip can accommodate at least one rider in a wheelchair.
`2` - No riders in wheelchairs can be accommodated on this trip. | | `bikes_allowed` | Enum | Optional | Indicates whether bikes are allowed. Valid options are:

`0` or empty - No bike information for the trip.
`1` - Vehicle being used on this particular trip can accommodate at least one bicycle.
`2` - No bicycles are allowed on this trip. | | `original_trip_id` | ID | Optional | Identifies a logical composition of one or more trips. Unique per operating day, which can be longer than 24hrs. Can reoccur across different days of a scheduled year. Can be used to compare and match GTFS trips with similar constructs from other standards (e.g. SIRI/NeTEx) or with realtime. For example, two trips that operate the same sequence of stops on Saturdays and Sundays but deviate by 1 minute in their arrival time at the final stop. Those trips can have the same original_trip_id, but not the same trip_id. | + #### Example: Blocks and service day The example below is valid, with distinct blocks every day of the week. From 48b5218f78172e877738df6c8b61b1270e5da9ec Mon Sep 17 00:00:00 2001 From: u239901 Date: Fri, 31 Jan 2025 13:58:17 +0100 Subject: [PATCH 3/3] Amending .proto According to discussions in https://github.com/google/transit/pull/534 to reflect the documentation in reference.md --- gtfs-realtime/proto/gtfs-realtime.proto | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gtfs-realtime/proto/gtfs-realtime.proto b/gtfs-realtime/proto/gtfs-realtime.proto index 34a8a20a..2507edc0 100644 --- a/gtfs-realtime/proto/gtfs-realtime.proto +++ b/gtfs-realtime/proto/gtfs-realtime.proto @@ -873,6 +873,10 @@ message TripDescriptor { // If this field is provided, the `trip_id`, `route_id`, `direction_id`, `start_time`, `start_date` fields of the `TripDescriptor` MUST be left empty, to avoid confusion by consumers that aren't looking for the `ModifiedTripSelector` value. optional ModifiedTripSelector modified_trip = 7; + // Uniquely identifies one or more trips per operating day and across different days of a scheduled year (see also GTFS Schedule definition). + // It allows to compare and match GTFS-trips with similar constructs from other standards (e.g. NeTEx/SIRI) or with schedule. GTFS Realtime data can even be used without GTFS Schedule data. + optional string original_trip_id = 8; + // The extensions namespace allows 3rd-party developers to extend the // GTFS Realtime Specification in order to add and evaluate new features and // modifications to the spec.