Time Series Data Treatments
Treatment defines how time series data should aggregate or disaggregate data points into a desired interval. The treatment options for time series are listed here. See AggOp Type (aggregation operation Type) for more detailed information on each treatment (links are also included with the definition).
- PREVIOUS: See AggOp#PREVIOUS for more information.
- EARLIEST: See AggOp#EARLIEST for more information.
- LATEST: See AggOp#LATEST for more information.
- AND: See AggOp#AND for more information.
- OR: See AggOp#OR for more information.
- COUNT: See AggOp#COUNT for more information.
- ROLLINGCOUNT: See AggOp#ROLLINGCOUNT for more information.
- INTEGRAL: See AggOp#INTEGRAL for more information.
- SUM: See AggOp#SUM for more information.
- PROD: See AggOp#PROD for more information.
- RATE: See AggOp#RATE for more information.
- AVG: See AggOp#AVG for more information.
- MIN: See AggOp#MIN for more information.
- MAX: See AggOp#MAX for more information.
- STDDEV: See AggOp#STDDEV for more information.
- VARIANCE: See AggOp#VARIANCE for more information.
- PERCENTILE: See AggOp#PERCENTILE for more information.
- MEDIAN: See AggOp#MEDIAN for more information.
- ALL: See AggOp#ALL for more information.
Example
Treatments are defined using a @ts annotation on an individual time series field.
In the following example, the SmartBulbMeasurement Type has a few treatments specified. For the fields lumens, power, temperature, and voltage, the treatment specified is average, and for the status field the treatment provided is previous.
JavaScript
entity type SmartBulbMeasurement mixes TimeseriesDataPoint<SmartBulbMeasurementSeries> schema name 'SMRT_BLB_MSRMNT' {
// The measured number of lumens.
@ts(treatment='avg')
lumens: double
// The measured power consumption.
@ts(treatment='avg')
power: double
// The measured temperature.
@ts(treatment='avg')
temperature: double
// The measured voltage.
@ts(treatment='avg')
voltage: double
// The status of the smart bulb (on or off).
@ts(treatment='previous')
status: int
}