Solved

Get latest TimeSerie entry for a node/collection of TimeSeries

  • 3 August 2021
  • 1 reply
  • 125 views

Badge

Hi.

 

I’m currently working on an application where we need to check if a node (PLC/PC) have updated any timeseries within x amounts of hours.

 

The way we do it now is to get all timeseries recorded values in a time range, and check if any timeseries have any values. If there is an value on one timeserie, then we consider the node alive.

 

This can be time consuming, since each node can several hundreds/thousands of timeseries.

 

So my question is if there is a way to get the latest recorded value in a collection of timeseries within a timerange? Or just a recorded value in a timerange for a collection of timeseries.

 

In Cognite, we have an asset hierarchy, which preferably would look like this:

Rig

  • Node 1
    • TimeSerie1
    • TimeSerie2
    • ...
  • Node 2
    • TimeSerie1
    • TimeSerie2
    • ...
  • Node ...
    • TimeSerie1
    • TimeSerie2

But the hierarchy could also be completely flat, where all the timeseries are connected to the Rig.

 

Our externalIds for the timeseries are:

rigNumber.NodeNumber.SignalNumber

 

So all timeseries with the same rignumber and nodenumber are for a specific node, even though this might not be reflected in the asset structure.

 

Pseudo query would typically be:

SELECT * WHERE RigNumber == X AND NodeNumber == Y AND TimeStamp Between A AND B

icon

Best answer by Thomas Sjølshagen 4 August 2021, 08:37

View original

1 reply

Userlevel 3

Hi Morten,

At this time, unfortunately, we do not have a simple way of getting the last recorded value of a Time Series, except by scanning through the entire series as you describe. 

I’m adding this insight to our product requirements board for analysis and prioritization. 

PS: I’m assuming you’ve seen and are referring to something more advanced than the getLatest ( …/timeseries/data/latest) endpoint. - 

https://api.cognitedata.com/api/v1/projects/{project}/timeseries/data/latest

 

Reply