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

sleep data: discrepancy between csv extract and data from python API call

Hello, 

 

I am looking at my own Fitbit data and I see a discrepancy between the csv data extract and the data I pull via the .sleep or .get_sleep (they give me the same exact result) python libraries, for data on the same day. 

 

For instance below are some parameters I extracted from the Fitbit API:

endTime = 2018-01-04T06:42:00.000
startTime = 2018-01-03T23:49:30.000
'stages': {'deep': 27, 'light': 152, 'rem': 39, 'wake': 48},

'totalMinutesAsleep': 387,

'totalSleepRecords': 1,

'totalTimeInBed': 412

awakeningsCount = 12

 

While below are the same parameters taken from the csv extract, which matches what's on my phone app:

Start Time

End Time

Minutes Asleep

Minutes Awake

Number of Awakenings

Time in Bed

Minutes REM Sleep

Minutes Light Sleep

Minutes Deep Sleep

2018-01-03 11:49PM

2018-01-04 6:42AM

358

54

21

412

98

203

57

 

The Time in Bed is the same, but all other quantities differ.

Any insights would be much appreciated!

 

Thanks!

Best Answer
0 Votes
2 REPLIES 2

How did you get Fitbit to export a CSV instead of a JSON from the web API? 

Best Answer
0 Votes

Hello, 

 

you can export a CSV from your account by clicking on the Gear --> Settings --> Data Export. There you have the option to select CSV as file format. 

 

On a different note, I found the solution to my question. 
To have a agreement between the two calls I had to modify two variables in the fitbit/api.py file:

API_ENDPOINT and API_VERSION.

 

Best Answer
0 Votes