Two enhancements to measurements api to allow jexl formulae to be referenced as constants and more complex calculations which use previous samples.
A/ stored formulae
The current use case for jexl expressions expects the jexl formulae must be explicitly supplied in the query. However in our use case, we want to be able to store mathematical formulae and the constants used in formulae as string constants stored alongside the raw measurement data. This will allow us to create formulae for each measurement device which apply data corrections to raw measurements.
Use case: Cheap Iot environment sensors are inherently inaccurate and have non-linear response curves. However their measurements can be calibrated against accurate devices by applying a correction formulae to the raw retrieved data. However each device must needs a different formulae and so saving that formulae as a constant will make accurate data retrieval much easier to achieve.
B/ reference previous values in time series
The measurements API allows jexl expressions which can cross reference other measurements but not previous measurements in the time series.More complex data processing such as finite impulse response filters (FIR) require the ability to reference previous samples this enabling formulae such as y = a*fx( n ) + b*fx(n-1)+ c*fx(n-2)etc