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

Fix duplicated delivery of Omron Measurements #9

Merged
merged 17 commits into from
Aug 16, 2024

Conversation

Supereg
Copy link
Member

@Supereg Supereg commented Aug 13, 2024

Fix duplicated delivery of Omron Measurements

♻️ Current situation & Problem

This PR fixes some minor issues with the current implementation of Omron devices. StanfordSpezi/SpeziBluetooth#46 made two important changes to improve the overall reliability of the implementation. First, it fixes an issue with notify-only characteristics (like weight and blood pressure measurement characteristics) where the onChange would not be called. Secondly, while the device is subscribing to characteristic notifications, the state is still set to connecting, this allows us to properly filter the initial measurement notifications that Omron devices send when subscribing to characteristics. Further, this allowed us to fix an issue where we couldn't properly determine the point in time where a weight scale was fully paired by the user.

Additionally this PR adds a small time label for the MeasurementsRecordedSheet and adds German localization.

⚙️ Release Notes

  • Fixed duplicated deliver of measurements for Omron devices.
  • Fixed pairing with Omron weight scales.
  • Added a time label to the MeasurementsRecordedSheet.
  • Added German localization.

📚 Documentation

Added a small documentation article that collects knowledge about Omron devices.

✅ Testing

We used manual testing with real Omron devices to verify the implementation. Some additional unit tests were added to ensure no regression occur.

📝 Code of Conduct & Contributing Guidelines

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

@Supereg Supereg linked an issue Aug 15, 2024 that may be closed by this pull request
1 task
Copy link

codecov bot commented Aug 15, 2024

Codecov Report

Attention: Patch coverage is 77.61194% with 30 lines in your changes missing coverage. Please review.

Project coverage is 83.78%. Comparing base (6fc18b2) to head (5b4a45c).
Report is 1 commits behind head on main.

Files Patch % Lines
...ces/Health/BloodPressureMeasurement+HKSample.swift 0.00% 18 Missing ⚠️
...es/SpeziOmron/Devices/OmronBloodPressureCuff.swift 86.85% 5 Missing ⚠️
Sources/SpeziOmron/Devices/OmronWeightScale.swift 91.18% 3 Missing ⚠️
Sources/SpeziDevices/HealthMeasurements.swift 81.82% 2 Missing ⚠️
Sources/SpeziDevices/PairedDevices.swift 80.00% 1 Missing ⚠️
...cesUI/Measurements/MeasurementsRecordedSheet.swift 95.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main       #9      +/-   ##
==========================================
- Coverage   84.09%   83.78%   -0.31%     
==========================================
  Files          55       55              
  Lines        2853     2952      +99     
==========================================
+ Hits         2399     2473      +74     
- Misses        454      479      +25     
Files Coverage Δ
...eziDevices/Measurements/HealthKitMeasurement.swift 100.00% <100.00%> (ø)
Sources/SpeziDevices/Testing/MockDevice.swift 99.06% <ø> (ø)
Sources/SpeziOmron/Model/OmronLocalName.swift 76.20% <ø> (ø)
Sources/SpeziDevices/PairedDevices.swift 74.74% <80.00%> (ø)
...cesUI/Measurements/MeasurementsRecordedSheet.swift 94.70% <95.00%> (+0.84%) ⬆️
Sources/SpeziDevices/HealthMeasurements.swift 87.17% <81.82%> (-0.47%) ⬇️
Sources/SpeziOmron/Devices/OmronWeightScale.swift 90.23% <91.18%> (+0.67%) ⬆️
...es/SpeziOmron/Devices/OmronBloodPressureCuff.swift 85.72% <86.85%> (-1.38%) ⬇️
...ces/Health/BloodPressureMeasurement+HKSample.swift 60.50% <0.00%> (-14.89%) ⬇️

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 6fc18b2...5b4a45c. Read the comment docs.

@Supereg Supereg marked this pull request as ready for review August 15, 2024 10:51
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.

Amazing job with the improvements in this PR; great to see!

Package.swift Outdated Show resolved Hide resolved
Package.swift Show resolved Hide resolved
Sources/SpeziDevicesUI/Resources/Localizable.xcstrings Outdated Show resolved Hide resolved
@PSchmiedmayer PSchmiedmayer added the enhancement New feature or request label Aug 15, 2024
@Supereg Supereg merged commit 16075cb into main Aug 16, 2024
12 checks passed
@Supereg Supereg deleted the fix/omron-measurement-delivery branch August 16, 2024 18:52
Supereg added a commit to StanfordBDHG/ENGAGE-HF-iOS that referenced this pull request Aug 20, 2024
# Improve Bluetooth and Account interactions

## ♻️ Current situation & Problem
The latest SpeziBluetooth and SpeziDevices releases fixed several issues
(StanfordSpezi/SpeziDevices#9,
StanfordSpezi/SpeziBluetooth#46) including the
duplicate delivery of measurements and minor pairing issues.
Additionally, this PR upgrades to the upcoming SpeziAccount release that
provides several improvements when interacting with Account Services. We
updated code to avoid directly interaction with FirebaseAuth.

## ⚙️ Release Notes 
* Fixed an issue where measurements were delivered twice or not at all.
* Fixed an issue where a Weight Scale was considered paired to early.
* Improved general structure of the application integrating latest
SpeziAccount features.


## 📚 Documentation
--


## ✅ Testing
--

### Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Show date information when showing pending measurements that are older
2 participants