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

Sleep Stages - thirtyDayAvgMinutes endpoints

I'm currently exploring sleep stage data and I stumbled upon an issue when using the Get Sleep Logs by Date Range endpoint. 

 

When I pass 

https://api.fitbit.com/1.2/user/-/sleep/date/2017-06-29/2017-07-10.json

 I get the full responses, but it seems like the 30-day average in the sleep summary is being calculated upon date range request, and not actually stored data coming from Fitbit. 

 

For example, the above request results in the following for the first sleep record (dateOfSleep": "2017-06-29"summary data:

 

"summary": {
   "deep": {
     "count": 5,
     "minutes": 93,
     "thirtyDayAvgMinutes": 0
   },
   "light": {
     "count": 31,
     "minutes": 215,
     "thirtyDayAvgMinutes": 0
   },
   "rem": {
     "count": 8,
     "minutes": 72,
     "thirtyDayAvgMinutes": 0
   },
   "wake": {
     "count": 30,
     "minutes": 78,
     "thirtyDayAvgMinutes": 0
} }

The second record includes data for the thirtyDayAvgMinutes, but it is simply the actual values from the first record in the call. The third record of thirtyDayAvgMinutes value in the call is equal to (Record 1 + Record 2) / 2.

 

I believe it is  live processed data because when we run another call:

https://api.fitbit.com/1.2/user/-/sleep/date/2017-06-15/2017-07-01.json

the above request results in the following for the first sleep record (dateOfSleep": "2017-06-29"summary data:

"summary": {
   "deep": {
     "count": 5,
     "minutes": 93,
     "thirtyDayAvgMinutes": 87
   },
   "light": {
      "count": 31,
      "minutes": 215,
      "thirtyDayAvgMinutes": 228
   },
   "rem": {
      "count": 8,
      "minutes": 72,
      "thirtyDayAvgMinutes": 69
   },
   "wake": {
      "count": 30,
      "minutes": 78,
      "thirtyDayAvgMinutes": 73
   }
}

 

I'd love some clarification on this, or to better understand how we should be treating the thirtyDayAvgMinutes endpoint. 

 

Thanks!


Using Fitbits in Research? Check out Fitabase -- fitabase.com
Best Answer
0 Votes
0 REPLIES 0