Export the four ring metrics that stopped short of Apple Health - #122
Open
ak710 wants to merge 1 commit into
Open
Export the four ring metrics that stopped short of Apple Health#122ak710 wants to merge 1 commit into
ak710 wants to merge 1 commit into
Conversation
Respiratory rate, VO2max, blood glucose and blood pressure were all decoded, stored and displayed in-app, but the export path mapped every one of them to nil. Three were a genuine follow-up; blood pressure needed a different shape entirely. Respiratory rate, VO2max and glucose join the quantity path with the units HealthKit expects (count/min, mL/(kg*min), mg/dL) and the same plausibility bounds RingEventBridge already applies on the way into the store. Blood pressure gets its own pass, because Health only recognises a reading when systolic and diastolic are saved together in an HKCorrelation — saved separately they are stored but never surface in the Health app, which is indistinguishable from a silent failure. The two halves are written from one packet at one instant, so that shared timestamp is the pairing key; a half without its partner is skipped rather than guessed at, and a pair with systolic at or below diastolic is rejected as a misframed packet. Its watermark reuses the bloodPressureSystolic slot, which the quantity path never touches, so backfill and reset keep working unchanged. Stress and fatigue stay unmapped, and the comment now says why properly: this isn't a follow-up, HealthKit has no type for a device-derived wellness score. HKStateOfMind is a self-reported mood log and would misrepresent both. The four new toggles only appear for rings that can produce the metric — or that already have — since respiratory rate and VO2max come only from the YCBT records and glucose and BP only from jring and some YCBT units. A jring owner never sees a VO2max switch that could not write anything. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #113
Merge order: 3 of 9. Branches off
main, independent of #120 and #121.What
Respiratory rate, VO₂max and blood glucose join the quantity path with the units HealthKit expects and the same plausibility bounds
RingEventBridgealready applies on the way into the store.Blood pressure gets its own pass, because Health only recognises a reading when systolic and diastolic are saved together in an
HKCorrelation— saved separately they are stored but never surface, which is indistinguishable from a silent failure.Design notes
bloodPressureSystolicslot inmeasurementWatermarks, which the quantity path never touches — so backfill andresetWatermarkskeep working unchanged.HKStateOfMindis a self-reported mood log that would misrepresent both. One existing test asserted these mapped to nil and needed updating for glucose — I left the two that are genuinely permanent.Testing
PulseLoopTests/HealthSyncNewTypesTests.swift— 11 tests on units, bounds, BP pairing and sync-ID stability. Full suite green (882).Not verifiable in CI beyond the pure mappings —
HKHealthStoreisn't reachable from the test bundle, which is why this file follows the existingHealthSyncTestsconvention of testing the mapping tables only.