Signomix provides a Data Query Language (DQL) that allows the service user to define the type and scope of data presented by dashboard controls and retrieved via the API.
A DQL expression consists of conditions and their parameters.
In general, a DQL expression has 2 possible forms:
[USING] [{report specification}] [GET] {data range definition} [WHERE] {definition of selection}] [AS] {definition of format}]
[GET] virtual
Whereby:
gET
, WHERE
, AS
keywords are informational only and may be omitted,last n
- retrieve the last n values of the specified dataaverage n [new v]
- retrieve the average value calculated from the last n
measurements, optionally including an additional value v
minimum n [new v]
- get the minimum value from the last n
measurements, optionally taking into account the additional value v
maximum n [new v]
- get the maximum value from the last n
measurements, optionally taking into account the additional value v
from {d1} [to {d2}]
- from the time point defined by {d1}
, to the time point defined by {d1}
.sback n
- include data recorded up to n
seconds earlierascending
- sort the result according toascending
measurement datedescending
- sort the result according to decreasing measurement dateThe sback
parameter is taken into account when retrieving the last measurements of the group. If it is not specified, data recorded up to one hour earlier are taken into account. This parameter allows you to discard data from sources that have not sent data recently (e.g., they stopped working, but there is historical data that should not be presented in the report).
Definition of time points {d1, d2}
:
yyyy-MM-dd'T'HH:mm:ss.SSSX
or yyyy-MM-dd'T'HH:mm:ssX
or as Unix time
(https://en.wikipedia.org/wiki/Unix_time) (can also be given as number of milliseconds)Xd
- X days backward from the current time - THIS DOES NOT WORK0d-TimeZone
- from the beginning of the current day in the specified time zone0d-UTC
from the beginning of the day in the UTC zone0M-Time
Zone-from the beginning of the current month in the specified time zone0M-UTC
from the beginning of the current month in the UTC zoneXh
- X hours backward from the current momentXm
- X minutes backward from the current momentExamples:
get last 10 last 10 from -2h to -1h from 2023-03-10T00:00:00Z to 2023-03-10T12:00:00Z from 2023-03-23T00:05:00~01:00 to 2023-03-23T00:07:00~01:00 from 1679363129 to 1679395529 from -0M-Europe_Warsaw from -0M-UTC from -0d-Europe/Warsaw to -0m
report className
- where className
is the name of the Java class implementing the report logic (see Report Server)project name
- retrieve data tagged with project name equal to name
status n
- retrieve data for which the device had a status equal to n
eui ident
ifier - retrieve data for a device with identifier identifier
group identifier
- getting data concerning devices belonging to the group with identifier identifier
channel definition
- retrieval of measurements with names contained in the definition
field - names separated by commas or *
sign meaning all names of measurements for the given sourcenotnull
- discard records (measurements with the same timestamp) that do not have a complete value (see channel definition
)Examples:
last 10 project test last 10 status 1 last 10 project test status 1 last 3 eui 010203040506 channel * last 3 eui 010203040506 channel temperature,humidity
All reports return data as a JSON object.
Note: The format definition is only applicable when retrieving device data using the
/api/iot/device/{eui}?{query}
API. It is not taken into account by desktop controls.
timeseries
- use of simplified JSON formatcsv.timeseries
- data in CSV formatExample of data returned by a query without format definition:
last 2 [ [ { "deviceEUI": "020305", "name": "temperature", "value":30.0, "timestamp":1679526300000, "stringValue":null }, { "deviceEUI": "020305", "name": "temperature", "value":30.0, "timestamp":1679526411476, "stringValue":null } ] ]
Example of simplified JSON format:
last 2 timeseries get last 2 as timeseries [ [ [ [ "timestamp", "temperature", "humidity" ], [ 1679526411476, 30.0, 46.0 ], [ 1679526300000, 30.0, 46.0 ] ] ] ]
CSV format example:
last 2 csv.timeseries timestamp,temperature,humidity 1679526411476,30.0,46.0 1679526300000,30.0,46.0