-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set time zone from HK metadata in FHIR resources #50
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
==========================================
+ Coverage 92.71% 92.92% +0.21%
==========================================
Files 23 24 +1
Lines 1097 1115 +18
==========================================
+ Hits 1017 1036 +19
+ Misses 80 79 -1
Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great; thank you for the quick feature addition! 👍
Set time zone from HK metadata in FHIR resources
♻️ Current situation & Problem
The HealthKitOnFHIR library currently assumes that HealthKit samples were created in the current time zone of the device at the time of mapping and applies the corresponding UTC offset. While this is true for most situations, it is possible that older HealthKit data may be mapped using the library that was created while the user was in a different time zone.
For example, if a sample was originally created by HealthKit in San Francisco on December 1st, 2024 at 9:00am (-08:00), but then mapped by HealthKitOnFHIR later on in New York, the timestamp would read 2024-12-01T12:00:00-05:00. While technically these are the same point in time, they are offset differently.
The information regarding the original timezone of the sample may be stored by HealthKit in the object's metadata via HKMetadataKeyTimeZone, if this was written by the original application or device that created the data, and we should use it to apply the appropriate offset.
⚙️ Release Notes
✅ Testing
Unit tests have been updated to test that the appropriate offset is applied for multiple time zones specified via metadata and test that the offset of the current time zone is applied if none is specified.
Code of Conduct & Contributing Guidelines
By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines: