Skip to content

Download Data Tags

Available Guides

Reference:

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

Download Data Tags for an Asset

In this example we will retrieve all Data Tags for an Asset.

You can view and filter Data Tags for an Asset in the Data Explorer.

Go to the Data Explorer and select the Asset of interest.

Then click on the Data Tags icon to show the Data Tags in the right hand sidebar.

You will then see a list of the Data Tags for the Asset in the time range shown on the x-axis.

Be aware that not all Data Tags are shown here at the same time ! Only the Data Tags that have any reference in the time range of the x-axis.

You can use the seach to filter the list.

curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/datatags/list" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
        "start_date": "2024-07-01T12:00:00.000Z",
        "end_date": "2024-08-01T12:00:00.000Z",
        "resources": [
          "krn:asset:pcp_01"
        ]
    }'

The response will look like this;

{
   "pagination":{
      "next_page":null,
      "previous_page":null
   },
   "data":[
      {
         "id":"80d9c4f1-9aa6-4ac8-9b31-18f49640b282",
         "start_date":"2024-07-19T14:40:14.98Z",
         "end_date":"2024-07-20T02:40:14.98Z",
         "tag_name":"Maintenance event",
         "resource":"krn:asset:pcp_01",
         "source":"krn:user:demo@kelvin.ai",
         "description":null,
         "contexts":[],
         "created":"2024-04-20T13:48:15.09811Z",
         "updated":"2024-04-20T13:48:15.09811Z"
      }
   ]
}
from kelvin.api.client import Client

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

# List all Data Tags
response = client.data_tag.list_data_tag(
    data={
        "start_date": "2024-07-01T12:00:00.000Z",
        "end_date": "2024-08-01T12:00:00.000Z",
        "resources": [
            "krn:asset:pcp_01",
        ],
    }
)

# Convert the response into a Pandas DataFrame
df = response.to_df()

# Print the result
print(df)

The response will look like this;

                                     id                        start_date                          end_date           tag_name  ... description contexts                           created                           updated
0  80d9c4f1-9aa6-4ac8-9b31-18f49640b282  2024-04-19T14:40:14.980000+00:00  2024-04-20T02:40:14.980000+00:00  Maintenance event  ...        None       []  2024-04-20T13:48:15.098110+00:00  2024-04-20T13:48:15.098110+00:00

[1 rows x 10 columns]