Skip to content

Commit cc3f244

Browse files
committed
Update protobuf and dependencies
1 parent 27067bf commit cc3f244

6 files changed

Lines changed: 679 additions & 395 deletions

File tree

mtaproto/feedresponse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class FeedResponse(object):
88

99
def __init__(self, response_string):
10-
self._pb_data = nyct_subway_pb2.gtfs_realtime_pb2.FeedMessage()
10+
self._pb_data = nyct_subway_pb2.gtfs__realtime__pb2.FeedMessage()
1111
self._pb_data.ParseFromString(response_string)
1212

1313
def __getattr__(self, name):

mtaproto/gtfs-realtime.proto

Lines changed: 136 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
1-
// Copyright 2011 Google Inc
1+
// Copyright 2015 The GTFS Specifications Authors.
22
//
3-
// The content of this file is licensed under the Creative Commons Attribution
4-
// 3.0 License.
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
56
//
6-
// Protocol definition file for GTFS-realtime.
7+
// http://www.apache.org/licenses/LICENSE-2.0
78
//
8-
// GTFS-realtime lets transit agencies provide consumers with realtime
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Protocol definition file for GTFS Realtime.
16+
//
17+
// GTFS Realtime lets transit agencies provide consumers with realtime
918
// information about disruptions to their service (stations closed, lines not
1019
// operating, important delays etc), location of their vehicles and expected
1120
// arrival times.
1221
//
1322
// This protocol is published at:
14-
// https://developers.google.com/transit/gtfs-realtime/
23+
// https://github.com/google/transit/tree/master/gtfs-realtime
1524

1625
syntax = "proto2";
1726
option java_package = "com.google.transit.realtime";
@@ -22,30 +31,32 @@ package transit_realtime;
2231
// obtained as a response to an appropriate HTTP GET request.
2332
// A realtime feed is always defined with relation to an existing GTFS feed.
2433
// All the entity ids are resolved with respect to the GTFS feed.
25-
//
26-
// A feed depends on some external configuration:
27-
// - The corresponding GTFS feed.
28-
// - Feed application (updates, positions or alerts). A feed should contain only
29-
// items of one specified application; all the other entities will be ignored.
30-
// - Polling frequency
34+
// Note that "required" and "optional" as stated in this file refer to Protocol
35+
// Buffer cardinality, not semantic cardinality. See reference.md at
36+
// https://github.com/google/transit/tree/master/gtfs-realtime for field
37+
// semantic cardinality.
3138
message FeedMessage {
32-
3339
// Metadata about this feed and feed message.
3440
required FeedHeader header = 1;
3541

3642
// Contents of the feed.
3743
repeated FeedEntity entity = 2;
44+
45+
// The extensions namespace allows 3rd-party developers to extend the
46+
// GTFS Realtime specification in order to add and evaluate new features and
47+
// modifications to the spec.
48+
extensions 1000 to 1999;
3849
}
3950

4051
// Metadata about a feed, included in feed messages.
4152
message FeedHeader {
4253
// Version of the feed specification.
43-
// The current version is 1.0.
54+
// The current version is 2.0.
4455
required string gtfs_realtime_version = 1;
4556

4657
// Determines whether the current fetch is incremental. Currently,
4758
// DIFFERENTIAL mode is unsupported and behavior is unspecified for feeds
48-
// that use this mode. There are discussions on the GTFS-realtime mailing
59+
// that use this mode. There are discussions on the GTFS Realtime mailing
4960
// list around fully specifying the behavior of DIFFERENTIAL mode and the
5061
// documentation will be updated when those discussions are finalized.
5162
enum Incrementality {
@@ -60,10 +71,9 @@ message FeedHeader {
6071
optional uint64 timestamp = 3;
6172

6273
// The extensions namespace allows 3rd-party developers to extend the
63-
// GTFS-realtime specification in order to add and evaluate new features and
74+
// GTFS Realtime specification in order to add and evaluate new features and
6475
// modifications to the spec.
6576
extensions 1000 to 1999;
66-
6777
}
6878

6979
// A definition (or update) of an entity in the transit feed.
@@ -87,6 +97,11 @@ message FeedEntity {
8797
optional TripUpdate trip_update = 3;
8898
optional VehiclePosition vehicle = 4;
8999
optional Alert alert = 5;
100+
101+
// The extensions namespace allows 3rd-party developers to extend the
102+
// GTFS Realtime Specification in order to add and evaluate new features and
103+
// modifications to the spec.
104+
extensions 1000 to 1999;
90105
}
91106

92107
//
@@ -162,7 +177,7 @@ message TripUpdate {
162177
optional int32 uncertainty = 3;
163178

164179
// The extensions namespace allows 3rd-party developers to extend the
165-
// GTFS-realtime specification in order to add and evaluate new features
180+
// GTFS Realtime Specification in order to add and evaluate new features
166181
// and modifications to the spec.
167182
extensions 1000 to 1999;
168183
}
@@ -207,10 +222,9 @@ message TripUpdate {
207222
[default = SCHEDULED];
208223

209224
// The extensions namespace allows 3rd-party developers to extend the
210-
// GTFS-realtime specification in order to add and evaluate new features
225+
// GTFS Realtime Specification in order to add and evaluate new features
211226
// and modifications to the spec.
212227
extensions 1000 to 1999;
213-
214228
}
215229

216230
// Updates to StopTimes for the trip (both future, i.e., predictions, and in
@@ -238,11 +252,30 @@ message TripUpdate {
238252
// time (i.e., the number of seconds since January 1st 1970 00:00:00 UTC).
239253
optional uint64 timestamp = 4;
240254

255+
// The current schedule deviation for the trip. Delay should only be
256+
// specified when the prediction is given relative to some existing schedule
257+
// in GTFS.
258+
//
259+
// Delay (in seconds) can be positive (meaning that the vehicle is late) or
260+
// negative (meaning that the vehicle is ahead of schedule). Delay of 0
261+
// means that the vehicle is exactly on time.
262+
//
263+
// Delay information in StopTimeUpdates take precedent of trip-level delay
264+
// information, such that trip-level delay is only propagated until the next
265+
// stop along the trip with a StopTimeUpdate delay value specified.
266+
//
267+
// Feed providers are strongly encouraged to provide a TripUpdate.timestamp
268+
// value indicating when the delay value was last updated, in order to
269+
// evaluate the freshness of the data.
270+
//
271+
// NOTE: This field is still experimental, and subject to change. It may be
272+
// formally adopted in the future.
273+
optional int32 delay = 5;
274+
241275
// The extensions namespace allows 3rd-party developers to extend the
242-
// GTFS-realtime specification in order to add and evaluate new features and
276+
// GTFS Realtime Specification in order to add and evaluate new features and
243277
// modifications to the spec.
244278
extensions 1000 to 1999;
245-
246279
}
247280

248281
// Realtime positioning information for a given vehicle.
@@ -296,8 +329,45 @@ message VehiclePosition {
296329
}
297330
optional CongestionLevel congestion_level = 6;
298331

332+
// The degree of passenger occupancy of the vehicle. This field is still
333+
// experimental, and subject to change. It may be formally adopted in the
334+
// future.
335+
enum OccupancyStatus {
336+
// The vehicle is considered empty by most measures, and has few or no
337+
// passengers onboard, but is still accepting passengers.
338+
EMPTY = 0;
339+
340+
// The vehicle has a relatively large percentage of seats available.
341+
// What percentage of free seats out of the total seats available is to be
342+
// considered large enough to fall into this category is determined at the
343+
// discretion of the producer.
344+
MANY_SEATS_AVAILABLE = 1;
345+
346+
// The vehicle has a relatively small percentage of seats available.
347+
// What percentage of free seats out of the total seats available is to be
348+
// considered small enough to fall into this category is determined at the
349+
// discretion of the feed producer.
350+
FEW_SEATS_AVAILABLE = 2;
351+
352+
// The vehicle can currently accommodate only standing passengers.
353+
STANDING_ROOM_ONLY = 3;
354+
355+
// The vehicle can currently accommodate only standing passengers
356+
// and has limited space for them.
357+
CRUSHED_STANDING_ROOM_ONLY = 4;
358+
359+
// The vehicle is considered full by most measures, but may still be
360+
// allowing passengers to board.
361+
FULL = 5;
362+
363+
// The vehicle is not accepting additional passengers.
364+
NOT_ACCEPTING_PASSENGERS = 6;
365+
366+
}
367+
optional OccupancyStatus occupancy_status = 9;
368+
299369
// The extensions namespace allows 3rd-party developers to extend the
300-
// GTFS-realtime specification in order to add and evaluate new features and
370+
// GTFS Realtime Specification in order to add and evaluate new features and
301371
// modifications to the spec.
302372
extensions 1000 to 1999;
303373
}
@@ -359,10 +429,9 @@ message Alert {
359429
optional TranslatedString description_text = 11;
360430

361431
// The extensions namespace allows 3rd-party developers to extend the
362-
// GTFS-realtime specification in order to add and evaluate new features
432+
// GTFS Realtime Specification in order to add and evaluate new features
363433
// and modifications to the spec.
364434
extensions 1000 to 1999;
365-
366435
}
367436

368437
//
@@ -381,6 +450,11 @@ message TimeRange {
381450
// 00:00:00 UTC).
382451
// If missing, the interval ends at plus infinity.
383452
optional uint64 end = 2;
453+
454+
// The extensions namespace allows 3rd-party developers to extend the
455+
// GTFS Realtime Specification in order to add and evaluate new features and
456+
// modifications to the spec.
457+
extensions 1000 to 1999;
384458
}
385459

386460
// A position.
@@ -404,7 +478,7 @@ message Position {
404478
optional float speed = 5;
405479

406480
// The extensions namespace allows 3rd-party developers to extend the
407-
// GTFS-realtime specification in order to add and evaluate new features and
481+
// GTFS Realtime Specification in order to add and evaluate new features and
408482
// modifications to the spec.
409483
extensions 1000 to 1999;
410484
}
@@ -420,20 +494,35 @@ message Position {
420494
// addition, absolute arrival/departure times must be provided.
421495
message TripDescriptor {
422496
// The trip_id from the GTFS feed that this selector refers to.
423-
// For non frequency expanded trips, this field is enough to uniquely identify
424-
// the trip. For frequency expanded, start_time and start_date might also be
497+
// For non frequency-based trips, this field is enough to uniquely identify
498+
// the trip. For frequency-based trip, start_time and start_date might also be
425499
// necessary.
426500
optional string trip_id = 1;
427501

428502
// The route_id from the GTFS that this selector refers to.
429503
optional string route_id = 5;
430504

431-
// The scheduled start time of this trip instance.
432-
// This field should be given only if the trip is frequency-expanded in the
433-
// GTFS feed. The value must precisely correspond to start_time specified for
434-
// the route in the GTFS feed plus some multiple of headway_secs.
435-
// Format of the field is same as that of GTFS/frequencies.txt/start_time,
436-
// e.g., 11:15:35 or 25:15:35.
505+
// The direction_id from the GTFS feed trips.txt file, indicating the
506+
// direction of travel for trips this selector refers to. This field is
507+
// still experimental, and subject to change. It may be formally adopted in
508+
// the future.
509+
optional uint32 direction_id = 6;
510+
511+
// The initially scheduled start time of this trip instance.
512+
// When the trip_id corresponds to a non-frequency-based trip, this field
513+
// should either be omitted or be equal to the value in the GTFS feed. When
514+
// the trip_id correponds to a frequency-based trip, the start_time must be
515+
// specified for trip updates and vehicle positions. If the trip corresponds
516+
// to exact_times=1 GTFS record, then start_time must be some multiple
517+
// (including zero) of headway_secs later than frequencies.txt start_time for
518+
// the corresponding time period. If the trip corresponds to exact_times=0,
519+
// then its start_time may be arbitrary, and is initially expected to be the
520+
// first departure of the trip. Once established, the start_time of this
521+
// frequency-based trip should be considered immutable, even if the first
522+
// departure time changes -- that time change may instead be reflected in a
523+
// StopTimeUpdate.
524+
// Format and semantics of the field is same as that of
525+
// GTFS/frequencies.txt/start_time, e.g., 11:15:35 or 25:15:35.
437526
optional string start_time = 2;
438527
// The scheduled start date of this trip instance.
439528
// Must be provided to disambiguate trips that are so late as to collide with
@@ -466,15 +555,13 @@ message TripDescriptor {
466555

467556
// A trip that existed in the schedule but was removed.
468557
CANCELED = 3;
469-
470558
}
471559
optional ScheduleRelationship schedule_relationship = 4;
472560

473561
// The extensions namespace allows 3rd-party developers to extend the
474-
// GTFS-realtime specification in order to add and evaluate new features and
562+
// GTFS Realtime Specification in order to add and evaluate new features and
475563
// modifications to the spec.
476564
extensions 1000 to 1999;
477-
478565
}
479566

480567
// Identification information for the vehicle performing the trip.
@@ -492,7 +579,7 @@ message VehicleDescriptor {
492579
optional string license_plate = 3;
493580

494581
// The extensions namespace allows 3rd-party developers to extend the
495-
// GTFS-realtime specification in order to add and evaluate new features and
582+
// GTFS Realtime Specification in order to add and evaluate new features and
496583
// modifications to the spec.
497584
extensions 1000 to 1999;
498585
}
@@ -511,10 +598,9 @@ message EntitySelector {
511598
optional string stop_id = 5;
512599

513600
// The extensions namespace allows 3rd-party developers to extend the
514-
// GTFS-realtime specification in order to add and evaluate new features and
601+
// GTFS Realtime Specification in order to add and evaluate new features and
515602
// modifications to the spec.
516603
extensions 1000 to 1999;
517-
518604
}
519605

520606
// An internationalized message containing per-language versions of a snippet of
@@ -535,7 +621,17 @@ message TranslatedString {
535621
// no i18n is done at all for the feed. At most one translation is
536622
// allowed to have an unspecified language tag.
537623
optional string language = 2;
624+
625+
// The extensions namespace allows 3rd-party developers to extend the
626+
// GTFS Realtime Specification in order to add and evaluate new features and
627+
// modifications to the spec.
628+
extensions 1000 to 1999;
538629
}
539630
// At least one translation must be provided.
540631
repeated Translation translation = 1;
632+
633+
// The extensions namespace allows 3rd-party developers to extend the
634+
// GTFS Realtime Specification in order to add and evaluate new features and
635+
// modifications to the spec.
636+
extensions 1000 to 1999;
541637
}

0 commit comments

Comments
 (0)