Skip to content

Conversation

@jiaweixiao
Copy link
Contributor

Description
This PR addresses a bug(#90) where activities recorded as Running Courses (structured workouts) failed to convert.

Changes

  • Modified HiJson._parse_activity to include a regex cleaning step.
  • The raw hitrack_data is now stripped of the actionSummary=... block often found at the end of the attribute string in Huawei Health exports.
  • This ensures that only the valid tp= prefixed CSV lines are passed to the HiTrackFile parser.

Reasoning:
Huawei appends workout summaries to the telemetry data in certain activity types. Since our HiTrackFile parser relies on csv.reader to iterate through telemetry records, encountering a raw JSON-like string at the end of the file causes index errors or parsing exceptions. By stripping this out during the JSON-to-HiTrack extraction phase, we maintain compatibility with the existing parsing logic.

…ties

Running course activities include an 'actionSummary' JSON block at the
end of the raw telemetry data in the 'attribute' field. This non-CSV
content causes the HiTrack parser to fail. This commit adds a regex
filter to remove this metadata block before saving/parsing the
HiTrack data.
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