github
id | node_id | number | state | locked | title | user | body | created_at | updated_at | closed_at | merged_at | merge_commit_sha | assignee | milestone | draft | head | base | author_association | repo | url | merged_by | auto_merge |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
718734191 | MDExOlB1bGxSZXF1ZXN0NzE4NzM0MTkx | 22 | open | 0 | Make sure that case-insensitive column names are unique | 32016596 | This closes #21. When there are metadata entries with the same case insensitive string, then there is an error when trying to create a new column for that metadata entry in the database table, because a column with that case insensitive name already exists. ```xml <Record type="HKQuantityTypeIdentifierDietaryCholesterol" sourceName="MyFitnessPal" sourceVersion="35120" unit="mg" creationDate="2021-07-04 20:55:27 +0200" startDate="2021-07-04 20:55:00 +0200" endDate="2021-07-04 20:55:00 +0200" value="124"> <MetadataEntry key="meal" value="Dinner"/> <MetadataEntry key="Meal" value="Dinner"/> </Record> ``` The code added in this PR checks if a key already exists in a record and if so adds a number at its end. The resulting column names look like the example below then. Interestingly, the column names viewed with Datasette are not case insensitive. ```text startDate, endDate, value, unit, sourceName, sourceVersion, creationDate, metadata_meal, metadata_Meal_2, metadata_Mahlzeit ``` | 2021-08-24T13:13:38Z | 2021-08-24T13:26:20Z | c757d372c10284cd6fa58d144549bc89691341c3 | 0 | b16fb556f84a0eed262a518ca7ec82a467155d23 | 9fe3cb17e03d6c73222b63e643638cf951567c4c | FIRST_TIME_CONTRIBUTOR | 197882382 | https://github.com/dogsheep/healthkit-to-sqlite/pull/22 | ||||||
1182000455 | PR_kwDOC8tyDs5Gc-VH | 23 | open | 0 | Include workout statistics | 2129 | Not sure when this changed (iOS 16 maybe?), but the `WorkoutStatistics` now has a whole bunch of information about workouts, e.g. for runs it contains the distance (as a `<WorkoutStatistics type="HKQuantityTypeIdentifierDistanceWalkingRunning ...>` element). Adding it as another column at leat allows me to pull these out (using SQLite's JSON support). I'm running with this patch on my own data now. | 2023-01-01T17:29:56Z | 2023-01-01T17:29:57Z | e0ad45055f363810085119f26df87a6804451056 | 0 | d5b9e3609961515cc52bcc5ef070e3b83b473339 | 9fe3cb17e03d6c73222b63e643638cf951567c4c | FIRST_TIME_CONTRIBUTOR | 197882382 | https://github.com/dogsheep/healthkit-to-sqlite/pull/23 |