commit 7c10f19d78e244771f0af9ffeaaed5b4a73ae001
parent 0967017c0e17308663a34fb7a71737dc5e6f15b0
Author: Michael Camilleri <[email protected]>
Date: Mon, 19 Oct 2026 20:10:20 +0900
Clarify design for health-related data
Diffstat
| M | Notes/Design.md | | | 51 | +++++++++++++++++++++++++++++++++++++++++---------- |
1 file changed, 41 insertions(+), 10 deletions(-)
diff --git a/Notes/Design.md b/Notes/Design.md
@@ -368,15 +368,17 @@ more than one provider exists over time.
point, humidity, pressure, wind speed, gust and direction, visibility, UV,
cloud cover, precipitation. `source` is `wunderground`, `darkSky` or
`weatherKit`.
-- `audio`: average and peak dB, plus `source`: `microphone` or
- `healthEnvironmental`.
+- `audio`: average and peak dB, plus `source`. Only `microphone` values are
+ stored here; Health noise goes in the Health cache.
- `motion`: steps, floors ascended and descended, barometric pressure,
relative altitude.
-- `health`: new in Reportage. See [Health](#health).
- `device`: battery level and state, connectivity (`wifi`, `cellular`, `none`).
- `photos`: count and lightweight metadata of photos taken since the previous
report.
+Health context isn't part of `Context`. It's a local cache kept beside the
+report and never synced (see [Health](#health)).
+
Context fields fall into two groups, and this shapes the whole capture design:
- **Live**: fields that only exist at that moment: location if there's no
@@ -594,8 +596,10 @@ The Watch app is otherwise minimal: log, see recent passive reports, and
optionally answer the quick questions (yes/no and choice) on the wrist. Token,
people and place answers are left for the phone.
-The Watch captures what it can at log time: timestamp, time zone, location and
-heart rate. Health-derived context is filled in later on the phone.
+The Watch captures what it can at log time: timestamp, time zone and
+location. Heart rate and other Health context are filled in later on the
+phone, into its local Health cache, from the samples the Watch has synced to
+Health.
## Context Capture
@@ -652,12 +656,38 @@ Read-only HealthKit access:
- heart rate nearest the report's time, and resting heart rate
- environmental audio exposure (see below)
+Reportage never writes to HealthKit. Its own store is the record of
+everything it captures; HealthKit is only read from.
+
+**Health context is a local cache, not synced data.** Values read from
+HealthKit are kept in Core Data on the iPhone, in their own entity rather
+than in the `Context` blob, and are left out of CloudKit records.
+HealthKit already syncs and restores Health data across the user's devices
+with end-to-end encryption, so a new device rebuilds the cache from its own
+store. Keeping it out of iCloud also follows App Review's rule against
+storing personal health information there. The Watch never needs the cache.
+
HealthKit data is unavailable while the device is locked. Most background
actions happen while locked, so Health context is derived later. On the next
-foreground launch, reports with a missing `health` section are filled in by
-querying for samples around their timestamp. The same mechanism can backfill
-Health context for imported Reporter reports, as far back as the user's Health
-history goes. That's tracked separately from imported values.
+foreground launch, reports without settled Health context are filled in by
+querying for samples around their timestamp. The same mechanism fills in
+Health context for imported Reporter reports, as far back as the user's
+Health history goes. That's kept apart from imported values: Reporter's steps
+and noise came from Core Motion and the microphone, so they stay in `motion`
+and `audio` and sync with the report.
+
+- **Settling.** Health data keeps arriving after the moment it describes:
+ Watch samples sync late, sleep sessions are finalised after waking, and
+ 'steps today' depends on when the Watch last synced. Each cache entry
+ records when it was derived. It's re-derived on later launches until it is
+ 24 hours past the report, then treated as settled.
+- **Missing values.** Each entry records why a value is absent: no samples,
+ not authorised, or not attempted yet. HealthKit reports denied read access
+ as empty results, so the cache can't tell 'not authorised' from 'no
+ samples' for certain. It goes by the authorisation request status and
+ doesn't retry settled entries unless the user asks.
+- **Export.** Export can include the cache, since a file the user asked for
+ isn't iCloud storage.
### Ambient noise
@@ -665,7 +695,8 @@ In order of preference:
1. **HealthKit `environmentalAudioExposure`**, recorded by the Watch's Noise
app. It never touches the audio session, and is derivable, so it can be
- filled in later.
+ filled in later. Like other Health values, it goes in the local Health
+ cache rather than in the synced `audio` section.
2. **Microphone sampling** for about 2 seconds, only when the current output
route is the built-in speaker or receiver. The session uses `.playAndRecord`
with `[.mixWithOthers, .allowBluetoothA2DP]` and the built-in mic as the