Skip to content

Fix bug parsing raw Fitbit calories JSON data#246

Merged
jenniferfedor merged 1 commit intodevelopfrom
fix-calories-bug
Feb 27, 2026
Merged

Fix bug parsing raw Fitbit calories JSON data#246
jenniferfedor merged 1 commit intodevelopfrom
fix-calories-bug

Conversation

@jenniferfedor
Copy link
Collaborator

@jenniferfedor jenniferfedor commented Feb 27, 2026

Every minute-level record in the raw Fitbit activities-calories-intraday dataset is expected to contain level, mets, time, and value elements. However, we've found that it's possible for raw intraday calories time series data to contain only time and value elements. For example:

"activities-calories-intraday": {
    "dataset": [
      {
        "time": "00:00:00",
        "value": 1.39192
      },
      {
        "time": "00:01:00",
        "value": 1.5311120000000003
      },
    ]
}

Currently, parsing raw Fitbit intraday calories JSON data fails with these data specifically, as well as more broadly if level, mets, and/or value elements are not present in at least one minute-level record for a participant. To fix this, before parsing each minute-level record into a row of data, we first check if the record contains all expected elements instead of assuming they are present. If one or more expected elements are missing, that minute-level record is discarded. If all minute-level records within an intraday dataset are missing one or more expected elements, this has the effect of discarding the entire day of data. Downstream, Fitbit intraday calories features are computed only from "complete" minutes of data.

@jenniferfedor jenniferfedor merged commit cb5881e into develop Feb 27, 2026
2 checks passed
@jenniferfedor jenniferfedor deleted the fix-calories-bug branch March 2, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant