Skip to content

Data tag messages

Insights & Data Tags

In the Kelvin UI, Data Tags are now known as Insights.

Data Tags may be depreciated in the Kelvin SDK and Kelvin API in future releases.

Keep an eye on future releases for updated announcements.

Insights Management

You can also manage your insights using the Kelvin SDK and Kelvin API.

You can read all the details in the Platform Administration in the Insights section.

Data Tag Messages

Insights are used to label Asset time series data. This has many applications such as;

  • For data scientists to use for machine learning training
  • For developers to have additional information beyond the raw data to review and improve Kelvin SmartApps™
  • For Operations to tag events linked to the time series data for historical records

On the Kelvin UI, the insights will show in the Data Explorer.

Kelvin SmartApps™ can publish a DataTag Message in order to label important events on a certain point in time (or time range) for a certain Asset.

Note

Operations can also their own add Insights manually through the Kelvin UI

The DataTag Object supports the following attributes:

Data Tag Attribute Required Description
start_date required Start date for the Data Tag. Time is based on UTC timezone, formatted in RFC 3339.
end_date optional End date for the Data Tag. Time is based on UTC timezone, formatted in RFC 3339.
tag_name required Tag name to categorize the Data Tag.
resource required The Asset that this Data Tag is related to. This is in KRN format (e.g. krn:asset:bp_01).
description optional Detailed description of the Data Tag.
contexts optional A list of KRNDatastream resources associated with this Data Tag. Each referenced data stream must be declared as an input or output in app.yaml.

app.yaml setup

To publish insights, declare the tag names your SmartApp will produce in the data_tags.outputs section of your app.yaml. Each entry is the tag name as a string:

app.yaml Example
1
2
3
4
data_tags:
  outputs:
    - anomaly_window
    - my_tag

Publish a Data Tag

This is how they can be created and published:

Create and Publish Data Tag Python Example
from datetime import timedelta, datetime

from kelvin.application import KelvinApp
from kelvin.message import DataTag
from kelvin.krn import KRNAsset, KRNDatastream

app = KelvinApp()

DATATAG_DURATION_SECS = 60

@app.timer(interval=10)
async def publish_data():

    now = datetime.now().astimezone()

    # Create and Publish DataTag
    await app.publish(
        DataTag(
            start_date=now - timedelta(seconds=DATATAG_DURATION_SECS),
            end_date=now,
            tag_name="my_tag",
            resource=KRNAsset("my_asset"),
            contexts=[KRNDatastream("my_datastream")],
        )
    )

app.run()

contexts restriction

contexts accepts only KRNDatastream instances, and each data stream referenced must be declared as an input or output in the SmartApp's app.yaml.