Statistical data
This function is used for getting information related to statistics
Request information
The external system must initiate a request to the API_SENSOR_STATISTICS
database function to obtain statistics data. A request for data must be made as follows:
url_smartroad/api/integration/stat?login=user_login&password=user_password&project_id=project_id
To ensure data filtering, it is allowed to use the additional query parameters listed in next table, which are indicated after writing the &
symbol.
Description of additional request address parameters
Parameter | Parameter type | Description |
---|---|---|
from to interval | string string int | Defines the time period and grouping interval for which the data is requested: - from – interval start date (inclusive) in ISO 8601 format (YYYY-MM-DD HH:MM: SS) - to – interval end date (inclusive) in ISO 8601 format (YYYY-MM-DD HH:MM: SS) - interval – time interval for data grouping, c. If the "interval" parameter is passed in the request, then the value will be used in the calculation. For example, if the value of the interval parameter is 60, then a statistical calculation will be performed for each minute minute of the time range |
interval (without from and to ) | int | The time interval (in seconds) for which historical data is requested, starting from the time of request. The default is 30 seconds. |
name | string | The name of the detector from which data is requested. It is allowed to specify multiple names separated by commas. DEPRECATED - undesired parameter |
sensor_id | string | Unique detector identifier. It is allowed to specify multiple identifiers separated by commas |
project_id | string | Required parameter. ID of the project for whose detectors you want to obtain statistics. |
time_zone | string | Time zone. The recording format is TZ identifiers . Instead of the slash character, you can use the underscore “_” . By default, the parameter value from the user profile is substituted. Example: Europe/Moscow |
Receiving data
When a correct request is received, the System generates a response message in JSON
format.
Example of a response message:
{
"message_id": "3e3d1708-d6dd-3742-d8c3-c179b99c758f",
"time_zone": "Europe/Moscow",
"excluded_sensors": [
"vr346hdb-fge5-ntsh-vege-dsgvg5467rfh",
"4kgk69vr-nlor-mldy-d4ib-gjypdjmldrtd",
"fwefw56v-f36v-v34l-adqc-dgg536bjk754"
],
"message_data": [
{
"sensor_id": "2ca11ec8-ef1f-4eac-89e8-18ee8b64680b",
"name": "Virtual",
"connected": false,
"lane_direction": [
0,
0
],
"direction": 1,
"data": [
{
"lanes": [
{
"lane": 0,
"volume": 0,
"class_0": 0,
"class_1": 0,
"class_2": 0,
"class_3": 0,
"class_4": 0,
"class_5": 0,
"gap_avg": 0,
"gap_sum": 0,
"speed_avg": 0,
"headway_avg": 0,
"headway_sum": 0,
"speed85_avg": 0,
"occupancy_per": "0000-00-00 00:00:00",
"occupancy_prc": 0,
"occupancy_sum": 0
},
{
"lane": 1,
"volume": 0,
"class_0": 0,
"class_1": 0,
"class_2": 0,
"class_3": 0,
"class_4": 0,
"class_5": 0,
"gap_avg": 0,
"gap_sum": 0,
"speed_avg": 0,
"headway_avg": 0,
"headway_sum": 0,
"speed85_avg": 0,
"occupancy_per": "0000-00-00 00:00:00",
"occupancy_prc": 0,
"occupancy_sum": 0
}
],
"range_end": "2024-10-02T11:37:16+03:00",
"range_start": "2024-10-02T11:36:46+03:00",
"range_value": 1
}
]
}
]
}
Description of response message parameters
Parameter | Parameter type | Description |
---|---|---|
message_id | string | Message ID |
time_zone | string | Time zone. The recording format is TZ identifiers . Instead of the slash character, you can use the underscore “_” . By default, the parameter value from the user profile is substituted. Example: Europe/Moscow |
message_data | array | Nested data array |
sensor_id | string | Detector identifier |
excluded_sensors | string | Identifiers of detectors for which data cannot be obtained due to incorrect configuration |
name | string | Detector name |
connected | boolean | Detector connection status, possible values: true / false |
lane_direction | array of integers | Lane direction: - 0 – moving to the zero kilometer of the road; - 1 – movement from the zero kilometer of the road; - 2 – two-way traffic. |
direction | int | Detector installation direction: - 0 - to the zero kilometer of the road - 1 - from the zero kilometer of the road |
data | array | Nested array of elements |
lanes | array | Nested array of elements |
lane | int | Lane number. The stripes are counted starting from zero, from left to right. For TMS.11 series detectors, the band number is not transmitted. Meaning -1 means no parameter value |
volume | int | Number of recorded vehicles |
class_X | int | The number of recorded vehicles of a certain class depending on the length of the vehicle. The number of classes and vehicle length parameters for each class are determined in the System settings |
gap_avg | int | Average traffic interval for the period, measured between the front bumper of the first vehicle and the rear bumper of the second vehicle, p. |
gap_sum | int | The final driving interval for the period, measured between the front bumper of the first vehicle and the rear bumper of the second vehicle, p |
speed_avg | int | Average speed, km/h |
headway_avg | int | Average traffic interval, measured between the rear bumper of the first vehicle and the rear bumper of the second vehicle, p |
headway_sum | int | The final driving interval, measured between the rear bumper of the first vehicle and the rear bumper of the second vehicle, p. |
speed85_avg | int | Average speed of 85% of traffic flow, km/h . |
occupancy_per | string | Lane congestion in a given period, total time |
occupancy_prc | int | Lane congestion in a given period, percentage |
occupancy_sum | int | Traffic lane congestion in a given period, s |
range_end | string | End of the interval, in the format 2023-01-26T00:30:00+00:00 |
range_start | string | Beginning of the statistics selection period, in format 2023-01-26T00:30:00+00:00 |
range_value | int | Interval number in range |