Code Monkey home page Code Monkey logo

telefonicaid / fiware-sth-comet Goto Github PK

View Code? Open in Web Editor NEW
26.0 14.0 28.0 2.36 MB

A component of the FIWARE ecosystem in charge of managing historical and aggregated time series context information

Home Page: https://fiware-sth-comet.rtfd.io

License: GNU Affero General Public License v3.0

Makefile 0.06% Shell 1.86% JavaScript 78.80% Python 10.72% API Blueprint 1.86% HTML 0.26% CSS 0.74% Gherkin 5.32% Dockerfile 0.38%
fiware sth historical-data

fiware-sth-comet's Introduction

FIWARE Short Time Historic (STH) - Comet

License Support badge Join the chat at https://gitter.im/telefonicaid/fiware-sth-comet
Quay badge Docker badge
Documentation badge CI Coverage Status Status CII Best Practices

The FIWARE Short Time Historic (STH) - Comet is in charge of managing (storing and retrieving) historical raw and aggregated time series context information about the evolution in time of context data (i.e., entity attribute values) registered in an Orion Context Broker instance.

All the communications between the STH and the Orion Context Broker as well as between the STH and any third party (typically for data retrieval) use standardized NGSI v1 interfaces.

This project is part of FIWARE. For more information check the FIWARE Catalogue entry for the Core Context Management.

📚 Documentation 🎓 Academy quay.io 🐳 Docker Hub 🎯 Roadmap

Contents

Background

This is the code repository for the FIWARE Short Time Historic (STH) - Comet, a component able to manage (storing and retrieving) historical context information as raw and aggregated time series context information.

This project is part of FIWARE.

Any feedback on this documentation is highly welcome, including bugs, typos or things you think should be included but aren't. You can use GitHub issues to provide feedback.

You can find the Users & Developers Manual and the Installation & Administration Manual on readthedocs.org

If this is your first contact with the STH component, it is highly recommended that you visit the Getting started guide where we introduce some basic concepts upon which the STH component leans on all the functionality it offers.

In case you are curious about why we called this component Comet, you can also visit the Why Comet section of the documentation.

Top

Install

Build and Install documentation for the STH component can be found at the Installation section of the documentation.

Top

Usage

Detailed information about how to run the STH component can be found at the Running the STH server section of the documentation.

Top

API overview

The STH component exposes a REST API covering 4 main functionalities:

  1. Historical raw and aggregated time series context information storage: The STH component exposes an endpoint where the notifications generated by a Context Broker instance (whenever an entity attribute value changes) can be received, processed and its associated raw and aggregated time series context information stored in an associated MongoDB database instance.
  2. Raw context information retrieval: The STH component allows the query and retrieval of historical raw context information, this is the concrete values an entity attribute took overtime, including the concrete timestamps when the value of the attributes changed.
  3. Aggregated time series context information: The STH component allows the query and retrieval of historical aggregated time series context information, this is information about the evolution of the entity attribute values grouped by time making it straight-forward to get distinct probabilistic measures such as means, standard deviations, maximum and minimum values, as well as the number of occurrences.
  4. Raw and aggregated time series context information removal: The STH component allows the removal of the raw and aggregated time series context information about the desired attributes and entities.

These APIs are detailed in the next section.

Top

API walkthrough

Detailed information about the API to store raw and aggregated time series context information can be found at the Storing historical raw and aggregated time series context information section of the documentation.

Detailed information about the API to retrieve raw context information can be found at the Getting historical raw context information section of the documentation.

Detailed information about the API to retrieve aggregated time series context information can be found at the Getting historical aggregated time series context information section of the documentation.

Detailed information about the API to remove raw and aggregated time series context information can be found at the Removing historical raw and aggregated time series context information section of the documentation.

Top

Testing

The STH component includes unit and performance tests.

Top

Unit tests

Detailed information about the unit tests included with the STH component code can be found at the Unit tests coverage section of the documentation.

Top

Performance tests

Detailed information about the performance tests included with the STH component code can be found at the Performance tests coverage section of the documentation.

Top

Advanced topics

If you are a developer, you may be interested in the following advanced topics:

Top

Roadmap

The roadmap of this FIWARE GE is described here.

Top

Support

Ask your thorough programmming questions using Stack Overflow and your general questions on FIWARE Q&A. In both cases please use the tag fiware-sth-comet.

Top

Alarms

Alarms documentation for the STH component can be found at the Alarms section of the documentation.

Top


License

STH-Comet is licensed under Affero General Public License (GPL) version 3. You can find a copy of this license in the repository.

© 2022 Telefonica Investigación y Desarrollo, S.A.U

Are there any legal issues with AGPL 3.0? Is it safe for me to use?

There is absolutely no problem in using a product licensed under AGPL 3.0. Issues with GPL (or AGPL) licenses are mostly related with the fact that different people assign different interpretations on the meaning of the term “derivate work” used in these licenses. Due to this, some people believe that there is a risk in just using software under GPL or AGPL licenses (even without modifying it).

For the avoidance of doubt, the owners of this software licensed under an AGPL 3.0 license wish to make a clarifying public statement as follows:

Please note that software derived as a result of modifying the source code of this software in order to fix a bug or incorporate enhancements is considered a derivative work of the product. Software that merely uses or aggregates (i.e. links to) an otherwise unmodified version of existing software is not considered a derivative work, and therefore it does not need to be released as under the same license, or even released as open source.

fiware-sth-comet's People

Contributors

adeeb-khan avatar alvarovega avatar anabelengp avatar antont avatar cesarjorgemartinez avatar dependabot[bot] avatar dmoranj avatar elswork avatar fgalan avatar frbattid avatar gauravp-nec avatar gitter-badger avatar gtorodelvalle avatar jason-fox avatar jcalderin avatar madhu-nec avatar madhu1029 avatar mapedraza avatar mcarracedo avatar mrutid avatar pasquy73 avatar pcoello25 avatar pooja1pathak avatar rsilnav avatar rstuven avatar samueltjackson avatar sanchit31 avatar vgarciag avatar xavierval avatar yatinarora-nec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fiware-sth-comet's Issues

create a version reponse

It is useful a GET request, ex: /version
and the response could be:
{
"version": "x.y.z",
"git_hash": "hash",
"compile_date": "date_time"
.... etc.
}

Init.d script error

When STH service is started without a tty sudo command gives an error. So command sudo is replaced by su command.

STH - command line param or configuration to subscribe

It would be nice to have that the STH component subscribes (or renews its subscription) to the interested NGSI entities once it starts up. The subscription parameters could be provided in a JSON file (mimicing the NGSI subscription payload) or via the command line.

Add a LICENSE file, and headers about that in all the source files

License header used in Cygnus:

/**
 * Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
 *
 * This file is part of fiware-cygnus (FI-WARE project).
 *
 * fiware-cygnus is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
 * General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 * fiware-cygnus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Affero General Public License along with fiware-cygnus. If not, see
 * http://www.gnu.org/licenses/.
 *
 * For those usages not covered by the GNU Affero General Public License please contact with iot_support at tid dot es
 */

LICENSE file used at Cygnus: https://github.com/telefonicaid/fiware-cygnus/blob/master/LICENSE

"Warning: possible EventEmitter memory leak detected" when running tests

Currently there is an issue (Automattic/mongoose#2073) about a possible memory leak when using #connection.useDB() which makes the following warning to be shown during the tests: "(node) warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit." Another issue in Node.js related to this issue can be located at nodejs/node-v0.x-archive#5108

There are also some StackOverflow questions about this issue at:

Error when starting STH Service in FIWARE Lab Machine as non root user

In a machine of the FIWARe Lab Ubuntu 12 I'm getting the following error, when I try to start the STH with a non-root user.

npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node ./src/sth_app
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node ./src/sth_app'.
npm ERR! This is most likely a problem with the fiware-comet package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./src/sth_app
npm ERR! You can get their info via:
npm ERR! npm owner ls fiware-comet
npm ERR! There is likely additional logging output above.
npm ERR! Linux 3.2.0-29-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1

npm ERR! Uncaught, unspecified "error" event.
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! http://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /home/gtoro/git/telefonicaid/IoT-STH/npm-debug.log

[STH] when the attribute value is not numeric occurs a timeout

Request:

url    : http://qa-bigdata-sth-01:8666/notify
headers: {'Fiware-Service': 'my_service', 'Content-Type': 'application/json', 'Fiware-ServicePath': '/my_service_path', 'Accept': 'application/json', 'User-Agent': 'orion/0.10.0'}
payload: {"originator": "localhost", "subscriptionId": "51c0ac9ed714fb3b37d7d5a8", "contextResponses": [{"contextElement": {"attributes": [{"type": "celcius", "name": "name_EVwy_0", "value": "gdfgfdgf"}], "type": "house", "id": "room2", "isPattern": "false"}, "statusCode": {"code": "200", "reasonPhrase": "OK"}}]}

Initially write in log:

time=2015-04-28T13:07:22.664Z | lvl=FATAL | corr=NA | trans=NA | op=OPER_STH_SERVER_LOG | msg=Attribute value not aggregatable, alarm_status=ALARM

But after occurs a timeout, responds Connection aborted and write in log:

time=2015-04-28T13:09:22.693Z | lvl=FATAL | corr=NA | trans=NA | op=OPER_STH_SERVER_LOG | msg=POST /notify, event={"request":"1430226442655:qa-bigdata-sth-01:22935:i91bidyo:10006","timestamp":1430226562693,"tags":["request","closed","error"],"internal":true}, alarm_status=ALARM

[STH] error getting timestamp without timezone

ex:

timestamp: 1430132288
GMT: Mon, 27 Apr 2015 10:58:08 GMT
Your time zone: lunes, 27 de abril de 2015 12:58:08 GMT+2:00 DST

This failure affect:

  • offset in hour resolution
          date: 1430146848.0
          date: 2015-04-27 15:00:48 GMT+2:00
          origin: 2015-04-27 00:00:00 
         { "offset" : 13, "samples" : 1, "sum" : 29.5, "sum2" : 870.25, "min" : 29.5, "max" : 29.5 }, 
  • origin in minute and second resolutions

minute:

        date: 1430146872.0
        human date: 2015-04-27 15:01:12
        origin: 2015-04-27 13:00:00

second:

        date: 1430146896.0
        human date: 2015-04-27 15:01:36
        origin: 2015-04-27 13:01:00

[STH] append recvTimeTs field in mongo raw

At the moment in docs is stored the recvTime field and is useful append the recvTimeTs field too.
Ex:

{
        "_id" : ObjectId("5541dfd60a673a1e0476ef90"),
        "recvTime" : ISODate("2015-04-30T07:55:02.383Z"),
        "entityId" : "room2",
        "entityType" : "room",
        "attrName" : "name_KB6o_0",
        "attrType" : "celcius",
        "attrValue" : "64.5"
}

Related to: telefonicaid/fiware-cygnus#372

[STH] using lastN in raw request, returns the first entries instead of the last entries

in Doc:

lastN: Only the requested last entries should be returned.

Example:
request with hLimit and hOffset:

.../STH/v1/contextEntities/type/room/id/room2/attributes/tempe_0?hLimit=20&hOffset=0&dateFrom=2014-02-14T00:00:00.000Z&dateTo=2016-02-14T23:59:59.99

Response:

{
    "contextResponses":[
        {
            "contextElement":{
                "attributes":[
                    {
                        "name":"tempe_0",
                        "values":[
                            {
                                "recvTime":"2015-05-06T08:23:00.673Z",
                                "attrValue":"28.1"
                            },
                            {
                                "recvTime":"2015-05-06T08:23:44.386Z",
                                "attrValue":"28.2"
                            },
                            {
                                "recvTime":"2015-05-06T08:25:45.924Z",
                                "attrValue":"83.3"
                            },
                            {
                                "recvTime":"2015-05-06T08:57:18.307Z",
                                "attrValue":"16.6"
                            },
                            {
                                "recvTime":"2015-05-06T08:59:08.819Z",
                                "attrValue":"1.9"
                            }
                        ]
                    }
                ],
                "id":"room2",
                "isPattern":false,
                "type":"room"
            },
            "statusCode":{
                "code":"200",
                "reasonPhrase":"OK"
            }
        }
    ]
}

request with lastN:

.../STH/v1/contextEntities/type/room/id/room2/attributes/tempe_0?lastN=1&dateFrom=2014-02-14T00:00:00.000Z&dateTo=2016-02-14T23:59:59.99

response:

{
    "contextResponses":[
        {
            "contextElement":{
                "attributes":[
                    {
                        "name":"tempe_0",
                        "values":[
                            {
                                "recvTime":"2015-05-06T08:23:00.673Z",
                                "attrValue":"28.1"
                            }
                        ]
                    }
                ],
                "id":"room2",
                "isPattern":false,
                "type":"room"
            },
            "statusCode":{
                "code":"200",
                "reasonPhrase":"OK"
            }
        }
    ]
}

Expected value:

  {
          "recvTime":"2015-05-06T08:59:08.819Z",
          "attrValue":"1.9"
  }

[STH] with a lot of notifications stop receiving requests

We launch a performance test during 4h with:
10 databases and 40 threads by database = 400 notifications at the same time
only one collection in each database, usin per-service-path model

we have saw that the throughput gradually descend to the point that sth, stops receiving the notifications

Direct Orion Context Broker to STH notifications (minimalist option)

Although the formal way to populate the time series database managed by the STH component is using the Cygnus component and the sink which will be developed for it, an alternative (so-called 'minimalist') way to populate this database is required.

This alternative mechanism will consist on the direct subscription by the STH component to an Orion Context Broker to receive notifications when the value of the attributes of interest change. As a consequence of these notifications, the STH will update the STH time series database updating the aggregated data for the concrete attributes.

Since both mechanisms (the formal one using Cygnus and the minimalist one using the STH directly) update the same database, it is the responsibility of the people or software in charge of creating the needed subscriptions to avoid updating the time series database twice. This would happen if both mechanisms are enabled for the same attribute of the same entity.

[STH] review alarm rules

Ex:

time=2015-04-16T15:27:37.874Z | lvl=FATAL | corr=NA | trans=NA | op=OPER_STH_SERVER_LOG | msg=Attribute value not aggregatable, alarm_status=ALARM

It could be WARN instead of FATAL

Incorrect response format in the README.md file

The response format described at https://github.com/telefonicaid/IoT-STH#-consuming-raw-data doesn't match with the current response of STH. "Values" should be a list of dictionaries.

Documentation raw data response format:

...
"attributes": [
                    {
                        "name": "attrName",
                        "values": [
                            {
                                {
                                    "recvTime": "2014-02-14T13:43:33.306Z",
                                    "attrValue": "21.28"
                                },
                                {
                                   "recvTime": "2014-02-14T13:43:34.636Z",
                                   "attrValue": "23.42"
                                },
                                {
                                    "recvTime": "2014-02-14T13:43:35.424Z",
                                    "attrValue": "22.12"
                                }
                            }
                        ]
                    }
                ],
...

Real response of STH:

...
"attributes": [
                    {
                        "name": "attrName",
                        "values": [
                                {
                                    "recvTime": "2014-02-14T13:43:33.306Z",
                                    "attrValue": "21.28"
                                },
                                {
                                   "recvTime": "2014-02-14T13:43:34.636Z",
                                   "attrValue": "23.42"
                                },
                                {
                                    "recvTime": "2014-02-14T13:43:35.424Z",
                                    "attrValue": "22.12"
                                }
                        ]
                    }
                ],
...

Prepopulate and feed aggregate data collections in 1 update (upsert) operation when MongoDB supports it

Currently the MongoDB $ positional update operator cannot be combined with upserts (see http://docs.mongodb.org/manual/reference/operator/update/positional/#upsert).

This issue is known and currently under study: https://jira.mongodb.org/browse/SERVER-3326
Once the issue is solved, it will be possible to prepopulate collections or update their docs using just one update operation like this:

  collection.update(
    // Returning all the update operators currently returned by getAggregateUpdate4Insert
    //  and getAggregateUpdate4Update in the same object
    getAggregateUpdateCondition(entityId, entityType, attrName, resolution, recvTime),
    getAggregateUpdate(attrValue),
    {
      upsert: true,
      writeConcern: {
        w: !isNaN(sthConfig.WRITE_CONCERN) ? parseInt(sthConfig.WRITE_CONCERN) : sthConfig.WRITE_CONCERN
      }
    },
    function (err) {
      callback(err);
    }
  );

Use Telefonica's checkstyle file

At least for Java developments, Telefónica has a telefonica_checkstyle.xml file that can be configured in your favourite IDE in order to check if the required style is being met.

I don't know if something similar exists for Javascript, I suppose so...

[STH] "/" from service path header is kept in mongo collection name

STR (Steps To Reproduce):

  1. For a Fiware-ServicePath header such as "/my_serv_path_0"

OBSERVED:
2. The collections created in MongoDB are named : sth_/my_serv_path_0 and sth_/my_serv_path_0.aggr

EXPECTED:
2. The collections created in MongoDB should be named : sth__my_serv_path_0 and sth__my_serv_path_0.aggr This is, subsituting "/" by "_".

Logging format should adhere to FIWARE guidelines

The logging format of the STH REST API implementation must adhere to the FIWARE format which is basically the following:

time= | lvl= | corr=<UNICA_CORRELATOR> | trans=<TRANSACTION_ID> | op=<OPERATION_TYPE> | msg=

where:

  • TIMESTAMP should be formatted in IEEE RFC 3339 format
  • LEVEL is the level of the log (INFO, WARN, ERROR, FATAL, DEBUG or TRACE)
  • UNICA_CORRELATOR is the value of the Unica-Correlator HTTP header
  • TRANSACTION_ID is an unique id to identify the ongoing transaction
  • OPERATION_TYPE is an id referred to the ongoing operation
  • MESSAGE typically contains some descriptive information about the event being logged

[STH] context with several attributes, gets lastest name for all

Request:

{
    "originator":"localhost",
    "subscriptionId":"51c0ac9ed714fb3b37d7d5a8",
    "contextResponses":[
        {
            "contextElement":{
                "attributes":[
                    {
                        "type":"celcius",
                        "name":"name_ni9w_0",
                        "value":"34"
                    },
                    {
                        "type":"celcius",
                        "name":"name_ni9w_1",
                        "value":"34"                       
                    },
                    {
                        "type":"celcius",
                        "name":"name_ni9w_2",
                        "value":"34"
                    }
                ],
                "type":"room",
                "id":"room2",
                "isPattern":"false"
            },
            "statusCode":{
                "code":"200",
                "reasonPhrase":"OK"
            }
        }
    ]

}

In mongo:

{ "_id" : ObjectId("5538ecbc3a4b153e0fba2837"), "timestamp" : ISODate("2015-04-23T12:59:40.272Z"), "entityId" : "room2", "entityType" : "room", "attrName" : "name_ni9w_2", "attrType" : "celcius", "attrValue" : "34" }
{ "_id" : ObjectId("5538ecbc3a4b153e0fba2838"), "timestamp" : ISODate("2015-04-23T12:59:40.272Z"), "entityId" : "room2", "entityType" : "room", "attrName" : "name_ni9w_2", "attrType" : "celcius", "attrValue" : "34" }
{ "_id" : ObjectId("5538ecbc3a4b153e0fba2839"), "timestamp" : ISODate("2015-04-23T12:59:40.272Z"), "entityId" : "room2", "entityType" : "room", "attrName" : "name_ni9w_2", "attrType" : "celcius", "attrValue" : "34" }

Package to distribute STH SW

STH software should have a way to distribute it bringing facilities to system administrators to install it, stop, start process and log maintenance.

Moreover this package features adds the possibility to admin one or more instance of STH in a simple way using standard init.d scripts

[STH] Is "neccesary/useful" the return the attribute type in the raw request?

example of raw response:

{"contextResponses":[
             {"contextElement":
                          {"attributes":[
                                      {"name":"tempe_0",
                                       "values":[
                                                 {"recvTime":"2015-05-06T08:23:00.673Z",
                                                  "attrValue":"28.1"},                     
                                                 {"recvTime":"2015-05-06T08:23:44.386Z",
                                                  "attrValue":"28.2"},  
                                                 {"recvTime":"2015-05-06T08:25:45.924Z",
                                                  "attrValue":"83.3"}
                                         ]
                                     }
                               ],
                           "id":"room2",
                           "isPattern":false,
                           "type":"room"},
              "statusCode":{
                      "code":"200",
                      "reasonPhrase":"OK"}
            }
  ]
}

The attribute type could change.

[STH] error when try to start the app, but it is running in the same port

Is neccesary the exception message? I recommend use a message more especific to the error.

Error returned:

net.js:1236
    throw new Error('Not running');
          ^
Error: Not running
    at Server.close (net.js:1236:11)
    at internals.Connection._stop (/home/sysadmin/git/IoT-STH/node_modules/hapi/lib/connection.js:188:19)
    at /home/sysadmin/git/IoT-STH/node_modules/hapi/lib/server.js:210:20
    at iterate (/home/sysadmin/git/IoT-STH/node_modules/hapi/node_modules/items/lib/index.js:35:13)
    at Object.exports.serial (/home/sysadmin/git/IoT-STH/node_modules/hapi/node_modules/items/lib/index.js:38:9)
    at internals.Server.stop (/home/sysadmin/git/IoT-STH/node_modules/hapi/lib/server.js:208:11)
    at Object.stopServer (/home/sysadmin/git/IoT-STH/src/sth_server.js:163:14)
    at exitGracefully (/home/sysadmin/git/IoT-STH/src/sth_app.js:45:15)
    at process.module.exports.startup (/home/sysadmin/git/IoT-STH/src/sth_app.js:114:12)
    at process.emit (events.js:95:17)
npm ERR! weird error 7
npm ERR! not ok code 0

Logging levels should be DEBUG, INFO, WARN, ERROR

Currently the logging levels are TRACE, INFO, DEBUG, WARN, ERROR, FATAL when they should be, in ascending order of importance and severity: DEBUG, INFO, WARN, ERROR

The INFO level should only include information about the starting and stopping of the server and its components as well as 1 minute interval "proof of life" including some KPIs of interest such as requests attended, memory consumption or any other which may be considered of interest.

Preliminary proof-of-concept (POC) of the STH REST API for querying

We need a proof-of-concept (PoC) implementation of the STH REST API for querying aggregated data.

This PoC will expose an HTTP endpoint attending GET requests accepting the following query parameters:

  • 'aggrMethod': Mandatory. The aggregation method. Valid values are: 'max', 'min', 'sum' and 'sum2'.
  • 'aggrPeriod': Mandatory. The resolution or the time-frame the aggregated data will be grouped by. Valid values are: 'month', 'day', 'hour', 'minute', 'second'.
  • 'dateFrom': Optional. The origin of time from which to return the aggregated data.
  • 'dateTo: Optional. The final time to which to return the aggregated data.

To this regard, the expected behaviour based on concretes requests is the following:

  • /STH/v1/contextEntities/type/quantity/id/entityId/attributes/attributeId?aggrMethod=min&aggrPeriod=second
    ** It should return the 'min' available aggregated data for the current minute grouped by seconds
  • /STH/v1/contextEntities/type/quantity/id/entityId/attributes/attributeId?aggrMethod=min&aggrPeriod=minute
    ** It should return the 'min' available aggregated data for the current hour grouped by minutes
  • /STH/v1/contextEntities/type/quantity/id/entityId/attributes/attributeId?aggrMethod=min&aggrPeriod=hour
    ** It should return the 'min' available aggregated data for the current day grouped by hours
  • /STH/v1/contextEntities/type/quantity/id/entityId/attributes/attributeId?aggrMethod=min&aggrPeriod=day
    ** It should return the 'min' available aggregated data for the current month grouped by days
    • /STH/v1/contextEntities/type/quantity/id/entityId/attributes/attributeId?aggrMethod=min&aggrPeriod=month
      ** It should return the 'min' available aggregated data for the current year grouped by months
    • /STH/v1/contextEntities/type/quantity/id/entityId/attributes/attributeId?aggrMethod=min&aggrPeriod=hour&dateFrom=2015-02-01T00:00:00&dateTo=2015-02-31T23:59:59
      ** It should return the 'min' available aggregated data from 2015-02-01T00:00:00 (UTC time) to 2015-02-31T23:59:59 (UTC time) grouped by hours

The response for a request for 'min' aggregated data grouped by hours looks like this:

[{"range":"day","resolution":"hour","type":"quantity","origin":"2015-02-27T00:00:00.000Z","values":[{"offset":0,"samples":0,"min":null},{"offset":1,"samples":2,"min":14.46},{"offset":2,"samples":0,"min":null},{"offset":3,"samples":0,"min":null},{"offset":4,"samples":0,"min":null},{"offset":5,"samples":0,"min":null},{"offset":6,"samples":0,"min":null},{"offset":7,"samples":0,"min":null},{"offset":8,"samples":0,"min":null},{"offset":9,"samples":0,"min":null},{"offset":10,"samples":2,"min":61.99},{"offset":11,"samples":0,"min":null},{"offset":12,"samples":0,"min":null},{"offset":13,"samples":0,"min":null},{"offset":14,"samples":0,"min":null},{"offset":15,"samples":0,"min":null},{"offset":16,"samples":0,"min":null},{"offset":17,"samples":0,"min":null},{"offset":18,"samples":0,"min":null},{"offset":19,"samples":0,"min":null},{"offset":20,"samples":0,"min":null},{"offset":21,"samples":0,"min":null},{"offset":22,"samples":0,"min":null},{"offset":23,"samples":0,"min":null}]}]

where:

  • range: It is the time range of each of the values returned. In this case, a day.
  • resolution: It is the resolution (also known as the aggregation period (aggrPeriod)). In this case, hours.
  • type: It is the type of data. In this case a quantity.
  • origin: It is the origin of time for each one of the values. It depends on the range and the resolution. For a resolution of hours and range of days, it is a concrete day for which there is aggregated data available grouped by hours.
  • offset: It depends on the range and the resolution. Since in this example the resolution is 'hours' and the range is 'days', it refers to the concrete hour in the day pointed by the origin.
  • samples: It is the number of samples (or events) available for a concrete offset from the origin.
  • min: In this concrete example it is the minimum value, but it could be any of the aggregation methods. In this case, It is the minimum value for the concrete offset from the origin. null if no samples for the offset.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.