KPI templates

Optima provides a wide set of KPI templates.

A KPI template defines in an abstract way a KPI for a given KPI provider, specifying all default behaviors and the associated constraints.

Important:  KPI templates cannot be created through either APIs or by the Traffic Supervisor GUI.

A KPI template is defined by the following attributes:

KPI Attribute Required Description

template_id

YES

Integer type.

Unique identifier of the template.

name

YES

String type.

Name of the template.

query

YES

String type.

Preset query common to all the KPIs associated to the template.

editable

YES

Boolean type.

  • true: the KPI instance derived from the KPI template is editable.
  • false: Not editable.

enabled

YES

Boolean type.

  • true: The KPI instance is enabled to be computed.
  • false: Not enabled.

improvingDirection

YES

String type.

To understand if the current KPI value is better than the previous value, it is important to state if it is increasing (the higher value is better) or decreasing (the lower value is better).

Possible values:

  • INCREASING: the computed value is better if it is high.
  • DECREASING: the computed value is better if it is low.

tags

NO

String type.

It contains a list of comma-separated words, all being associated to a KPI instance.

unit

NO

String type.

It contains the measurement unit (if it is defined) of the KPI.

resultType

NO

String type.

It contains the result type of the KPI instance.

range

YES

JSON object.

Attributes used to define the limits of the KPI value.

"range": {
        "min": <min>,
        "max": <max>
    }

The properties "min" and "max" are integers.

If both values are specified, <max> must be greater than <min>.

entity

YES

String type.

A string to specify the type of entity associated with the KPI calculation.

Possible values:

  • STREET
  • LINK
  • LINE_ROUTE
  • STOP

qualityThreshold

NO

JSON object.

An array of two real values separated by a comma.

"qualityThreshold": [
        <min_value>,
        <max_value>
    ]

<min_value> and <max_value> must fall within the range and are used by the GUI to show the quality of the KPI.

The two threshold values are used to define three regions and each region is associated with a dedicated color in order to identify three quality levels of the KPI.

durablePoint

YES

Boolean type.

KPIs are calculated at discrete time and KPI values can be represented as distinct points on a chart (false).

  • true: KPI values shown on chart as a segment of length pointDuration.
  • false: KPI values shown on chart as distinct points.

pointDuration

YES

Real value.

It contains a value (in seconds) that is used only if durablePoints = true.

It specifies how long a point should persist over time (the length of the segment), representing how long the value of the KPI can be considered constant.

The correct value for pointDuration should coincide with: 1/simulation frequency.

If pointDuration is higher than 1/simulation frequency, you can see segments overlap. In the opposite case, it is possible to see a "jump" in the graphical representation.

selectionModes

YES

JSON object.

"selectionModes": [
        {
            "name": "<name>",
            "type": "<type>",
            "values": [
                {
                    "id": <id>,
                    "value": "<value>"
                }
            ]
        }
    ]

Each template can have one or more selection modes associated to the KPI calculation.

The available selection modes are:

  • MAP: select an area on the map.
  • ATTRIBUTE: manually select the features from a list.
  • ALL: select all the features of the specific mode.

Each of these selection modes can have multiple values (in the JSON object, see the "values" array), and you must choose only one value for each selection mode.

For example, the MAP selection mode can have values such as POLYGON or LINESTRING, while the ATTRIBUTE selection mode can be true or false (as well as ALL).

For ALL, the possible values are:

  • true: all the features of the specific model to be considered.
  • false: otherwise.

For ATTRIBUTE, the possible values are:

  • true: you can choose features from a list based on some attributes of the template (ID, FROM NODE, SPEED, etc...).
  • false: otherwise.

Tip:  Selection modes can be combined if ALL=false.

type

NO

String type.

A string representing the result type of the KPI.

category

NO

Sting type.

It contains a string to specify the category of the template.

A category is associated with a specific icon displayed on the GUI. An unknown category is associated with a default icon.

Category

Icon

QUALITY

KPI

PUT

ML Forecast

HARMONIZER

FLOW

QUEUE

SPEED

TRAVEL TIME

computationTypeCode

YES

String type.

It describes how the KPI is calculated according to a specific template.

Two are the possible values:

  • TRIGGERED: the KPI instance is calculated according to the data coming from the provider.
  • SCHEDULED: the KPI instance is calculated according to a schedule, independently of any providers.

dynamicAttributes

NO

A list of attributes that are used to fill the query (JSON format).

See → Dynamic attributes associated to KPI Templates.

defaultSchedule

NO

Integer type.

A default value to schedule the KPI computation.

This attribute, expressed in seconds, MUST BE set if:

computationTypeCode=SCHEDULED

Take care of the constraint:

defaultSchedule>= minSchedule

minSchedule

NO

Integer type.

A base value to schedule the KPI computation.

This attribute, expressed in seconds, MUST BE set if:

computationTypeCode=SCHEDULED

Take care of the constraint:

minSchedule<=defaultSchedule

AffectedLinks or AffectedStreets

NO

JSON object.

{
...
    "affectedLinks": [
        {
            "tail": <link_tail>,
            "idno": <link_idno>,
            "order": <link_order>
        }
...
}

The attributes of the object are:

tail:Integer referencing the tail node.

idno: Integer referencing the link (or street) idno.

order: Integer representing the order of the link (or street).

Example:

{
...
    ],
    "affectedLinks":[
        {
            "tail":3119676,
            "idno":3503373,
            "order":1
        },
        {
            "tail":2788659,
            "idno":3503359,
            "order":2
        }
    ]
...
}

AffectedLineRoute or AffectedStops

NO

JSON object.

{
...
    "affectedLines": [
        {
            "idno": <lines_idno>,
            "order": <lines_order>
        }
...
}

The attributes of the object are:

idno: Integer referencing the lines (or stop) idno.

order: Integer representing the order of the line (or stop).

Example:

{
...
    ],
    "affectedLine":[
        {
            "idno":3503111,
            "order":1
        },
        {
            "idno":3503222,
            "order":2
        }
    ]
...
}

For every KPI template, the set of values is established by product.

Important:  Some settings can be driven by the network context.