NXCALS-4306 Introduces WindowAggregationService to handle data aggregation actions
Example Usage
1) For variables
Variable variable = variableService.findOne(...).get();
WindowAggregationProperties aggregationProperties = WindowAggregationProperties.builder()
.timeWindow(start, end)
.interval(8, ChronoUnit.HOURS)
.algorithm(AggregationAlgorithm.AVG).build();
Dataset<Row> dataset = aggregationService.getData(variable, aggregationProperties);
2) For entities
Entity entity = entityService.findOne(...).get();
WindowAggregationProperties aggregationProperties = WindowAggregationProperties.builder()
.timeWindow(start, end)
.interval(2, ScaleTimeUnit.DAYS)
.algorithm(AggregationAlgorithm.INTERPOLATE.expandTimeWindowBy(2, 2, ChronoUnit.MONTHS))
.aggregationField("myEntityField").build();
Dataset<Row> dataset = dataScaleService.getData(entity, aggregationProperties);
Usage of expandTimeWindowBy
and aggregationField
are optional based on conditions for Variable data aggregations, as well.
COMPATIBILITY NOTE
Please make sure that this change is BACKWARDS COMPATIBLE and a new server will work correctly with clients using old APIs versions.
It may be that data sent in the new format will break the old clients.
In case of any potential incompatibility we have to inform our clients and schedule release & deployment with them.
@acc-logging-team - please have a look for approval.
Please describe the merge request here.
Closes NXCALS-4306
Edited by Grigorios Avgitidis