Search code examples
fiware

Best practices/Expected way to retrieve yearly KPI


Moving forward from here, I don't know What's the expected way/best practice to handle yearly KPIs to/from Orion?.

Consider the following scenario:

1-Consumers requests per-year city inhabitants KPI (city census in 2020, 2021, and so on).
Sometimes it requests current year, or even a few (ie:drawing population graph) making multiple requests.
2-Orion should forward the request to Context Provider
3-Context Provider returns keyPerformanceIndicator for a valid year

As doing one registration for each year population seems odd to me, perhaps, when registering the provider, I could use:

isPattern: 'true',
id: 'city.inhabitants:'

And then, provider application parsing year from 'city.inhabitants:2020'

Maybe I'm completely wrong, and Fiware is not expected to handle KPIs but entities, and each year is an attribute for population entity

Please, don't hesitate to correct anything you may find wrong. Any link/documentation would be great also.


Solution

  • Seems this could be easily solved using filters

    GET https://{{ORION}}/v2/entities/city.inhabitants?q=dateCreated=...

    however, forwarding filters to Context Providers doesn't seem to work:

    https://github.com/telefonicaid/fiware-orion/issues/2282