Skip to main content

Items

An item defines the specific details of an export request. A single export request can include multiple associated details, such as one for each metric that needs to be exported.

The export item includes all the parameters that describe which metrics are to be exported and how they should be exported. It provides options for:

  • specifying a custom name for the exported file
  • specifying the time range, which can be expressed using timestamps or ISO 8601 durations
  • determining how the exported data should be aggregated before being exported, using the decimation field
  • re-mapping the metric names sent by the device. For example, it allows you to associate the metric named temp with temperature

Decimation

As discussed above, decimation is used to aggregate data points sent by devices and stored in Connhex Cloud before being exported. Using decimation parameters, users can create meaningful reports starting from the raw metrics sent by devices.

Decimation

Why should anyone perform decimation before exporting data? Aren't we losing information? It really depends.

A typical use case is when you're sampling multiple metrics with the same frequency: some of those might be oversampled. This is where the decimation parameter proves useful - it removes the need for post processing.

Structure

Typescript

The following sections use Typescript to describe the structure of the data. This is done to facilitate the understanding of the data structure, but there's obviously no requirement to use Typescript in any of your code. For the complete API reference, please refer to the API documentation.

export interface CptExportItem {
target: string;
label?: string;
filename?: string;
from?: number;
to?: number;
decimation?: {
ds: `${number}${MessagesGranularity}`;
dsf?: MessagesAggregationAlgorithm; // defaults to Average
};
period?: string;
}
export enum MessagesGranularity {
Second = 's',
Minute = 'm',
Hour = 'h',
Day = 'd',
Week = 'w',
Month = 'M',
Year = 'y',
}
export enum MessagesAggregationAlgorithm {
Min = 'min',
Max = 'max',
Average = 'avg',
Sum = 'sum',
StandardDeviation = 'stddev',
Variance = 'variance',
}

To understand more about granularity and aggregation strategies, see here.