Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[fitbit-api-bug] Rounding issue with timeseries data for Calories Out

Hi,

 

I have found that there is a rounding issue with data coming from the timeseries endpoint when compared to the intraday data. The API looks like it is flooring the sum, while the graph on the dashboard looks like it is ceiling the sum.

 

In the application I work on, we store the data locally so that we can present graphs to our users. Here is 1 data point for 1 user on November 1st of 2015:

mysql> SELECT SUM(STPS), SUM(DSTNC), SUM(CAL_OUT) FROM omd_usr_sonoa_ftbt WHERE DATAPT_TS = '2015-11-01';
+-----------+--------------------+--------------+
| SUM(STPS) | SUM(DSTNC)         | SUM(CAL_OUT) |
+-----------+--------------------+--------------+
|     17986 | 13.580129999999999 |         3355 |
+-----------+--------------------+--------------+
1 row in set (0.00 sec)

https://api.fitbit.com/1/user/-/activities/log/calories/date/2015-11-01/1d.json

 

 

As you can see, there is a slight discrepancy. But it gets worse when there's a lot of data. This is the difference over the month of November 2015 up to the 18th:

 

Best Answer
0 Votes
3 REPLIES 3

To further confirm, I queried the intraday dataset and ran a sum over dataset, then a floor & ceil to see if the values changed, and they did:

 

This is the dataset:

{                                                                                                                                                                                    |  1 <?php
  "activities-calories": [                                                                                                                                                           |  2 
    {                                                                                                                                                                                |  3 $json = file_get_contents(__DIR__ . '/calories.json');
      "dateTime": "2015-11-18",                                                                                                                                                      |  4 $json = json_decode($json);
      "value": "1283"                                                                                                                                                                |  5 
    }                                                                                                                                                                                |  6 $path = 'activities-calories-intraday';
  ],                                                                                                                                                                                 |  7 
  "activities-calories-intraday": {                                                                                                                                                  |  8 $sum = 0;
    "dataset": [           

Best Answer
0 Votes

Hi team, is there an update for this bug?

Best Answer
0 Votes

@JeremiahFitbit, @SunsetRunner, have there been any updates to this bug?

Best Answer
0 Votes