Skip to content

Create an Insight

Reference:

Field Description
start_date Start date for the Insight. Time is based on UTC timezone, formatted in RFC 3339.
end_date End date for the Insight. Time is based on UTC timezone, formatted in RFC 3339.
tag_name Tag name to categorize the Insight
resource The Asset that this Insight is related to. This is in KRN format (e.g. krn:asset:bp_01)
source The process that created this Insight. This can be a user or an automated process like a workload, Kelvin SmartApps™, etc. This is KRN format.
description Detailed description of the Insight.
contexts A list of associated resources with this Insight. This can be a Data Stream, Kelvin SmartApps™ or any other valid resource in the Kelvin Platform.

Create an Insight

You can read how to create insights in the Operations Tools documentation here.

API cURL Example
curl -X 'POST' \
  'https://<url.kelvin.ai>/api/v4/datatags/create' \
  -H 'Authorization: Bearer <Your Current Token>' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "start_date": "2024-02-06T18:22:18.582724Z",
  "end_date": "2024-02-06T19:22:18.582724Z",
  "tag_name": "Valve Change",
  "resource": "krn:asset:well_01",
  "source": "krn:wlappv:my-cluster/my-workload:my-app/1.2.0",
  "description": "A Valve was changed today.",
  "contexts": [
    "krn:datastream:temperature",
    "krn:datastream:pressure"
  ]
}'

The response will look like this;

API cURL Example Response
{
  "id": "0002bc79-b42f-461b-95d6-cf0a28ba87aa",
  "start_date": "2024-02-06T18:22:18.582724Z",
  "end_date": "2024-02-06T19:22:18.582724Z",
  "tag_name": "Valve Change",
  "resource": "krn:asset:well_01",
  "source": "krn:wlappv:my-cluster/my-workload:my-app/1.2.0",
  "description": "A Valve was changed today.",
  "contexts": [
    "krn:datastream:temperature",
    "krn:datastream:pressure"
  ],
  "created": "2024-02-06T19:22:18.582724Z",
  "updated": "2024-02-06T19:22:18.582724Z"
}
API Client (Python) Example
from kelvin.api.client import Client

# Login
client = Client(url="https://<url.kelvin.ai>", username="<your_username>")
client.login(password="<your_password>")

# Create Data Tag
response = client.data_tag.create_data_tag({
    "start_date": "2025-06-06T18:22:18.582724Z",
    "end_date": "2025-06-06T19:22:18.582724Z",
    "tag_name": "Valve Change",
    "resource": "krn:asset:pcp_01",
    "source": "krn:user:demo@kelvin.ai",
    "description": "A Valve was changed today.",
    "contexts": [
        "krn:datastream:temperature",
        "krn:appversion:smart-pcp/2.0.0"
    ]
    })

print(response)

The response will look like this;

API Client (Python) Example Response
id=UUID('c9699f02-20b9-40fc-98c2-5d1ddee35d41') start_date=datetime.datetime(2024, 6, 6, 18, 22, 18, 582724, tzinfo=datetime.timezone.utc) end_date=datetime.datetime(2024, 6, 6, 19, 22, 18, 582724, tzinfo=datetime.timezone.utc) tag_name='Valve Change' resource=KRNAsset(asset='pcp_01') source=KRN(krn:user:demo@kelvin.ai) description='A Valve was changed today.' contexts=[KRN(krn:datastream:temperature), KRNAppVersion(app='smart-pcp, version=2.0.0')] created=datetime.datetime(2024, 6, 14, 10, 25, 45, 76859, tzinfo=datetime.timezone.utc) updated=datetime.datetime(2024, 6, 14, 10, 25, 45, 76859, tzinfo=datetime.timezone.utc)