KPI group by Parameter properties
I wish to add a KPI Execution to count the "Number of accessions last updated by year" (and then by institute, by crop).
The current implementation requires me to define a Dimension
that will provide the Set<Long>
of the years that can then be passed to ExecutionDimension.
- That requires us to either maintain a
NumericListDimension
and add all year options manually. - Generates a number of observations for years we know no updates have happened.
Idea
Allow for GROUP BY clauses in Execution definition:
- Add group by
lastModifiedDate
modifierYEAR
aliaslastModifiedYear
Generates:select ..., year(_base.lastModifiedDate) lastModifiedYear ... group by lastModifiedYear where ...
- Add group by
lastModifiedDate
modifierMONTH
aliaslastModifiedMonth
Generates:select ..., year(_base.lastModifiedDate) lastModifiedYear, month(_base.lastModifiedDate) lastModifiedMonth ... group by lastModifiedYear, lastModifiedDate where ...
The resulting Observation will therefore go from being a single row with the value
(and stddev
for AVERAGE) to multiple rows for existing combinations of lastModifiedYear
and lastModifiedDate
.
The method private Observation getSingleObservation(Query query, Object... params) {}
should therefore return List<Observation>
and the Observation
needs to store the group-by's somewhere.
Could use the "DimensionKey"?