Closed russellwjoel closed 5 years ago
This fits within my work for the week, I'm happy to be assigned this.
Might be good to pull my Fitbit sub folder structure within public folder: 3b71471b57fb8eee3c7c6f630341174a11466512
References: [1] https://nvie.com/posts/modifying-deeply-nested-structures/ [2] https://hackersandslackers.com/extract-data-from-complex-json-python/
As an additional side note:
activities/calories
activities/caloriesBMR
activities/steps
activities/distance
activities/floors
activities/elevation
activities/minutesSedentary
activities/minutesLightlyActive
activities/minutesFairlyActive
activities/minutesVeryActive
activities/activityCalories
An example API call using the time_series method from the Fitbit Python API helper library like so :
resource = 'activities/activityCalories'
act_stats=fitbit_client.time_series(resource, base_date='2019-01-01',end_date='2019-02-28')
Also here is a distinction between calories and activity calories. Looks like activity calories and BMR calories should add up to total calories...that doesn't always seem to be the case for example travel.hamster
:
Here is a similar question asked by someone : https://community.fitbit.com/t5/Blaze/quot-Calories-quot-vs-quot-Activity-Calories-quot/td-p/1913357
The reason for making these notes is that the data available through the daily summary is going to be obtained in different/more efficient ways. Some of the data that is not available through this efficient method is :
"activities": [
{
"activeDuration": 1024000,
"activityLevel": [
{
"minutes": 0,
"name": "sedentary"
},
{
"minutes": 1,
"name": "lightly"
},
{
"minutes": 12,
"name": "fairly"
},
{
"minutes": 4,
"name": "very"
}
],
"activityName": "Outdoor Bike",
"activityTypeId": 1071,
"averageHeartRate": 97,
"calories": 72,
"duration": 1024000,
"hasGps": false,
"heartRateLink": "https://api.fitbit.com/1.2/user/-/activities/heart/date/2019-02-27/2019-02-27/1sec/time/09:39:21/09:56:25.json",
"heartRateZones": [
{
"max": 78,
"min": 30,
"minutes": 1,
"name": "Out of Range"
},
{
"max": 109,
"min": 78,
"minutes": 13,
"name": "Fat Burn"
},
{
"max": 132,
"min": 109,
"minutes": 3,
"name": "Cardio"
},
{
"max": 220,
"min": 132,
"minutes": 0,
"name": "Peak"
}
],
"lastModified": "2019-02-26T23:10:58.000Z",
"logId": 20167544269,
"logType": "auto_detected",
"manualValuesSpecified": {
"calories": false,
"distance": false,
"steps": false
},
"originalDuration": 1024000,
"originalStartTime": "2019-02-27T09:39:21.000+11:00",
"shouldFetchDetails": false,
"startTime": "2019-02-27T09:39:21.000+11:00"
},
{
"activeDuration": 1076000,
"activityLevel": [
{
"minutes": 0,
"name": "sedentary"
},
{
"minutes": 12,
"name": "lightly"
},
{
"minutes": 6,
"name": "fairly"
},
{
"minutes": 0,
"name": "very"
}
],
"activityName": "Outdoor Bike",
"activityTypeId": 1071,
"averageHeartRate": 77,
"calories": 61,
"duration": 1076000,
"hasGps": false,
"heartRateLink": "https://api.fitbit.com/1.2/user/-/activities/heart/date/2019-02-27/2019-02-27/1sec/time/15:47:08/16:05:04.json",
"heartRateZones": [
{
"max": 78,
"min": 30,
"minutes": 10,
"name": "Out of Range"
},
{
"max": 109,
"min": 78,
"minutes": 8,
"name": "Fat Burn"
},
{
"max": 132,
"min": 109,
"minutes": 0,
"name": "Cardio"
},
{
"max": 220,
"min": 132,
"minutes": 0,
"name": "Peak"
}
],
"lastModified": "2019-02-27T06:19:49.000Z",
"logId": 20172904989,
"logType": "auto_detected",
"manualValuesSpecified": {
"calories": false,
"distance": false,
"steps": false
},
"originalDuration": 1076000,
"originalStartTime": "2019-02-27T15:47:08.000+11:00",
"shouldFetchDetails": false,
"startTime": "2019-02-27T15:47:08.000+11:00"
},
{
"activeDuration": 1384000,
"activityLevel": [
{
"minutes": 1,
"name": "sedentary"
},
{
"minutes": 14,
"name": "lightly"
},
{
"minutes": 7,
"name": "fairly"
},
{
"minutes": 1,
"name": "very"
}
],
"activityName": "Outdoor Bike",
"activityTypeId": 1071,
"averageHeartRate": 93,
"calories": 81,
"duration": 1384000,
"hasGps": false,
"heartRateLink": "https://api.fitbit.com/1.2/user/-/activities/heart/date/2019-02-27/2019-02-27/1sec/time/17:03:05/17:26:09.json",
"heartRateZones": [
{
"max": 78,
"min": 30,
"minutes": 1,
"name": "Out of Range"
},
{
"max": 109,
"min": 78,
"minutes": 20,
"name": "Fat Burn"
},
{
"max": 132,
"min": 109,
"minutes": 2,
"name": "Cardio"
},
{
"max": 220,
"min": 132,
"minutes": 0,
"name": "Peak"
}
],
"lastModified": "2019-02-27T06:47:55.000Z",
"logId": 20173266173,
"logType": "auto_detected",
"manualValuesSpecified": {
"calories": false,
"distance": false,
"steps": false
},
"originalDuration": 1384000,
"originalStartTime": "2019-02-27T17:03:05.000+11:00",
"shouldFetchDetails": false,
"startTime": "2019-02-27T17:03:05.000+11:00"
},
{
"activeDuration": 1023000,
"activityLevel": [
{
"minutes": 0,
"name": "sedentary"
},
{
"minutes": 3,
"name": "lightly"
},
{
"minutes": 11,
"name": "fairly"
},
{
"minutes": 3,
"name": "very"
}
],
"activityName": "Outdoor Bike",
"activityTypeId": 1071,
"averageHeartRate": 95,
"calories": 68,
"duration": 1023000,
"hasGps": false,
"heartRateLink": "https://api.fitbit.com/1.2/user/-/activities/heart/date/2019-02-27/2019-02-27/1sec/time/19:41:49/19:58:52.json",
"heartRateZones": [
{
"max": 78,
"min": 30,
"minutes": 1,
"name": "Out of Range"
},
{
"max": 109,
"min": 78,
"minutes": 13,
"name": "Fat Burn"
},
{
"max": 132,
"min": 109,
"minutes": 3,
"name": "Cardio"
},
{
"max": 220,
"min": 132,
"minutes": 0,
"name": "Peak"
}
],
"lastModified": "2019-02-27T19:31:12.240Z",
"logId": 20186097059,
"logType": "auto_detected",
"manualValuesSpecified": {
"calories": false,
"distance": false,
"steps": false
},
"originalDuration": 1023000,
"originalStartTime": "2019-02-27T19:41:49.000+11:00",
"shouldFetchDetails": false,
"startTime": "2019-02-27T19:41:49.000+11:00"
}
],
"goals": {
"activeMinutes": 30,
"calories": 2133,
"distance": 5,
"distanceUnit": "Mile",
"steps": 10000
},
"summary": {
"activityLevels": [
{
"distance": 0,
"minutes": 382,
"name": "sedentary"
},
{
"distance": 3.05,
"minutes": 310,
"name": "lightly"
},
{
"distance": 1.41,
"minutes": 67,
"name": "moderately"
},
{
"distance": 0.54,
"minutes": 25,
"name": "very"
}
],
"calories": {
"bmr": 1138,
"total": 2068
},
"customHeartRateZones": [],
"distance": 5.01,
"heartRateZones": [
{
"caloriesOut": 1297.06428,
"max": 78,
"min": 30,
"minutes": 1211,
"name": "Out of Range"
},
{
"caloriesOut": 604.33201,
"max": 109,
"min": 78,
"minutes": 192,
"name": "Fat Burn"
},
{
"caloriesOut": 156.79581,
"max": 132,
"min": 109,
"minutes": 31,
"name": "Cardio"
},
{
"caloriesOut": 0,
"max": 220,
"min": 132,
"minutes": 0,
"name": "Peak"
}
],
"steps": 11145
}
}```
Discrepancies between summary object calories and activitity time series calories -> total caloriesBMR -> bmr activityCalories -> activity_calories
Is your feature request related to a problem? Please describe. There are multiple scope categories for the fitbit API, The activity scope is used to track user activity data. https://dev.fitbit.com/build/reference/web-api/oauth2/#scope
This feature is similar to previous scope fitbit api implementations (e.g. sleep)
Describe the solution you'd like An endpoint in the application backend that accepts incoming API requests from fitbit for the activity scope.
Describe alternatives you've considered Combine all fitbit api calls into one singular call. that returns all scopes, as described in the API documentation.
When does it need to happen?
GanttStart: 02-19-2019
GanttDue: 02-26-2019