Search code examples
fiwarefiware-cygnusfiware-sth-comet

Fiware STH: row data API not exposing metadata


I am using Cygnus with Mongo and sth sink to retrieve historical data.

In the current implementation of cygnus mongo sink the attribute metadata is not stored in the data base. So I updated cygnus to be able to store the attribute metadata. But when I use the STH-comet to retrieve the history, the API appreantly does not support retrieveing the attribute metadata.

Am I missing some kind of configuration or the API is not supporting the attribute metadata since the response that I am getting from STH-comet is:

    {
  "contextResponses": [
    {
      "contextElement": {
        "attributes": [
          {
            "name": "humidity",
            "values": [
              {
                "recvTime": "2017-03-08T08:06:11.463Z",
                "attrType": "Number",
                "attrValue": "999"
              },
              {
                "recvTime": "2017-03-08T08:10:54.199Z",
                "attrType": "Number",
                "attrValue": "3.06"
              }
            ]
          }
        ],
        "id": "Room1",
        "isPattern": false,
        "type": "Room"
      },
      "statusCode": {
        "code": "200",
        "reasonPhrase": "OK"
      }
    }
  ]
}

In the mongoDB data base I have this content:

{ "_id" : ObjectId("58bfbb7c973c5c22d258cffc"), "recvTime" : ISODate("2017-03-08T08:06:11.463Z"), "attrName" : "humidity", "attrType" : "Number", "attrValue" : "999", "attrMetadata" : [ ] }
{ "_id" : ObjectId("58bfbc93973c5c22d258cffd"), "recvTime" : ISODate("2017-03-08T08:10:54.199Z"), "attrName" : "humidity", "attrType" : "Number", "attrValue" : "3.06", "attrMetadata" : [ { "name" : "unit", "type" : "Text", "value" : "voltage" } ] }

In case the API is not supporting the retrieval of the attribute metadata, can this feature be added?

Thanks & Best regards.


Solution

  • STH and Cygnus are aligned with regards to the information stored in MongoDB, both raw and aggregated one. In this sense, because Cygnus originally did not support for attribute metadata in NGSIMongoSink (the one in charge of storing the information in raw format), STH do not support attribute metadata in its raw API either.

    As long as you have extended Cygnus functionality for this purpose, you'll have to extend STH API as well.