dogsheep / healthkit-to-sqlite

Convert an Apple Healthkit export zip to a SQLite database
https://datasette.io/tools/healthkit-to-sqlite
Apache License 2.0
191 stars 9 forks source link

Failed to import workout points #10

Closed simonw closed 4 years ago

simonw commented 4 years ago

I just ran the script and it failed to import any workout_points, though it did import workouts.

simonw commented 4 years ago

It looks like Apple changed the location of these in iOS 13 - they are now in separate .gpx files:

2FF70E95-CDEE-4241-A5C5-EE95A862E519

simonw commented 4 years ago

The XML now includes references to these new files:

CBBA54FC-51FB-4BB3-927C-C2CA99237B04

simonw commented 4 years ago

Relevant code:

https://github.com/dogsheep/healthkit-to-sqlite/blob/d16f45f06fbae6ec8a78cc9ca7b5b7db0413f139/healthkit_to_sqlite/utils.py#L58-L64

simonw commented 4 years ago

So the fix there is going to be to detect the new FileReference element and load the corresponding points data from it.

This will be a little tricky because that function will need access to the zip file.

It probably won't work at all for the mode where the export.xml file is passed directly using the --xml option.