Skip to content
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

Supplemental Metrics for ECG Reading #47

Merged
merged 13 commits into from
Feb 19, 2024

Conversation

MatthewTurk247
Copy link
Collaborator

Supplemental Metrics for ECG Reading

♻️ Current situation & Problem

Building on top of #40, this pull request seeks to package ECG readings with supplemental information like VO2 max and pulse rate in a way that is sensitive to the possible limitations of current recording capabilities.

⚙️ Release Notes

  • Measures most recent VO2 max known at the time of ECG recording.
  • Captures pulse rate via optical sensor at T-minus five minutes and T-plus five minutes.
  • Captures activity metrics at T-minus five minutes and T-plus five minutes, inlcuding:
    • Active calories.
    • Step count.
    • Standing minutes.
  • Collects readings of heart rate from optical sensor at intervals of 10 minutes for first two days of the study.
  • Estimates amount of time watch has been worn each day.

📚 Documentation

In-line documentation will be written in relevant files in conformance to the Spezi Documentation Guide.

✅ Testing

Tests may be added for ensuring that data is correctly serialized and properly handled.

Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

@MatthewTurk247
Copy link
Collaborator Author

Some questions for @PSchmiedmayer:

  • Should I create a new add function in PAWSStandard or modify the existing one that handles HKElectrocardiogram?
  • As I understand it, we want to capture the most recent VO2 max at the time of ECG recording. Should that code go in one of the existing files in PAWS/ECGRecordings?
  • If so, do we need a new data structure for associating ECG readings with VO2 samples? I suppose that without relating the two, we could still query in such a way as to construct pairings of data if we have the timestamps, but I am curious to hear additional perspectives on this matter.

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

Attention: 101 lines in your changes are missing coverage. Please review.

Comparison is base (78f8287) 31.66% compared to head (71e7d0e) 30.33%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #47      +/-   ##
==========================================
- Coverage   31.66%   30.33%   -1.33%     
==========================================
  Files          33       33              
  Lines         992     1118     +126     
==========================================
+ Hits          314      339      +25     
- Misses        678      779     +101     
Files Coverage Δ
PAWS/PAWSDelegate.swift 96.88% <100.00%> (+1.11%) ⬆️
PAWS/PAWSStandard.swift 3.95% <0.00%> (-0.70%) ⬇️
PAWS/ECGRecordings/ECGRecording.swift 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 78f8287...71e7d0e. Read the comment docs.

@PSchmiedmayer
Copy link
Member

@MatthewTurk247 Sorry for the late response!

While SpeziHealthKit is great to collect longitudinal data, I would suggest to use normal "custom" HealthKit queries for the 5 minute intervals around the measurements.
You can use the Spezi Delegate HealthKit configuration with a .manual() delivery setting to make sure that permissions are granted during the onboarding but I would suggest that we develop a custom HealthKit query that gets triggered when a new ECG is recorded and received in the Standard that would then trigger the surrounding data collection.

I think it is fine to just store them in the database as they can be correlated with the ECG using the timestamps. In the long run we could work with FHIR references between the different documents but that might be too complicated for now. Just storing them as observations should be fine and should address our need.

We would also need some additional logic around the correlation of incoming symptoms and how to correlate this with the ECG types.

Let's use the meeting today to take a deep-dive into some of the implementation ideas and how we can address them as part of this and future PRs.

Copy link
Member

@PSchmiedmayer PSchmiedmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the improvements @MatthewTurk247; the changes look great and are well structured! 🚀

Great job with your first PR!

PAWS/ECGRecordings/ECGRecording.swift Show resolved Hide resolved
PAWS/PAWSDelegate.swift Show resolved Hide resolved
PAWS/PAWSStandard.swift Show resolved Hide resolved
@PSchmiedmayer
Copy link
Member

PSchmiedmayer commented Feb 19, 2024

@MatthewTurk247 I would merge the PR if you agree that you don't want to make any additional changes? I can override the missing patch requirement. It will be nearly impossible to easily unit test them with the current testing capabilities that are available for HealthKit.

@MatthewTurk247
Copy link
Collaborator Author

@MatthewTurk247 I would merge the PR if you agree that you don't want to make any additional changes? I can override the missing patch requirement. It will be nearly impossible to easily unit test them with the current testing capabilities that are available for HealthKit.

Yep, sounds good to me! I don't have any other changes in mind for this specific PR. So once that missing patch requirement is overridden and the PR is merged, I think it will make sense to open a new PR specifically for symptom tagging and linking to ECG recordings.

@PSchmiedmayer PSchmiedmayer merged commit 2ace230 into main Feb 19, 2024
6 of 7 checks passed
@PSchmiedmayer PSchmiedmayer deleted the feat/supplemental-metrics-ecg branch February 19, 2024 21:35
@PSchmiedmayer
Copy link
Member

Sounds great; I have merged the PR 🎉

@PSchmiedmayer
Copy link
Member

Thank you for all the work and research that went into the PR @MatthewTurk247 🚀

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.

2 participants