C3 AI Documentation Home

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).

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
 }

See also

Was this page helpful?