Search code examples
sqlfiwarefiware-orionfiware-cygnuscratedb

Fiware Quantum Leap Date Query


I am currently using Quantum Leap/CrateDB to persist time series data through the Orion Context Broker.

After setting up the notification on Orion I can query data.

curl -X GET "http://localhost:8668/v2/entities/urn:ngsi-ld:Pmr_obs:001/attrs/slotStatus?limit=3" -H "Accept: application/json" -H "Fiware-Service: atos" -H "Fiware-ServicePath: /mtp"

Response

{
  "attrName": "slotStatus",
  "entityId": "urn:ngsi-ld:Pmr_obs:001",
  "index": [
    "2019-07-28T19:00:00.000+00:00",
    "2019-07-29T07:00:00.000+00:00",
    "2019-07-29T10:00:00.000+00:00"
  ],
  "values": [
    0,
    1,
    0
  ]
}

But when I try to query data over a specific period (between two dates), the server returns all the indices and the values and not for the period I select.

curl -X GET "http://localhost:8668/v2/entities/urn:ngsi-ld:Pmr_obs:001/attrs/slotStatus?dateFrom=2020-12-01T00:00:00.000Z&dateTo=2020-12-31T23:59:59.999Z" -H "Accept: application/json" -H "Fiware-Service: atos" -H "Fiware-ServicePath: /mtp"
Response (all the values from 2019 to end of 2020)

What is strange is that if I use an aggregate method it filters the data correctly using the specific date period.

curl -X GET "http://localhost:8668/v2/entities/urn:ngsi-ld:Pmr_obs:001/attrs/slotStatus?aggrMethod=count&dateFrom=2020-12-01&dateTo=2020-12-31" -H "Accept: application/json" -H "Fiware-Service: atos" -H "Fiware-ServicePath: /mtp"

Response

{
  "attrName": "slotStatus",
  "entityId": "urn:ngsi-ld:Pmr_obs:001",
  "index": [],
  "values": [
    1101
  ]
}

What should I do to only query data from a specific period without an aggregate method?

Thanks in advance.

quantumleap:0.8 crate:4.1.4


Solution

  • We investigated the issue.

    the query used contains dateFrom and dateTo but as per quantumleap's API specification it should be fromDate and toDate (which should work fine).