Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

concatenate observations from multiple datastreams in one query #2000

Open
borg1310 opened this issue Sep 4, 2024 · 1 comment
Open

concatenate observations from multiple datastreams in one query #2000

borg1310 opened this issue Sep 4, 2024 · 1 comment

Comments

@borg1310
Copy link

borg1310 commented Sep 4, 2024

hi,

i have a question about querying data from a frost server:
Is it possible to concatenate the observations of several data streams based on an attribute? In our database there are derived time series, that are composed of several data streams. The data stream sources of the combined data stream are assigned by a list of IDs or names in the properties. Here is an example:

{
  "@iot.selfLink": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)",
  "@iot.id": 4,
  "name": "SAK254-Concat",
  "description": "Concatenation of multiple datastreams from different SAK254 sensors at the Rappbode",
  "observationType": "OM_Observation",
  "unitOfMeasurement": {
    "name": "specific absorption coeeficient",
    "symbol": "1/m",
    "definition": "TBD"
  },
  "properties": {
    "sourceRelatedDatastreams": [
      1,
      2,
      3
    ]
  },
  "[email protected]": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/ObservedProperty",
  "[email protected]": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/Sensor",
  "[email protected]": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/Thing",
  "[email protected]": "http://localhost:8080/FROST-Server//v1.1/Datastreams(4)/Observations"
}

Is it possible to create a single query to concatenate and output all observations from the datastream sources contained in the derived datastream? Only the derived datastream should be known.

thanks in advance

best regards,

juergen

@DanielBertocci
Copy link

DanielBertocci commented Oct 1, 2024

@borg1310 one option you may use is EntityLinking but it is not available yet for one-to-many relationship.
If sourceRelatedDatastreams has always a fixed amount of elements (e.g. always 3 datastreams), a workaround for that would be create one specialized property for each of them.

A more dynamic alternative, that for the time being I would recommend, is to use different HTTP requests:

  • Datastreams(4)?$select=properties/sourceRelatedDatastreams to retrieve the ids.
  • Observations?$filter=Datastream/id in (x,y,z)&$orderBy=phenomenonTime asc where x,y and z are the ids you extracted from the previous query (1,2,3 from your example)

@github-staff github-staff deleted a comment from GenaroSalomone Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants