Skip to content

Export Data Quality Scores

You can export the actual calculated output from each of the asset/data streams for each available algorithm that is available. Kelvin provide six prebuilt algorithms and developers can also create their own custom data quality algorithms - all of which can be accessed using this method.

The key is using the KRN dqad instead of ad when collecting data from an asset/data stream's timeseries data.

Reference:

Field Description
start_time Start time for the Data Quality Score export. Time is based on UTC timezone, formatted in RFC 3339.
end_time End time for the Data Quality Score export. Time is based on UTC timezone, formatted in RFC 3339.
resource The Kelvin Resource Name (KRN) identifying the data quality metric. Format: krn:dqad:{algorithm}:{asset}/{datastream} for datastream-level or krn:dqasset:{algorithm}:{asset} for asset-level scores.
order Sort order of the returned data. Valid values: ASC (ascending) or DESC (descending). Default is ASC.
agg Optional aggregation function to apply to the data (e.g., avg, min, max, sum, count).
time_bucket Optional time interval for data aggregation (e.g., 1h for 1 hour, 5m for 5 minutes).
group_by_selector Boolean flag to group results by resource selector. Default is true.

Available Data Quality Algorithms:

Algorithm Description
score_data_quality Overall data quality score (0-100) calculated from all configured algorithms.
data_availability Measures data availability percentage within expected time windows.
timestamp_anomaly Detects anomalies in data timestamps (e.g., out-of-order, duplicate timestamps).
stale_detection Identifies when data becomes stale based on configured time windows.
out_of_range_detection Detects values outside configured min/max thresholds.
outlier_detection Identifies statistical outliers in the data.

Export Data Quality Scores for a Data Stream

In this example we will export the Data Quality Scores for a specific Data Stream.

There is no Kelvin UI option to download data quality score data.

API cURL Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/timeseries/range/download" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
        "start_time": "2026-02-18T10:00:00.000Z",
        "end_time": "2026-02-18T15:00:00.000Z",
        "order": "ASC",
        "selectors": [
          {
            "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
          }
        ],
        "group_by_selector": true
    }'

The response will contain downloadable timeseries data with quality scores:

API cURL Example Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
[
  {
    "timestamp": "2026-02-18T10:05:00.000Z",
    "payload": 100.0,
    "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
  },
  {
    "timestamp": "2026-02-18T10:10:00.000Z",
    "payload": 98.5,
    "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
  },
  {
    "timestamp": "2026-02-18T10:15:00.000Z",
    "payload": 95.2,
    "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
  }
]
API Client (Python) Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from kelvin.api.client import Client

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

# Export Data Quality Scores for a Data Stream
response = client.timeseries.download_timeseries_range(
    data={
        "start_time": "2026-02-18T10:00:00.000Z",
        "end_time": "2026-02-18T15:00:00.000Z",
        "order": "ASC",
        "selectors": [
            {
                "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
            }
        ],
        "group_by_selector": True
    }
)

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

# Print the result
print(df)

The response will look like this:

API Client (Python) Example Response
1
2
3
4
5
6
                      timestamp  payload                                          resource
0  2026-02-18T10:05:00.000000Z    100.0  krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream
1  2026-02-18T10:10:00.000000Z     98.5  krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream
2  2026-02-18T10:15:00.000000Z     95.2  krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream

[3 rows x 3 columns]

Export Data Quality Scores for an Asset

In this example we will export the aggregated Data Quality Scores for an entire Asset (across all Data Streams).

There is no Kelvin UI option to download data quality score data.

API cURL Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/timeseries/range/download" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
        "start_time": "2026-02-18T10:00:00.000Z",
        "end_time": "2026-02-18T15:00:00.000Z",
        "order": "ASC",
        "selectors": [
          {
            "resource": "krn:dqasset:score_data_quality:docs-demo-asset"
          }
        ],
        "group_by_selector": true
    }'

The response will contain the aggregated quality scores for the asset:

API cURL Example Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
[
  {
    "timestamp": "2026-02-18T10:05:00.000Z",
    "payload": 97.5,
    "resource": "krn:dqasset:score_data_quality:docs-demo-asset"
  },
  {
    "timestamp": "2026-02-18T10:10:00.000Z",
    "payload": 96.8,
    "resource": "krn:dqasset:score_data_quality:docs-demo-asset"
  },
  {
    "timestamp": "2026-02-18T10:15:00.000Z",
    "payload": 94.3,
    "resource": "krn:dqasset:score_data_quality:docs-demo-asset"
  }
]
API Client (Python) Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from kelvin.api.client import Client

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

# Export Asset-level Data Quality Scores
response = client.timeseries.download_timeseries_range(
    data={
        "start_time": "2026-02-18T10:00:00.000Z",
        "end_time": "2026-02-18T15:00:00.000Z",
        "order": "ASC",
        "selectors": [
            {
                "resource": "krn:dqasset:score_data_quality:docs-demo-asset"
            }
        ],
        "group_by_selector": True
    }
)

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

# Print the result
print(df)

The response will look like this:

API Client (Python) Example Response
1
2
3
4
5
6
                      timestamp  payload                                resource
0  2026-02-18T10:05:00.000000Z     97.5  krn:dqasset:score_data_quality:docs-demo-asset
1  2026-02-18T10:10:00.000000Z     96.8  krn:dqasset:score_data_quality:docs-demo-asset
2  2026-02-18T10:15:00.000000Z     94.3  krn:dqasset:score_data_quality:docs-demo-asset

[3 rows x 3 columns]

Export Multiple Data Quality Metrics

In this example we will export multiple Data Quality metrics simultaneously, including overall scores, data availability, and anomaly detection results.

There is no Kelvin UI option to download data quality score data.

API cURL Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
curl -X "POST" \
  "https://<url.kelvin.ai>/api/v4/timeseries/range/download" \
  -H "Authorization: Bearer <Your Current Token>" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
        "start_time": "2026-02-18T10:00:00.000Z",
        "end_time": "2026-02-18T15:00:00.000Z",
        "order": "ASC",
        "selectors": [
          {
            "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
          },
          {
            "resource": "krn:dqad:data_availability:docs-demo-asset/docs-demo-data-stream"
          },
          {
            "resource": "krn:dqad:timestamp_anomaly:docs-demo-asset/docs-demo-data-stream"
          },
          {
            "resource": "krn:dqad:out_of_range_detection:docs-demo-asset/docs-demo-data-stream"
          }
        ],
        "group_by_selector": true
    }'

The response will contain data for all requested quality metrics:

API cURL Example Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[
  {
    "timestamp": "2026-02-18T10:05:00.000Z",
    "payload": 100.0,
    "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
  },
  {
    "timestamp": "2026-02-18T10:05:00.000Z",
    "payload": 100.0,
    "resource": "krn:dqad:data_availability:docs-demo-asset/docs-demo-data-stream"
  },
  {
    "timestamp": "2026-02-18T10:10:00.000Z",
    "payload": 98.5,
    "resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"
  },
  {
    "timestamp": "2026-02-18T10:10:00.000Z",
    "payload": 95.0,
    "resource": "krn:dqad:data_availability:docs-demo-asset/docs-demo-data-stream"
  },
  {
    "timestamp": "2026-02-18T10:12:00.000Z",
    "payload": 1,
    "resource": "krn:dqad:timestamp_anomaly:docs-demo-asset/docs-demo-data-stream"
  },
  {
    "timestamp": "2026-02-18T10:14:00.000Z",
    "payload": 1,
    "resource": "krn:dqad:out_of_range_detection:docs-demo-asset/docs-demo-data-stream"
  }
]
API Client (Python) Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from kelvin.api.client import Client
import pandas as pd

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

# Export Multiple Data Quality Metrics
response = client.timeseries.download_timeseries_range(
    data={
        "start_time": "2026-02-18T10:00:00.000Z",
        "end_time": "2026-02-18T15:00:00.000Z",
        "order": "ASC",
        "selectors": [
            {"resource": "krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream"},
            {"resource": "krn:dqad:data_availability:docs-demo-asset/docs-demo-data-stream"},
            {"resource": "krn:dqad:timestamp_anomaly:docs-demo-asset/docs-demo-data-stream"},
            {"resource": "krn:dqad:out_of_range_detection:docs-demo-asset/docs-demo-data-stream"}
        ],
        "group_by_selector": True
    }
)

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

# Print the result
print(df)

# Optional: Pivot the data for easier analysis
pivot_df = df.pivot(index='timestamp', columns='resource', values='payload')
print("\nPivoted view:")
print(pivot_df)

The response will look like this:

API Client (Python) Example Response
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
                      timestamp  payload                                               resource
0  2026-02-18T10:05:00.000000Z    100.0       krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream
1  2026-02-18T10:05:00.000000Z    100.0          krn:dqad:data_availability:docs-demo-asset/docs-demo-data-stream
2  2026-02-18T10:10:00.000000Z     98.5       krn:dqad:score_data_quality:docs-demo-asset/docs-demo-data-stream
3  2026-02-18T10:10:00.000000Z     95.0          krn:dqad:data_availability:docs-demo-asset/docs-demo-data-stream
4  2026-02-18T10:12:00.000000Z      1.0        krn:dqad:timestamp_anomaly:docs-demo-asset/docs-demo-data-stream
5  2026-02-18T10:14:00.000000Z      1.0  krn:dqad:out_of_range_detection:docs-demo-asset/docs-demo-data-stream

[6 rows x 3 columns]

Pivoted view:
resource                  krn:dqad:data_availability:docs-demo-asset/docs-demo-data-stream  ...  krn:dqad:timestamp_anomaly:docs-demo-asset/docs-demo-data-stream
timestamp                                                                   ...                                                 
2026-02-18T10:05:00.000000Z                                        100.0  ...                                              NaN
2026-02-18T10:10:00.000000Z                                         95.0  ...                                              NaN
2026-02-18T10:12:00.000000Z                                          NaN  ...                                              1.0
2026-02-18T10:14:00.000000Z                                          NaN  ...                                              NaN

[4 rows x 4 columns]