Repository navigation
intraday_time_series does not correctly retrieve the data #137
Description
Activity
- changed the title
[-]intraday_time_series does not currently retrieve the data[/-][+]intraday_time_series does not correctly retrieve the data[/+]on Jun 20, 2018 @sefyas This is a problem on Fitbit's side. You can prove this to yourself by using a program like Postman to make the API request directly for a date where the values don't match the dashboard, then compare the daily summary to the sum of the intraday values. Fitbit admits (somewhere on their forums a few years ago) the following conditions can cause a disparity between intraday values and daily summaries:
- User didn't sync for more than 7 days
- User's battery got too low
- User's timezone changed
- Firmware update occurred
In my experience, even a user with a charged battery that sync everyday and doesn't change timezones or update firmware can still experience this problem.
I wonder if there has been any update on this issue?
I'm unable to retrieve any intraday heartrate values, using the following code:
(Based on the great Medium tutorial by Stephen Hsu at https://towardsdatascience.com/collect-your-own-fitbit-data-with-python-ff145fa10873)import fitbit import gather_keys_oauth2 as Oauth2 import pandas as pd import datetime CLIENT_ID = '***' CLIENT_SECRET = '***' server = Oauth2.OAuth2Server(CLIENT_ID, CLIENT_SECRET) server.browser_authorize() ACCESS_TOKEN = str(server.fitbit.client.session.token['access_token']) REFRESH_TOKEN = str(server.fitbit.client.session.token['refresh_token']) auth2_client = fitbit.Fitbit(CLIENT_ID, CLIENT_SECRET, oauth2=True, access_token=ACCESS_TOKEN, refresh_token=REFRESH_TOKEN)[Browser-based authorization]
yesterday = str((datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y%m%d")) yesterday2 = str((datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%Y-%m-%d")) today = str(datetime.datetime.now().strftime("%Y%m%d")) fit_statsHR = auth2_client.intraday_time_series('activities/heart', base_date=yesterday2, detail_level='1sec')fit_statsHR contains only an 'activities-heart-rate' key. 'activities-heart-intraday' seems to be missing.
The complete contents of fit_statsHR are as follows:
In [44]: fit_statsHR Out[44]: {'activities-heart': [{'dateTime': '2018-10-29', 'value': {'customHeartRateZones': [], 'heartRateZones': [{'caloriesOut': 1316.40702, 'max': 96, 'min': 30, 'minutes': 911, 'name': 'Out of Range'}, {'caloriesOut': 393.42948, 'max': 135, 'min': 96, 'minutes': 60, 'name': 'Fat Burn'}, {'caloriesOut': 0, 'max': 164, 'min': 135, 'minutes': 0, 'name': 'Cardio'}, {'caloriesOut': 0, 'max': 220, 'min': 164, 'minutes': 0, 'name': 'Peak'}], 'restingHeartRate': 51}}]}Setting 'base_date = "today" ' yields the same result.
At the moment, I'm testing with iPython, in a Python 3 Miniconda+Windows 10 environment.
Thanks a lot in advance for any help and/or commiseration!
We want to obtain intraday step data and what we get is different from Fitbit dashboard. We have cases where we see zero steps for a particular date but the dashboard shows +3K steps. Or, dates where the total number of steps is different from what we see in dashboard.
This code illustrates the main steps of obtaining intra-day data and processing it (e.g. obtaining the daily counts)
The differences between the data we get and Fitbit dashboard do not seem to follow any pattern and appear in between dates where there is a complete match. So, I don’t think there is an issue with our calls given what we retrieve matches the dashboard some of the time; it can be an issue on the Fitbit side. Any thoughts / comment are much appreciated.