KPI API v1: Observed value on specific date
Create a new KPIReadController
V1 (for any authenticated user) with API endpoint /kpi/observations/{executionName}
that will:
- Locate the last execution before the date specified in query string (
?date=12-18-2018
) - It returns
List<Observation>
for the KPIExecutionRun
on that date:
[{
"id":337605,
"value":1.0,
"stdDev":null,
"dimensions":[
{"name":"instCode","value":"POL010"},
{"name":"boolean.yesno","value":"false"}
]
},...
]
Bonus points
Massage the List<Observation>
so that the JSON returned to the client for example above looks like:
{
"historic": {
"false": { "value":1.0, "stdDev":null },
"true": { "value":4.0, "stdDev":null },
}
}
Filter by historic=true
:
{
"institute.code": {
"POL001": { "value":112312.0, "stdDev":null },
}
}
Filtering observations
The user can also specify dimensions that must match:
-
?instCode=POL010
would filterexecutionRun.observations.any().observationKeys
bykey=instCode
andvalue=POL010
- Can we use
execution.dimensions#field
instead ofdimension.name
: exampleinstitute.code=POL010
? - Dimension "filters" provided by user are excluded from the results:
[{
"id":337605,
"value":1.0,
"stdDev":null,
"dimensions":[
{"name":"boolean.yesno","value":"false"}
]
}, {
"id":337609,
"value":4.0,
"stdDev":null,
"dimensions":[
{"name":"boolean.yesno","value":"true"}
]
}, ...
]