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

Get Sleep Logs JSON Summary is Incorrect

I am using the Get Sleep Logs endpoint described here: https://dev.fitbit.com/build/reference/web-api/sleep/

 

In the full response, there are two main keys: "sleep" and "summary". In the response below, the "summary" values do not seem to match to the data in "sleep". The data looks like a mix of both classic and stages sleep. Can anyone help explain the relationship between these two keys for this record? How does this classic record have stages sleep data associated with it?

 

{u'sleep': [{u'dateOfSleep': u'2018-09-26',
   u'duration': 25020000,
   u'efficiency': 96,
   u'endTime': u'2018-09-26T07:16:00.000',
   u'infoCode': 3,
   u'isMainSleep': True,
   u'levels': {u'data': [{u'dateTime': u'2018-09-26T00:18:30.000',
      u'level': u'restless',
      u'seconds': 120},
     {u'dateTime': u'2018-09-26T00:20:30.000',
      u'level': u'asleep',
      u'seconds': 3960},
     {u'dateTime': u'2018-09-26T01:26:30.000',
      u'level': u'restless',
      u'seconds': 60},
     {u'dateTime': u'2018-09-26T01:27:30.000',
      u'level': u'asleep',
      u'seconds': 7500},
     {u'dateTime': u'2018-09-26T03:32:30.000',
      u'level': u'restless',
      u'seconds': 60},
     {u'dateTime': u'2018-09-26T03:33:30.000',
      u'level': u'asleep',
      u'seconds': 3780},
     {u'dateTime': u'2018-09-26T04:36:30.000',
      u'level': u'restless',
      u'seconds': 60},
     {u'dateTime': u'2018-09-26T04:37:30.000',
      u'level': u'asleep',
      u'seconds': 4620},
     {u'dateTime': u'2018-09-26T05:54:30.000',
      u'level': u'restless',
      u'seconds': 480},
     {u'dateTime': u'2018-09-26T06:02:30.000',
      u'level': u'awake',
      u'seconds': 60},
     {u'dateTime': u'2018-09-26T06:03:30.000',
      u'level': u'asleep',
      u'seconds': 2640},
     {u'dateTime': u'2018-09-26T06:47:30.000',
      u'level': u'restless',
      u'seconds': 120},
     {u'dateTime': u'2018-09-26T06:49:30.000',
      u'level': u'asleep',
      u'seconds': 1500},
     {u'dateTime': u'2018-09-26T07:14:30.000',
      u'level': u'restless',
      u'seconds': 60}],
    u'summary': {u'asleep': {u'count': 0, u'minutes': 400},
     u'awake': {u'count': 1, u'minutes': 1},
     u'restless': {u'count': 7, u'minutes': 16}}},
   u'logId': 19682091511,
   u'minutesAfterWakeup': 1,
   u'minutesAsleep': 400,
   u'minutesAwake': 16,
   u'minutesToFallAsleep': 0,
   u'startTime': u'2018-09-26T00:18:30.000',
   u'timeInBed': 417,
   u'type': u'classic'}],
 u'summary': {u'stages': {u'deep': 73, u'light': 217, u'rem': 78, u'wake': 57},
  u'totalMinutesAsleep': 400,
  u'totalSleepRecords': 1,
  u'totalTimeInBed': 417}}
Best Answer
0 Votes
5 REPLIES 5

Hi @sleepy_dave,

 

Would you private message me the exact Sleep endpoint you're executing and the user-id for this response?  I'll take a look.

 

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Has this issue been resolved?  I am experiencing similar problems with the sleep data.

Best Answer
0 Votes

Hi @SunsetRunner,

 

Would you please describe the problem you are experiencing with the Sleep endpoints?

 

Thanks!

Gordon

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

I am seeing two problems that the original poster pointed out.  First, on occasion, I get the classic sleep levels: awake, restless, and asleep.  Second, in the summary, the sum of the deep, light, and rem totals do not match the total minutes asleep.

In addition, I have noticed sequences of consecutive nights where the summary totals for deep, light, and rem are exactly the same each night.  Often, on the first such night, the deep, light, and rem totals do match the total minutes asleep, but on the following nights, the total minutes asleep are different.

 

My data comes from an Alta HR and spans over a year.

Best Answer
0 Votes

Has any progress been made on these issues?

 

Best Answer
0 Votes