Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTFS Trip-Modifications #403

Merged
merged 42 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
b2bfcf5
Add Trip-Modification, make shape non-experimental
gcamp Sep 25, 2023
ab5e996
Create a page for TripModifications entities for consistency with TU …
npaun Oct 10, 2023
7887381
Clarify providing TUs for modified trips and ReplacementStop time int…
npaun Oct 10, 2023
da1c109
Merge remote-tracking branch 'google/master' into gtfsrt/trip_modific…
gcamp Oct 11, 2023
52d4064
Fix first_stop_reference.png not having the right image + optimize im…
gcamp Oct 12, 2023
c2f88a0
Fix optional/require for Stop message
gcamp Oct 19, 2023
9a0d6d5
Clarify behaviour and linkage to TripUpdates
gcamp Oct 23, 2023
7a67845
Apply Modification clarification proposed changes
gcamp Oct 23, 2023
364e32b
Use ModifiedTripSelector instead of concatenation of IDs
gcamp Dec 5, 2023
f3944b0
Add details on behavior when is provided
gcamp Dec 6, 2023
8533985
Remove modifications_id
gcamp Dec 11, 2023
121049c
Merge pull request #12 from TransitApp/feature/trip_modification_sele…
gcamp Dec 11, 2023
4b90e8a
Fix after comments from @bdferris-v2
gcamp Dec 20, 2023
7ef14f5
Add note about producer needed the two versions of trip updates
gcamp Dec 21, 2023
8f5d394
Fix bad relationship mentionned, + force no other entity when using M…
gcamp Jan 8, 2024
0126942
Changes after Jan 10 call
gcamp Jan 11, 2024
429c56b
Merge remote-tracking branch 'google/master' into gtfsrt/trip_modific…
gcamp Jan 17, 2024
e0b0f48
Add experimental notices
gcamp Feb 20, 2024
14e4259
Remove mention of stop pattern
gcamp Feb 20, 2024
36f3cac
Use stop selector instead of stop sequence only
gcamp Feb 20, 2024
b92a5b2
Update to end_stop_selector
gcamp Feb 21, 2024
fb9c8df
Update proto with start/end stop selector
gcamp Feb 21, 2024
b5f65bf
Add selected trips
gcamp Feb 21, 2024
f26ded5
Update reference with SelectedTrips
gcamp Feb 21, 2024
5e6f44c
Update trip modif doc
gcamp Feb 21, 2024
a91db62
Add last_modified_time
gcamp Feb 21, 2024
47a3ceb
Add missing start_times in pb
gcamp Feb 22, 2024
99aba67
Fix typos, fix description of selected trips
gcamp Feb 22, 2024
c4e94d9
Fix typos
gcamp Feb 22, 2024
437fc84
Update reference for clarity
gcamp Feb 22, 2024
ae77b32
Clarify and remove duplicated information
gcamp Feb 22, 2024
1c54a21
Consistancy
gcamp Feb 22, 2024
be4a9c6
Changes before experimental vote
gcamp Feb 22, 2024
51980b8
Revert correctly shape experimental
gcamp Feb 28, 2024
5afb5de
Merge branch 'final/trip_modification' into gtfsrt/trip_modifications
gcamp Feb 28, 2024
2721fe0
Editorial, formatting clarifications
jfabi Mar 1, 2024
a1e4af7
Merge pull request #17 from jfabi/gtfsrt/trip_modifications_editorial
gcamp Mar 5, 2024
19b4d2e
Apply suggestions from @sam-hickey-ibigroup
gcamp Mar 5, 2024
37f290d
Update documentation images with new fields, add source files
gcamp Mar 5, 2024
418702a
Clarifies behavior of propagated_modification_delay when no stop_time…
gcamp Mar 5, 2024
b437508
Remove extra word
gcamp Mar 5, 2024
4be2666
Sync .proto and reference files
gcamp Mar 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 98 additions & 5 deletions gtfs-realtime/proto/gtfs-realtime.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ message FeedEntity {
optional TripUpdate trip_update = 3;
optional VehiclePosition vehicle = 4;
optional Alert alert = 5;

// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
optional Shape shape = 6;
optional Stop stop = 7;
gcamp marked this conversation as resolved.
Show resolved Hide resolved
optional TripModifications trip_modifications = 8;

// The extensions namespace allows 3rd-party developers to extend the
// GTFS Realtime Specification in order to add and evaluate new features and
Expand Down Expand Up @@ -1010,19 +1010,16 @@ message TranslatedImage {
// Tracing the points in order provides the path of the vehicle. Shapes do not need to intercept
// the location of Stops exactly, but all Stops on a trip should lie within a small distance of
// the shape for that trip, i.e. close to straight line segments connecting the shape points
// NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
message Shape {
// Identifier of the shape. Must be different than any shape_id defined in the (CSV) GTFS.
// This field is required as per reference.md, but needs to be specified here optional because "Required is Forever"
// See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules
// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
optional string shape_id = 1;

// Encoded polyline representation of the shape. This polyline must contain at least two points.
// For more information about encoded polylines, see https://developers.google.com/maps/documentation/utilities/polylinealgorithm
// This field is required as per reference.md, but needs to be specified here optional because "Required is Forever"
// See https://developers.google.com/protocol-buffers/docs/proto#specifying_field_rules
// NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
optional string encoded_polyline = 2;

// The extensions namespace allows 3rd-party developers to extend the
Expand All @@ -1033,3 +1030,99 @@ message Shape {
// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}

// Describes a stop which is served by trips. All fields are as described in the GTFS-Static specification.
message Stop {
enum WheelchairBoarding {
UNKNOWN = 0;
AVAILABLE = 1;
NOT_AVAILABLE = 2;
}

required string stop_id = 1;
gcamp marked this conversation as resolved.
Show resolved Hide resolved
optional TranslatedString stop_code = 2;
optional TranslatedString stop_name = 3;
optional TranslatedString tts_stop_name = 4;
optional TranslatedString stop_desc = 5;
optional float stop_lat = 6;
optional float stop_lon = 7;
gcamp marked this conversation as resolved.
Show resolved Hide resolved
gcamp marked this conversation as resolved.
Show resolved Hide resolved
optional string zone_id = 8;
optional TranslatedString stop_url = 9;
optional string parent_station = 11;
optional string stop_timezone = 12;
optional WheelchairBoarding wheelchair_boarding = 13 [default = UNKNOWN];
optional string level_id = 14;
optional TranslatedString platform_code = 15;

// 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.
extensions 1000 to 1999;

// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}

message TripModifications {
message Modification {
Copy link
Collaborator

@bdferris-v2 bdferris-v2 Mar 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I think you are using tab indentation in a few place here where the rest of the file uses spaces? I know it's petty to complain about whitespace in a code-review, but it's making it hard to look at the delta in Github because the indentation is weird 😇 Both here and below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. The indentation looks strange in Github.

// The first stop sequence of the original trip that is to be affected by this modification.
optional uint32 start_stop_sequence = 1;

// The number of stops which are canceled and replaced by the replacement_stops. May be zero to indicate no skipped stops.
optional uint32 num_stops_replaced = 2;

// The number of seconds of delay to add to all departure and arrival times following the end of this modification. If multiple modifications apply to the same trip, the delays accumulate as the trip advances.
optional int32 propagated_modification_delay = 3 [default = 0];
gcamp marked this conversation as resolved.
Show resolved Hide resolved

// A list of replacement stops, replacing those of the original trip. The length of the new stop times may be less, the same, or greater than the number of replaced stop times.
Copy link

@abyrd abyrd Dec 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that the comment uses both the terms "stops" and "stop times", which already have defined meanings in GTFS, to refer to the same thing (a field and message type called replacement_stops) is confusing, requiring the reader to dig into the ReplacementStop message and discover that it provides information allowing the consumer to synthesize new stop times by adding delays to existing scheduled stop_times, referencing existing or newly created stops. I'd recommend revising terminology for consistency - readers will perceive terms to mean what they've been defined to mean within GTFS. Or at least rephrase the comment to explain more clearly.

repeated ReplacementStop replacement_stops = 4;

// 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.
extensions 1000 to 1999;

// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}

// An arbitrary string to identify this detour. The modifications_id MUST be unique for all currently active detours. The ID of each replacement trip is generated by concatenating modifications_id + '_' + trip_id.
required string modifications_id = 1;
gcamp marked this conversation as resolved.
Show resolved Hide resolved

// A list of trips affected by this detour. All trips linked by those trip_ids MUST have the same stop pattern. Two trips have the same stop pattern, if they visit the same stops in the same order, and have identical stop sequences.
repeated string trip_ids = 2;
gcamp marked this conversation as resolved.
Show resolved Hide resolved

// Dates on which the detour occurs, in the YYYYMMDD format. Producers SHOULD only transmit detours occurring within the next week.
repeated string service_dates = 3;

// The ID of the new shape for the modified trips. May refer to a new shape added using a GTFS-RT Shape message, or to an existing shape defined in the GTFS-Static feed’s shapes.txt.
optional string shape_id = 4;
gcamp marked this conversation as resolved.
Show resolved Hide resolved

// A list of modifications to apply to the affected trips.
repeated Modification modifications = 5;

// 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.
extensions 1000 to 1999;

// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}

message ReplacementStop {
// The difference in seconds between the arrival time at this stop and the arrival time at the reference stop. The reference stop is the stop prior to start_stop_sequence. If the modification begins at the first stop of the trip, then the first stop of the trip is the reference stop.
gcamp marked this conversation as resolved.
Show resolved Hide resolved
// This value MUST be monotonically increasing and may only be a negative number if the first stop of the original trip is the reference stop.
optional int32 travel_time_to_stop = 1;
gcamp marked this conversation as resolved.
Show resolved Hide resolved

// The replacement stop ID which will now be visited by the trip. May refer to a new stop added using a GTFS-RT Stop message, or to an existing stop defined in the GTFS-Static feed’s stops.txt. The stop MUST have location_type=0 (routable stops).
optional string stop_id = 2;
gcamp marked this conversation as resolved.
Show resolved Hide resolved

// 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.
extensions 1000 to 1999;

// The following extension IDs are reserved for private use by any organization.
extensions 9000 to 9999;
}
1 change: 1 addition & 0 deletions gtfs-realtime/spec/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The specification currently supports the following types of information:
* **Trip updates** - delays, cancellations, changed routes
* **Service alerts** - stop moved, unforeseen events affecting a station, route or the entire network
* **Vehicle positions** - information about the vehicles including location and congestion level
* **Trip modifications** - information about detours affecting a set of trips

A feed may, although not required to, combine entities of different types. Feeds are served via HTTP and updated frequently. The file itself is a regular binary file, so any type of webserver can host and serve the file (other transfer protocols might be used as well). Alternatively, web application servers could also be used which as a response to a valid HTTP GET request will return the feed. There are no constraints on how frequently nor on the exact method of how the feed should be updated or retrieved.

Expand Down
12 changes: 12 additions & 0 deletions gtfs-realtime/spec/en/feed-entities.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ use data on current speed and odometer readings from the vehicle.

[More about Vehicle Position updates...](vehicle-positions.md)

## Trip Modifications

#### "These trips are affected by a detour on certain days"

Trip modifications are used to describe detours which affect a set of trips.

A trip modification can cancel certain stops, adjust the timing for trips,
provide a new shape that trips will take and provide the location of temporary
stops along the way.

[More about Trip Modifications...](trip-modifications.md)

## Historical remark on feed types

Early versions of GTFS Realtime Specification required each feed to only contain
Expand Down
gcamp marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gtfs-realtime/spec/en/images/propagated_delay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading