8.0 Add "lastNObservations" and "firstNObservations" query parameters
lastNObservations
and firstNObservations
are SDMX API query parameters that allow a user to specify the maximum number of observations to be returned counting back from the most recent or starting from the fist observation respectively. eg. https://ilo.org/ilostat-test/sdmx/ws/rest/data/ILO,DF_SDG_ALL_SDG_A871_SEX_AGE_RT,all?lastNObservations=1
According to the SDMX standard, it should also be possible to use lastN and firstN in combination with the startPeriod
and endPeriod
query parameters eg: https://ilo.org/ilostat-test/sdmx/ws/rest/data/ILO,DF_SDG_ALL_SDG_A871_SEX_AGE_RT,all?lastNObservations=1&endPeriod=2014
There is a very clear use case for this functionality. ABS clients have particularly asked for lastN as this allows them to set up one REST call that will always return the latest N observation periods without needing to specify a new startPeriod for every data release.
Parameter | Type | Description |
---|---|---|
firstNObservations | Positive integer | Integer specifying the maximum number of observations to be returned for each of the matching series, starting from the first observation |
lastNObservations | Positive integer | Integer specifying the maximum number of observations to be returned for each of the matching series, counting back from the most recent observation |
source: SDMX Standards Section 7, Parameters: https://github.com/sdmx-twg/sdmx-rest/blob/672226a7d4edcbf0c1ab3caf81e29c1f8b511381/v2_1/ws/rest/docs/4_4_data_queries.md
With the move to using the default NSI plugin, both functionalities should come out of the box.
The task is to:
-
Check that both cases are already covered by the default NSI plugin -
If it is not the case, complement it to provide the described functinality.
-
-
Make sure that the implementation is efficient and does not put under stress the service and the database. It is important to understand, that the current implementation might need extra tunning, taking in consideration that it is a generic implementation.