diff --git a/gtfs-realtime/proto/gtfs-realtime.proto b/gtfs-realtime/proto/gtfs-realtime.proto index 76057b9d4..afa2ee476 100644 --- a/gtfs-realtime/proto/gtfs-realtime.proto +++ b/gtfs-realtime/proto/gtfs-realtime.proto @@ -221,6 +221,28 @@ message TripUpdate { optional ScheduleRelationship schedule_relationship = 5 [default = SCHEDULED]; + // Experimental field, subject to change + // PredictionType represent the source of data of the prediction + // This lets consumer know if they should display a + // real time symbol next to a departure and the type of prediction + // PredictionType is ignored when schedule_relationship = SKIPPED or NO_DATA + enum PredictionType { + // Update are based on information from a vehicle + // that is followed in real time + // This is the default + REALTIME = 0; + + // Update are based on information from a vehicle that was followed + // in real time but is imprecise. Imprecision can come from things like + // a bus losing connection after the start of the run. + IMPRECISE_REALTIME = 1; + + // Update are based on information from schedule but updated + // from what is present in the static GTFS due to control actions. + UPDATED_SCHEDULE = 2; + } + optional PredictionType prediction_type = 6 [default = REALTIME] + // 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. diff --git a/gtfs-realtime/spec/en/reference.md b/gtfs-realtime/spec/en/reference.md index 1e71bfeca..d05668e83 100644 --- a/gtfs-realtime/spec/en/reference.md +++ b/gtfs-realtime/spec/en/reference.md @@ -177,6 +177,21 @@ The update is linked to a specific stop either through stop_sequence or stop_id, | **arrival** | [StopTimeEvent](#message-stoptimeevent) | Conditionally required | One | If schedule_relationship is empty or SCHEDULED, either arrival or departure must be provided within a StopTimeUpdate - both fields cannot be empty. arrival and departure may both be empty when schedule_relationship is SKIPPED. If schedule_relationship is NO_DATA, arrival and departure must be empty. | | **departure** | [StopTimeEvent](#message-stoptimeevent) | Conditionally required | One | If schedule_relationship is empty or SCHEDULED, either arrival or departure must be provided within a StopTimeUpdate - both fields cannot be empty. arrival and departure may both be empty when schedule_relationship is SKIPPED. If schedule_relationship is NO_DATA, arrival and departure must be empty. | | **schedule_relationship** | [ScheduleRelationship](#enum-schedulerelationship) | Optional | One | The default relationship is SCHEDULED. | +| **prediction_type** | [PredictionType](#enum-predictiontype) | Optional | One | The default relationship is REALTIME. | + +## _enum_ PredictionType + +Experimental field, subject to change. +PredictionType represent the source of data of the prediction. This lets consumer adjust their display of the information depending on the source (for example, with a real time symbol). +PredictionType is ignored when schedule_relationship is SKIPPED or NO_DATA. + +#### Values + +| _**Value**_ | _**Comment**_ | +|-------------|---------------| +| **REALTIME** | This is the **default** behavior. Updates are based on information from a vehicle that is followed in real time. | +| **IMPRECISE_REALTIME** | Updates are based on information from a vehicle that was followed in real time but is imprecise. Imprecision can come from things like a bus losing connection after the start of the run, or when a vehicle is a the start of the run but start of the run is dependent on driver behavior. This value should be used when the prediction is not precise enough to show the real time indicator next to the predictions in other interfaces (ex bus stop displays) but that still have information based on real time condition. | +| **UPDATED_SCHEDULE** | Updates are based on information from schedule but updated from what is present in the static GTFS. This value should be used when changes are due to control action where the applicable schedule is different but when the vehicle has not been followed yet. | ## _enum_ ScheduleRelationship