Different data values returned for same timestamp

Hi, I've been playing around with the Flukso API and I came across this strange behavior. There appears to be 2 different values returned for the same time value (in minute resolution) if the start and end date difference are large enough. For example, using:

curl -k -v -X GET -H "Accept: application/json" -H "X-Version: 1.0" -H "X-Token: 93cf47a00945ab989e3626a55275e145" "https://api.flukso.net/sensor/804b2ff9d7f048a23c853d46b19b25a0?start=1341895106&end=1341905106&resolution=minute&unit=watt"

The resulting last few data points are:

[1341904740,393],[1341904800,393],[1341904860,393],[1341904920,387],[1341904980,400],[1341905040,387],[1341905100,393],[1341905160,"nan"]

However using:

curl -k -v -X GET -H "Accept: application/json" -H "X-Version: 1.0" -H "X-Token: 93cf47a00945ab989e3626a55275e145" "https://api.flukso.net/sensor/804b2ff9d7f048a23c853d46b19b25a0?start=1341805106&end=1341905106&resolution=minute&unit=watt"

The results are:

[1341904740,229],[1341904800,355],[1341904860,302],[1341904920,378],[1341904980,310],[1341905040,291],[1341905100,295],[1341905160,"nan"]

I'm just curious as to why different data values are returned as the only difference in the 2 calls are the start and end time values.

Thanks for your help.

icarus75's picture

Hi Jeremy,

Thanks for reporting the bug. Erroneous values are returned when requesting an interval that triggers a database 'underflow' condition for a specific resolution.

E.g. a day's worth of data is kept in minute resolution. Requesting an interval with a start time older than one day will trigger the underflow and return bogus data. We'll fix this by including an extra check on start and end times in the API code. In the mean time, just limit the interval so that start begins after now - x where x:

  • 1 day for a minute resolution
  • 1 week for a 15min resolution
  • 1 year for a day resolution
  • 10 years for a week resolution

Cheers,
-Bart.