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

HeartRate API returning 1440minutes even though tracker was not worn

With reference from https://dev.fitbit.com/build/reference/web-api/heart-rate/

API GET https://api.fitbit.com/1/user/[user-id]/activities/heart/date/[date]/[period].json
We have noticed that the above API returns an incorrect heart rate log of 1440 minutes (24hrs) even though tracker was not worn.

Example of response returned: https://imgur.com/a/if1dinQ

What could be wrong here?




 

Best Answer
0 Votes
12 REPLIES 12

Hi @hi_SG 

 

That is correct.  For accounts that have a device supporting heart rate, we record the time of 1440 minutes even if the device was not worn for the "out of range" zone.   You'll see the caloriesOut has a value.  We calculate the minimum number of calories your body would burn at rest based on your biometric data entered.  Since you're not wearing the device, we're assuming your body is still burning calories and you still have a heart rate.  We put that information in the "out of range" heart rate zone.

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

Hi @Gordon-C, thanks for the prompt reply.

 

Is this something new? Previously we were getting the caloriesOut and minutes being undefined when the user did not wear the tracker.

 

{
                            "max" : 90,
                            "min" : 30,
                            "name" : "Out of Range"
                        }, 
{
"max" : 90,
"min" : 30,
"name" : "Out of Range"
},


How can I then determine if the user has legitimately worn the device?

Best Answer
0 Votes

I know this has been the API response for a while.  What are you trying to achieve that requires knowing if a user legitimately worn a device?

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

Hi @hi_SG 

 

The only way I was able to generate the output you have for heart rate is to remove all devices of the account, including MobileTrack.   Probably the best way to determine if some is not wearing a device is to look at the activity data.   If you see sedentaryMinutes = 1440 and steps = 0, then you can assume the user is not wearing the device.

 

 

 

 

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

Hi Gordon, thanks for your reply, 

 

We are looking for two things in particular

 

1. See if the user has worn the device for a given day.

2. Calculate the total wear time (For how long the user wear the device) for a user for a given day in minutes ( and not just to see if the user has worn the device)

 

For 1, we could consider relying on the activity data to see if sedentaryMinutes = 1440 and steps =0 , but this could also happen if the user is resting / sleeping or having bed rest for the day , such that the is no steps? 

 

For 2, Do you have any suggestions ? Could we maybe consider the intra day heart rate data to determine (a non zero value) to see if a minute should be counted ? Or does the heart rate intra day also get set even if the user is not wearing the device ? 

 

Best Answer
0 Votes

From observation it seem like activities-heart-intraday.dataset will be an empty array if user did not wear the tracker. Seem like just checking the length of the activities-heart-intraday.dataset array might be a better approach to get the legitimate wear time. Can you confirm if this approach will be good @Gordon-C ?

 

heartrate-activities-intraday-dataset-empty-array.png

Best Answer
0 Votes

@Gordon-C Could you help to confirm that having non empty  activities-heart-intraday.dataset can be used as the indicator that user did wear the tracker and use it for calculating the wear time ? 

Best Answer
0 Votes

Hi @hi_SG,

 

Sorry for the delay.   I'm trying to determine if there is an absolute method for determining when someone is wearing a Fitbit device.  There isn't an endpoint that returns this information, so I'm trying to make a determination based on my own data.   Unfortunately, I'm not coming up with much. 

 

Probably the best way would be put some restrictions on your program.

  1. Your program should not support Fitbit's MobileTrack (treating your mobile phone as a pedometer) as the only tracker paired to the account.   This can be determined using the Get Devices endpoint.
  2. Your program should require the Fitbit device support heart rate. 

With these restrictions, you could use the Heart Rate Intraday endpoints to see if the heart beat data is collected throughout the day signifying the participant is wearing their device.   The reasons for these restrictions are:

  1. As you said, a user could have a sedentary day of laying in bed, therefore their heart rate would be in the sedentary zone all day.
  2. MobileTrack would collect steps, but not heart rate.   Using the activity tracker endpoints does not distinguish the difference between a Fitbit tracker/smartwatch vs MobileTrack recorded activity.  And, caloriesOut is adjusted based on data collected by MobileTrack.
  3. Activity calories could be an option, but I did find a scenario where activityCalories is zero and the user had steps.

 

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

Hi @Gordon-C Thanks for your reply.

 

From the program perspective our users are issued devices such as Ionic and Inspire which support Heart Rate data. Users are further advised to use only one device and not their personal device.

  • Would using intraday heart rate (i.e. empty [ ] in activities-heart-intraday.dataset) to determine how long the device was worn be the most effective measure?

 

On Restricting usage of the Fitbit MobileTrack

 

I am guessing that we will have to continuously keep checking the /devices api as users could set this up at any time. It might also be a sequential step to first verify /devices and then to obtain health data. I'm a bit cautious of this approach given the extra effort and edge cases. Would there be other preventive approaches?

 

Could I also double check if the Fitbit MobileTrack only captures steps (using pedometer)  and the Heart Rate will only come from a tracker device ? (I am assuming yes, based on your previous reply, just wanted to sure on this)

Best Answer
0 Votes

Hi @hi_SG 

 

The best way to determine if a user has MobileTrack enabled is to use the Get Devices endpoint to see what devices are paired with the account.  This endpoint will also state when the user last synced their device, so that information might be useful for you.

 

It is not technically possible to send heart rate data to a user's accounts through MobileTrack or a 3rd party application.  So, all heart rate data will come from the device.  This article will tell you what information is recorded by the mobile app/MobileTrack.

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

Hi @Gordon-C ,

Thanks for that clarification on MobileTrack. We'll not be using this in our research programme, and affected participants have noted that they are not using it either.

Back to the original topic : Due to the incorrect 1440 minutes in heart rate zones, would using intraday-heart-rate be the most efficient way to track duration HR trackers are worn? Or are there other options since heart rate zones should not be used?

Available Options:

  1. Use intraday heart rate (JSON "activities-heart-intraday.dataset") instead of heart rate zones (JSON "activities-heart.value.heartRateZones").

 

  1.  
Best Answer
0 Votes

For your specific use case, checking the output of the Intraday heart rate endpoint could be used to see if the device is being worn.

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