Data Tags
Data Tag Messages
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.
The DataTag Object supports the following attributes:
| 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 associated Kelvin resources with this Data Tag. (e.g. KRNDatastream, KRNApp, etc). |
This is how they can be created and published:
from datetime import timedelta, datetime
from kelvin.application import KelvinApp
from kelvin.message import DataTag
from kelvin.krn import KRNAsset, KRNDatastream
(...)
now = datetime.now()
# 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=[KRNApp("app_name"), KRNDatastream("my_datastream")]
)
)