Skip to content
sheldonabrown edited this page Dec 11, 2012 · 1 revision

The Inference Engine serializes several Plain Old Java Objects (POJOs) as JSON and places them on the queue as input to the Transit Data Service. The JSON looks like this (with formatting added):


{ "recordTimestamp": 1354305180740, "vehicleId": "MTA NYCT_4064", "serviceDate": 1354251600000, "scheduleDeviation": 166, "blockId": "MTA NYCT_BX_20120902EA_E_GH_19620_BX24-401", "tripId": "MTA NYCT_20120902EA_087600_BX24_0040_BX5_312", "distanceAlongBlock": 96110.30211324863, "distanceAlongTrip": 2572.526096215748, "inferredLatitude": 40.84665918975547, "inferredLongitude": -73.82672839135192, "observedLatitude": 40.84664535522461, "observedLongitude": -73.82678985595703, "phase": "IN_PROGRESS", "status": "blockInf", "managementRecord": { "uuid": "8d0fea50-3b27-11e2-a2f1-1231391c6b0a", "inferenceIsEnabled": true, "lastUpdateTime": 1354305180740, "lastLocationUpdateTime": 1354305180740, "lastObservedLatitude": 40.84664535522461, "lastObservedLongitude": -73.82678985595703, "mostRecentObservedDestinationSignCode": "3240", "lastInferredDestinationSignCode": "3240", "inferenceEngineIsPrimary": true, "activeBundleId": "2012September_Bronx_r15_b01", "inferenceIsFormal": true, "depotId": "GH", "emergencyFlag": false, "lastInferredOperatorId": null, "inferredRunId": "BX5-312", "assignedRunId": "BX5-312" }, "runId": "BX5-312", "routeId": null, "bearing": 0 }

NycQueuedInferredLocationBean

The first Java Object serialized is NycQueuedInferredLocationBean. This bean serializes the outputs of the inference engine to the queue. Its attributes are explained below.

Attribute Description Example Value
recordTimestamp timestamp in milliseconds since epoch. We favor the device timestamp except in instances where the device timestamp is wildly divergent from the received timestamp, indicating a possible device error. In those situations we trust our own internal timestamp more. 1354305180740
vehicleId bus number including agency MTA NYCT_4064”
serviceDate Date which driver’s run is assigned to. Only valid when inference-is-formal is set to FALSE and when bus is in revenue service. This field is formatted as a date and does not permit NULL or N/A values—-1/1/1970 should be interpreted as NULL. 1354251600000
scheduleDeviation Deviation from schedule, in seconds. Only present if inference is “formal.” Negative values indicate early, while positive values indicate delays. When Phase indicates a non-revenue move (e.g. “LAYOVER” or “DEADHEAD”) schedule deviation is the time until scheduled departure of the next revenue trip. 166
blockId Block ID is created by CIS during post-processing GTFS and STIF schedule data. MTA NYCT_BX_20120902EA_E_GH_19620_BX24-401”
tripId Trip ID, as presented in GTFS. For non-revenue trips or layovers, this may be the revenue following trip. MTA NYCT_20120902EA_087600_BX24_0040_BX5_312”
distanceAlongBlock distance along block in meters 96110.30211324863
distanceAlongTrip distance along trip in meters 2572.526096215748
inferredLatitude Latitude in decimal degrees. Inferred coordinates are generated to match the vehicle’s last position to a position directly on the geometry of the trip (from HASTUS) that it is assumed to be servicing. It is originally intended for the UI, but can be used when post-processing data to smooth out the error involved in GPS positioning. 40.84665918975547
inferredLongitude Inferred longitude in decimal degrees. -73.82672839135192
observedLatitude Latitude in decimal degress as reported by on-bus hardware 40.84664535522461
observedLongitude Longitude in decimal degress as reported by on-bus hardware -73.82678985595703
phase Phase inferred by CIS. Phases are presented in (TODO) Operational Phases. “IN_PROGRESS”
status Statuses are: DEFAULT: The default, normal status.
DEVIATED: The vehicle has deviated significantly from its normal route.
STALLED: The vehicle has not made any forward progress in a particular amount of time.
“blockInf”
runId Run number entered on bus. Numeric due to constraints imposed by farebox. “BX5-312”
routeId Route number entered on bus. Numeric due to constraints imposed by farebox. null
bearing not used 0
managementRecord see below {…}

Management Record

The NycQueuedInferredLocationBean composes one other bean, that of the NycVehicleManagmentStatusBean. Its attributes are explained below.

Attribute Description Example Value
uuid sythetic Id used to link real-time records to inference records; generated by http-queue-proxy “8d0fea50-3b27-11e2-a2f1-1231391c6b0a”
inferenceIsEnabled true if inference is turned on true
lastUpdateTime last filter update time for this vehicle 1354305180740
lastLocationUpdateTime last time a valid (non 0) location update was provided 1354305180740
lastObservedLatitude Last transmitted latitude in decimal degrees that was non-zero 40.84664535522461
lastObservedLongitude Last transmitted longitude in decimal degrees that was non-zero -73.82678985595703
mostRecentObservedDestinationSignCode most recent DSC from the bus “3240”
lastInferredDestinationSignCode most recent inferred DSC “3240”
inferenceEngineIsPrimary if inference engine is primary or secondary (for failover purposes) true
activeBundleId the bundle ID this result was generated with “2012September_Bronx_r15_b01”
inferenceIsFormal Boolean indicating confidence with vehicle inference. True signifies that there is a link between the run in UTS, to the pass number entered by the operator, and the behavior of the vehicle. If true, the returned record may include additional inferred trip and route information even if the vehicle is not in revenue service. true
depotId the depot this vehicle is assigned to in the vehicle assignment service “GH”
emergencyFlag the bus’ in-emergency flag false
lastInferredOperatorId last pass number inferred null
inferredRunId the run ID calculated by the system “BX5-312”
assignedRunId the run ID provided by the operator assignment service “BX5-312”
Clone this wiki locally