Skip to content

Alert Setting (setAlert) Transmission

Registers and subscribes to the risk theme you wish to monitor.

Endpoints

wss://<api-server>/api/v1/alertapi/socket.io/

Sample Request

The following generates polygons for the area around Kobe Station with a tool such as http://geojson.io, and specifies it as a feature.

This means that data at the threshold value of 1 or more from the rm_panda theme around Kobe Station is transmitted in 60-second intervals from 2016-09-04 17-00-00.

{
  "method": "setAlert",
  "params": [{
    "type": "FeatureCollection",
    "name": "setAlert Sample",
    "features": [
      {
      "type": "Feature",
      "properties": {"theme":"rm_panda","threshold":1,"interval":60},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              135.17412900924683,
              34.67725557158714
            ],
            [
              135.1812744140625,
              34.67725557158714
            ],
            [
              135.1812744140625,
              34.68107587385229
            ],
            [
              135.17412900924683,
              34.68107587385229
            ],
            [
              135.17412900924683,
              34.67725557158714
            ]
          ]
        ]
      }
    }
    ]
  }, {
    "check_from": "2016-09-04 17-00-00+09",
    "notify_from": null,
    "speed": 30
}],
  "id": 1
}

Parameter

While WebSocket is used for exchanging Alert notification API messages, I/O information is exchanged using the JSON-RPC format.

params is specified with an array, and specifies the GeoJSON of the range you wish to acquire at the beginning. Next, values related to the replay environment are specified.

Key Value
method setAlert
params[0] GeoJSON
params[1] Replay Environment
id Optional

GeoJSON format

For the format of the GeoJSON section, a FeatureCollection is specified so that there is on Feature for each theme that is monitored.

Key Value Required
type FeatureCollection Required
name Optional text string Optional
features Feature Array Required

Each Feature format specifies theme, threshold values and intervals in the properties section, and geometry objects in the geometry section.

Key Value Required
type "Feature" text string Required
properties Associative array that includes theme, threshold and interval Required
geometry Polygon or MultiPolygon geometry object Required

Each of the values in properties are specified as shown below.

Key Value Required
comment Optional text string Can be omitted
theme Text string of the monitored theme Required
threshold Number for the risk threshold value Required
interval Number for the interval (in seconds) for performing checks Required
thinning_step Steps to thin out risk map (in seconds) Can be omitted, Cannot be specified at the same time as thinning_filter_step
thinning_filter_step Steps to thin out risk map (in seconds) Can be omitted, Cannot be specified at the same time as thinning_step

Thinnig

A function to slim down the total amount of data distributed by aggregating risk information for the number of seconds specified in the thinning_step.

If the thinning_step is NOT specified, all risk maps that satisfy the conditions during the time specified in the interval will be distributed as alerts (existing action).

If the thinning_step is specified, the specified time is defined as one step, the interval is divided into steps, and the condition is judged for each step. For example, if thinning is 10, only the earliest risk map that satisfies the conditions will be distributed as an alert for every 10 seconds.

If the thinning_step is specified, partially missing results may be returned because only one alert is distributed as a representative of the period. Use thinning_filter_step if you want to thin out only the time but not the risk.

Replay environment format

The format of the replay environment is specified as follows.

Key Value Required
check_from If the in-simulation time and date when monitoring is started is omitted, the current time and date is used.
The format is a text string in the form "YYYY-MM-DD hh:mm:ss+09".
Can be omitted
notify_from If the actual world time when notification is started is omitted, the current date and time is used.
The format is a text string in the form "YYYY-MM-DD hh:mm:ss+09".
Required
speed Value of in-simulation replay speed (times) Required