Skip to content

Apple HealthKit Integration #5

Description

@saksham2001

I want to add Apple HealthKit support, but before implementing it, I’d like feedback on how the integration should work.

Core design questions

1. What should the overall data flow be?

  • an export target only, where PulseLoop writes ring data into Apple Health (I am wary of this, as many data points for cheap rings can be very off)
  • an import source only, where PulseLoop reads Apple Health data to improve dashboards (estimate confidence in the ring data) and coach insights;
  • a two-way sync layer;
  • or an optional bridge that users configure metric by metric? (might make the app too complicated)

What should remain PulseLoop’s source of truth?

2. What data should PulseLoop write to Apple Health?

Potential write targets:

  • heart rate
  • blood oxygen / SpO₂
  • steps
  • distance
  • active energy / calories
  • sleep analysis
  • workouts / activities
  • workout routes
  • resting heart rate, if derived safely
  • HRV, if supported or derived later

Which of these should be included in the first version?
Which ones should require extra confidence checks before writing?

3. What data should PulseLoop read from Apple Health?

Potential read targets:

  • Apple Watch heart rate
  • resting heart rate
  • HRV
  • sleep data
  • workouts
  • steps / distance / energy
  • body mass and body metrics
  • respiratory rate
  • SpO₂
  • temperature-related metrics, where available

What Apple Health data would actually make PulseLoop more useful?
Should imported data appear in dashboards, only in the coach, or both?

4. How should source attribution work?

PulseLoop may eventually show data from:

  • the cheap BLE rings
  • Apple Watch
  • iPhone motion data
  • Apple Health manual entries
  • third-party apps

How should the UI distinguish between these sources?
Should graphs show source labels, filters, confidence indicators, or combined views?

5. How should duplicate data be handled?

If PulseLoop writes steps, HR, sleep, or workouts to Apple Health, and Apple Watch/iPhone already recorded similar data, how should we avoid confusing duplicates?

Questions:

  • Should PulseLoop only write data from time periods where the ring was actively connected?
  • Should users be able to choose which metrics sync?
  • Should PulseLoop detect overlapping Apple Watch data and avoid writing duplicates?
  • Should the app expose a “ring only / Apple Health only / combined” filter?

6. How should activity mode integrate with HealthKit?

PulseLoop has an activity mode for recording workouts.

Should completed activities be saved to HealthKit as workouts?
Should they include:

  • workout type
  • start/end time
  • distance
  • active energy
  • heart rate samples
  • SpO₂ samples
  • GPS route
  • pause/resume events
  • source metadata?

How much detail should be written to Apple Health versus kept only inside PulseLoop?

7. How should sleep sync work?

The ring provides sleep blocks/stages, but cheap rings may not be very accurate.

Questions:

  • Should PulseLoop write sleep to Apple Health?
  • Should it write only total sleep time or also stages?
  • Should sleep confidence be shown before export?
  • Should users manually approve sleep sessions before syncing?

8. How should the AI coach use HealthKit data?

PulseLoop has an optional AI coach that uses tools to query local data.

Should HealthKit data be available to the coach?
If yes:

  • Should the coach use raw samples or only summaries?
  • Should it cite whether an insight came from PulseLoop ring data or Apple Health?
  • Should users be able to ask “only use ring data” or “include Apple Health data”?

9. What permission model should the app use?

HealthKit permissions can be requested per data type.

Questions:

  • Should PulseLoop request all permissions during onboarding?
  • Or should it request permissions only when a feature needs them?
  • Should there be separate toggles for read and write?
  • Should there be per-metric sync controls?

Possible settings:

  • Write PulseLoop data to Apple Health
  • Read Apple Health data for dashboards
  • Use Apple Health data in Coach
  • Sync workouts
  • Sync sleep
  • Sync vitals
  • Sync activity metrics

10. How transparent should the integration be?

Since PulseLoop’s core idea is privacy and transparency, should the HealthKit integration include (tricky to find the right spot between transparency and ease of use):

  • a sync log
  • last sync time
  • number of samples written
  • number of samples imported
  • failed writes / permission issues
  • source labels on every metric
  • a way to delete PulseLoop-written HealthKit samples?

11. Should PulseLoop use HealthKit to validate cheap ring data?

One interesting possibility is comparing cheap ring data against Apple Watch or other HealthKit sources.

Possible features:

  • ring vs Apple Watch HR comparison
  • sleep duration comparison
  • SpO₂ agreement
  • missing data detection
  • ring reliability score
  • per-metric confidence score

Would this be useful, or would it make the app feel too complex?

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions