gtfs_rt_nyct

Types

pub type Date {
  Date(year: Int, month: Int, day: Int)
}

Constructors

  • Date(year: Int, month: Int, day: Int)

A selector for an entity in a GTFS feed.

pub type EntitySelector {
  EntitySelector(
    route_id: option.Option(String),
    trip: option.Option(TripDescriptor),
    stop_id: option.Option(String),
  )
}

Constructors

A definition (or update) of an entity in the transit feed.

pub type FeedEntity {
  FeedEntity(id: String, data: FeedEntityData)
}

Constructors

  • FeedEntity(id: String, data: FeedEntityData)

    Arguments

    id

    The ids are used only to provide incrementality support. The id should be unique within a FeedMessage. Consequent FeedMessages may contain FeedEntities with the same id. In case of a DIFFERENTIAL update the new FeedEntity with some id will replace the old FeedEntity with the same id (or delete it - see is_deleted below). The actual GTFS entities (e.g. stations, routes, trips) referenced by the feed must be specified by explicit selectors (see EntitySelector below for more info).

pub type FeedEntityData {
  TripUpdate(
    trip: TripDescriptor,
    stop_time_updates: List(StopTimeUpdate),
  )
  VehiclePosition(
    trip: TripDescriptor,
    current_stop_sequence: option.Option(Int),
    current_status: VehicleStopStatus,
    timestamp: UnixTime,
    stop_id: String,
  )
  Alert(
    informed_entities: List(EntitySelector),
    header_text: String,
  )
}

Constructors

  • TripUpdate(
      trip: TripDescriptor,
      stop_time_updates: List(StopTimeUpdate),
    )

    Realtime update of the progress of a vehicle along a trip. Depending on the value of ScheduleRelationship, a TripUpdate can specify:

    • A trip that proceeds along the schedule.
    • A trip that proceeds along a route but has no fixed schedule.
    • A trip that have been added or removed with regard to schedule.

    The updates can be for future, predicted arrival/departure events, or for past events that already occurred. Normally, updates should get more precise and more certain (see uncertainty below) as the events gets closer to current time. Even if that is not possible, the information for past events should be precise and certain. In particular, if an update points to time in the past but its update’s uncertainty is not 0, the client should conclude that the update is a (wrong) prediction and that the trip has not completed yet.

    Note that the update can describe a trip that is already completed. To this end, it is enough to provide an update for the last stop of the trip. If the time of that is in the past, the client will conclude from that that the whole trip is in the past (it is possible, although inconsequential, to also provide updates for preceding stops). This option is most relevant for a trip that has completed ahead of schedule, but according to the schedule, the trip is still proceeding at the current time. Removing the updates for this trip could make the client assume that the trip is still proceeding. Note that the feed provider is allowed, but not required, to purge past updates - this is one case where this would be practically useful.

    Arguments

    trip

    The Trip that this message applies to. There can be at most one TripUpdate entity for each actual trip instance. If there is none, that means there is no prediction information available. It does not mean that the trip is progressing according to schedule.

    stop_time_updates

    Updates to StopTimes for the trip (both future, i.e., predictions, and in some cases, past ones, i.e., those that already happened). The updates must be sorted by stop_sequence, and apply for all the following stops of the trip up to the next specified one.

    Example 1: For a trip with 20 stops, a StopTimeUpdate with arrival delay and departure delay of 0 for stop_sequence of the current stop means that the trip is exactly on time.

    Example 2: For the same trip instance, 3 StopTimeUpdates are provided:

    • delay of 5 min for stop_sequence 3
    • delay of 1 min for stop_sequence 8
    • delay of unspecified duration for stop_sequence 10 This will be interpreted as:
    • stop_sequences 3,4,5,6,7 have delay of 5 min.
    • stop_sequences 8,9 have delay of 1 min.
    • stop_sequences 10,… have unknown delay.
  • VehiclePosition(
      trip: TripDescriptor,
      current_stop_sequence: option.Option(Int),
      current_status: VehicleStopStatus,
      timestamp: UnixTime,
      stop_id: String,
    )

    Realtime positioning information for a given vehicle.

    Arguments

    trip

    The Trip that this vehicle is serving. Can be empty or partial if the vehicle can not be identified with a given trip instance.

    current_stop_sequence

    The stop sequence index of the current stop. The meaning of current_stop_sequence (i.e., the stop that it refers to) is determined by current_status.

    current_status

    If current_status is missing IN_TRANSIT_TO is assumed.

    stop_id

    Identifies the current stop. The value must be the same as in stops.txt in the corresponding GTFS feed.

  • Alert(
      informed_entities: List(EntitySelector),
      header_text: String,
    )

    An alert, indicating some sort of incident in the public transit network.

Metadata about a feed, included in feed messages.

pub type FeedHeader {
  FeedHeader(
    gtfs_realtime_version: String,
    timestamp: UnixTime,
    nyct: NyctHeader,
  )
}

Constructors

  • FeedHeader(
      gtfs_realtime_version: String,
      timestamp: UnixTime,
      nyct: NyctHeader,
    )

    Arguments

    gtfs_realtime_version

    Version of the feed specification. The current version is 2.0. Valid versions are “2.0”, “1.0”.

    timestamp

    This timestamp identifies the moment when the content of this feed has been created (in server time).

    nyct

    NYCT Subway extensions for the feed header

The contents of a feed message. A feed is a continuous stream of feed messages. Each message in the stream is obtained as a response to an appropriate HTTP GET request. A realtime feed is always defined with relation to an existing GTFS feed. All the entity ids are resolved with respect to the GTFS feed. Note that “required” and “optional” as stated in this file refer to Protocol Buffer cardinality, not semantic cardinality. See reference.md at https://github.com/google/transit/tree/master/gtfs-realtime for field semantic cardinality.

pub type FeedMessage {
  FeedMessage(header: FeedHeader, entity: List(FeedEntity))
}

Constructors

  • FeedMessage(header: FeedHeader, entity: List(FeedEntity))

    Arguments

    header

    Metadata about this feed and feed message.

    entity

    Contents of the feed.

NYCT Subway extensions for the feed header

pub type NyctHeader {
  NyctHeader(
    version: String,
    trip_replacement_periods: List(TripReplacementPeriod),
  )
}

Constructors

  • NyctHeader(
      version: String,
      trip_replacement_periods: List(TripReplacementPeriod),
    )

    Arguments

    version

    Version of the NYCT Subway extensions The current version is 1.0

    trip_replacement_periods

    For the NYCT Subway, the GTFS-realtime feed replaces any scheduled trip within the trip_replacement_period. This feed is a full dataset, it contains all trips starting in the trip_replacement_period. If a trip from the static GTFS is not found in the GTFS-realtime feed, it should be considered as cancelled. The replacement period can be different for each route, so here is a list of the routes where the trips in the feed replace all scheduled trips within the replacement period.

NYCT Subway extensions for the stop time update

pub type NyctStopTimeUpdate {
  NyctStopTimeUpdate(
    scheduled_track: option.Option(String),
    actual_track: option.Option(String),
  )
}

Constructors

  • NyctStopTimeUpdate(
      scheduled_track: option.Option(String),
      actual_track: option.Option(String),
    )

    Arguments

    scheduled_track

    Provides the planned station arrival track. The following is the Manhattan track configurations: 1: southbound local 2: southbound express 3: northbound express 4: northbound local

    In the Bronx (except Dyre Ave line) M: bi-directional express (in the AM express to Manhattan, in the PM express away).

    The Dyre Ave line is configured: 1: southbound 2: northbound 3: bi-directional

    actual_track

    This is the actual track that the train is operating on and can be used to determine if a train is operating according to its current schedule (plan).

    The actual track is known only shortly before the train reaches a station, typically not before it leaves the previous station. Therefore, the NYCT feed sets this field only for the first station of the remaining trip.

    Different actual and scheduled track is the result of manually rerouting a train off it scheduled path. When this occurs, prediction data may become unreliable since the train is no longer operating in accordance to its schedule. The rules engine for the ‘countdown’ clocks will remove this train from all schedule stations.

pub type NyctTripDescriptor {
  NyctTripDescriptor(
    train_id: option.Option(String),
    is_assigned: Bool,
  )
}

Constructors

  • NyctTripDescriptor(
      train_id: option.Option(String),
      is_assigned: Bool,
    )

    Arguments

    train_id

    The nyct_train_id is meant for internal use only. It provides an easy way to associated GTFS-realtime trip identifiers with NYCT rail operations identifier

    The ATS office system assigns unique train identification (Train ID) to each train operating within or ready to enter the mainline of the monitored territory. An example of this is 06 0123+ PEL/BBR and is decoded as follows:

    The first character represents the trip type designator. 0 identifies a scheduled revenue trip. Other revenue trip values that are a result of a change to the base schedule include; [= reroute], [/ skip stop], [$ turn train] also known as shortly lined service.

    The second character 6 represents the trip line i.e. number 6 train The third set of characters identify the decoded origin time. The last character may be blank “on the whole minute” or + “30 seconds”

    Note: Origin times will not change when there is a trip type change. This is followed by a three character “Origin Location” / “Destination Location”

    is_assigned

    This trip has been assigned to a physical train. If true, this trip is already underway or most likely will depart shortly.

    Train Assignment is a function of the Automatic Train Supervision (ATS) office system used by NYCT Rail Operations to monitor and track train movements. ATS provides the ability to “assign” the nyct_train_id attribute when a physical train is at its origin terminal. These assigned trips have the is_assigned field set in the TripDescriptor.

    When a train is at a terminal but has not been given a work program it is declared unassigned and is tagged as such. Unassigned trains can be moved to a storage location or assigned a nyct_train_id when a determination for service is made.

pub type StopId =
  String

Timing information for a single predicted event (either arrival or departure). Timing consists of delay and/or estimated time, and uncertainty.

  • delay should be used when the prediction is given relative to some existing schedule in GTFS.
  • time should be given whether there is a predicted schedule or not. If both time and delay are specified, time will take precedence (although normally, time, if given for a scheduled trip, should be equal to scheduled time in GTFS + delay).

Uncertainty applies equally to both time and delay. The uncertainty roughly specifies the expected error in true delay (but note, we don’t yet define its precise statistical meaning). It’s possible for the uncertainty to be 0, for example for trains that are driven under computer timing control.

pub type StopTimeEvent {
  StopTimeEvent(time: UnixTime)
}

Constructors

  • StopTimeEvent(time: UnixTime)

    Arguments

    time

    Event as absolute time.

Realtime update for arrival and/or departure events for a given stop on a trip. Updates can be supplied for both past and future events. The producer is allowed, although not required, to drop past events.

pub type StopTimeUpdate {
  StopTimeUpdate(
    arrival: option.Option(StopTimeEvent),
    departure: option.Option(StopTimeEvent),
    stop_id: String,
    nyct: NyctStopTimeUpdate,
  )
}

Constructors

pub type TripDescriptor {
  TripDescriptor(
    trip_id: String,
    start_date: option.Option(Date),
    route_id: String,
    nyct: NyctTripDescriptor,
  )
}

Constructors

pub type TripReplacementPeriod {
  TripReplacementPeriod(
    route_id: option.Option(String),
    replacement_period: UnixTime,
  )
}

Constructors

  • TripReplacementPeriod(
      route_id: option.Option(String),
      replacement_period: UnixTime,
    )

    Arguments

    route_id

    The replacement period is for this route

    replacement_period

    The start time is omitted, the end time is currently now + 30 minutes for all routes of the A division

POSIX/Unix time (ie number of seconds since January 1st 1970 00:00:00 UTC).

pub type UnixTime {
  UnixTime(Int)
}

Constructors

  • UnixTime(Int)
pub type VehicleStopStatus {
  Incoming
  Stopped
  InTransit
}

Constructors

  • Incoming

    The vehicle is just about to arrive at the stop (on a stop display, the vehicle symbol typically flashes).

  • Stopped

    The vehicle is standing at the stop.

  • InTransit

    The vehicle has departed and is in transit to the next stop.

Values

pub fn feed_message_decoder() -> decode.Decoder(FeedMessage)
Search Document