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

Summary distances total = zero

Hi there.

 

We're developing a sync with the Fitbit API and have it working to get the last 5 days and import the total distance into our database.

 

While testing with users who sync their Fitbit with Strava or MyFitnessPal, it seems like taking the summary.distances.distance where "activity" = "total" doesn't capture all activity. 

 

Could you confirm how the user's total distance for the day should be retrieved or calculated?

 

{
  "activities": [
    {
      "activityId": 123,
      "activityParentId": 123,
      "activityParentName": "Run",
      "calories": 361,
      "description": "5 mph (12 min/mile)",
      "distance": 5.021599,
      "duration": 1316000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2016-02-16T22:47:21.000Z",
      "logId": 1693285900,
      "name": "Run",
      "startDate": "2016-02-13",
      "startTime": "07:27",
      "steps": 5518
    },
    {
      "activityId": 123,
      "activityParentId": 123,
      "activityParentName": "Running (jogging), 9 mph (6.5 min mile) (MyFitnessPal)",
      "calories": 498,
      "description": "",
      "distance": 0,
      "duration": 1260000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2016-02-13T10:54:50.000Z",
      "logId": 123,
      "name": "Running (jogging), 9 mph (6.5 min mile) (MyFitnessPal)",
      "startDate": "2016-02-13",
      "startTime": "07:30",
      "steps": 0
    }
  ],
  "goals": {
    "activeMinutes": 30,
    "caloriesOut": 2795,
    "distance": 8.05,
    "steps": 10000
  },
  "summary": {
    "activeScore": -1,
    "activityCalories": 385,
    "caloriesBMR": 1692,
    "caloriesOut": 2165,
    "distances": [
      {
        "activity": "Run",
        "distance": 5.021599
      },
      {
        "activity": "Running (jogging), 9 mph (6.5 min mile) (MyFitnessPal)",
        "distance": 0
      },
      {
        "activity": "total",
        "distance": 0
      },
      {
        "activity": "tracker",
        "distance": 0
      },
      {
        "activity": "loggedActivities",
        "distance": 5.021599
      },
      {
        "activity": "veryActive",
        "distance": 5.02
      },
      {
        "activity": "moderatelyActive",
        "distance": 0
      },
      {
        "activity": "lightlyActive",
        "distance": 0
      },
      {
        "activity": "sedentaryActive",
        "distance": 0
      }
    ],
    "fairlyActiveMinutes": 0,
    "lightlyActiveMinutes": 0,
    "marginalCalories": 344,
    "sedentaryMinutes": 1419,
    "steps": 0,
    "veryActiveMinutes": 21
  }
}

 

Best Answer
0 Votes
4 REPLIES 4

@papertank Hey, thanks for bringing this up. We'll look into this.

 

In the meantime, you can take "tracker" + "loggedActivities" to get the total distance for users.

 

It's worth noting that MFP activities will never include distance, so you would need to calculate that metric yourself based on speed and time. You would also need to check for duplicates because in this particular example you posted, it looks like those two activities are duplicates (logged 3 minutes apart). 

 

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

Thanks @AndrewFitbit.

 

I've updated our sync to sum the tracker + loggedActivities items.

Best Answer
0 Votes

@AndrewFitbit Could you give me some advice on the following day's response? We'd like to pull through time and/or distance including from MyFitnessPal, but even though there is a duration on the activity the lightly/farily/very active minutes for the day are zero:

 

{
  "activities": [
    {
      "activityId": 18461810,
      "activityParentId": 18461810,
      "activityParentName": "Swimming laps, freestyle, light/moderate effort (MyFitnessPal)",
      "calories": 100,
      "description": "",
      "distance": 0,
      "duration": 3600000,
      "hasStartTime": true,
      "isFavorite": false,
      "lastModified": "2016-02-17T22:10:22.000Z",
      "logId": 1703477183,
      "name": "Swimming laps, freestyle, light/moderate effort (MyFitnessPal)",
      "startDate": "2016-02-17",
      "startTime": "18:00",
      "steps": 0
    }
  ],
  "goals": {
    "activeMinutes": 30,
    "caloriesOut": 2795,
    "distance": 8.05,
    "steps": 10000
  },
  "summary": {
    "activeScore": -1,
    "activityCalories": 0,
    "caloriesBMR": 1692,
    "caloriesOut": 1721,
    "distances": [
      {
        "activity": "Swimming laps, freestyle, light/moderate effort (MyFitnessPal)",
        "distance": 0
      },
      {
        "activity": "total",
        "distance": 0
      },
      {
        "activity": "tracker",
        "distance": 0
      },
      {
        "activity": "loggedActivities",
        "distance": 0
      },
      {
        "activity": "veryActive",
        "distance": 0
      },
      {
        "activity": "moderatelyActive",
        "distance": 0
      },
      {
        "activity": "lightlyActive",
        "distance": 0
      },
      {
        "activity": "sedentaryActive",
        "distance": 0
      }
    ],
    "fairlyActiveMinutes": 0,
    "lightlyActiveMinutes": 0,
    "marginalCalories": 0,
    "sedentaryMinutes": 1440,
    "steps": 0,
    "veryActiveMinutes": 0
  }
}
Best Answer
0 Votes

@papertank The distance metric for those categories are zero because the distance is zero. That seems to be expected behavior for MFP activities (if there's no other distance) since the distance will always be zero for those activities.

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes