mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
Adds three new enum values that close the iOS-17/18 HealthKit coverage
gap before the v1.5 iOS-Swift session locks against Postgres:
- AUDIO_EXPOSURE_ENV (dBA, environmental noise)
- AUDIO_EXPOSURE_HEADPHONE (dBA, AirPods listening)
- TIME_IN_DAYLIGHT (minutes/day, iOS 17+)
Wire-up touches the canonical surfaces:
- prisma/schema.prisma: MeasurementType + comment block
- src/lib/validations/measurement.ts: enum + unitMap + VALUE_RANGES
- src/lib/__tests__/measurement-type-enum-coverage.test.ts: 25 -> 28
expected types; new entries added to PDF_VITAL_EXCLUSIONS under the
existing v1.5 clinical-layout gate
- src/components/measurements/measurement-list-meta.ts: i18n keys,
Volume2 / Headphones / Sun icons, palette assignments
- src/lib/insights/chart-tokens.ts: ALLOWED_CHART_TOKENS allow-list
plus orphan-enum stripper coverage so the LLM cannot leak raw
upper-snake names into rendered prose
- messages/{en,de,fr,es,it,pl}.json: typeAudioExposureEnv,
typeAudioExposureHeadphone, typeTimeInDaylight (en/de translated;
fr/es/it/pl carry English placeholders matching their existing
convention for the W5d additions)
The task brief originally listed a fourth value (WORKOUT_ROUTE) as a
sentinel slot. Dropped here because workouts are first-class entities
landing in Migration 0053 with their own table (Workout + WorkoutRoute);
HealthKit also separates HKWorkout from HKQuantitySample. A reserved
sentinel that no real Measurement row will ever take would be a dead
slot for analytics, doctor-PDF allow-lists, and chart registries.
31 lines
1.7 KiB
SQL
31 lines
1.7 KiB
SQL
-- v1.4.25 W8d — Apple Health server-contract prep. Three new
|
|
-- MeasurementType enum values close the iOS-17/18 HK coverage gap
|
|
-- before the v1.5 iOS-Swift session:
|
|
-- * AUDIO_EXPOSURE_ENV — HK `environmentalAudioExposure`
|
|
-- (ambient noise; dBA SPL). Watch + iPhone microphone samples.
|
|
-- * AUDIO_EXPOSURE_HEADPHONE — HK `headphoneAudioExposure`
|
|
-- (AirPods listening-volume sampling; dBA SPL).
|
|
-- * TIME_IN_DAYLIGHT — HK `timeInDaylight` (iOS 17+;
|
|
-- minutes/day). Mood + sleep correlate.
|
|
--
|
|
-- The previous task brief listed a fourth value, `WORKOUT_ROUTE`. It
|
|
-- has been dropped: workouts are first-class entities with their own
|
|
-- `Workout` table (Migration 0053) and the GPS route geometry lives
|
|
-- in `WorkoutRoute`. Apple HealthKit also separates `HKWorkout` from
|
|
-- `HKQuantitySample`. Carrying a sentinel enum value on the
|
|
-- Measurement table when no real Measurement row will ever be of
|
|
-- that type would be a dead slot that confuses every downstream
|
|
-- code path (analytics summariser, doctor-PDF allow-list, chart
|
|
-- registry). Forward-additive — a future analytics rollup row can
|
|
-- still be carried on a fresh enum value if the use case ever
|
|
-- materialises.
|
|
--
|
|
-- Additive only, forward-only — every new enum value is unconditional
|
|
-- and no existing row needs to be backfilled. The Apple Health
|
|
-- mapping (`src/lib/measurements/apple-health-mapping.ts`) gains the
|
|
-- corresponding HK identifier rows in the same release.
|
|
|
|
ALTER TYPE "measurement_type" ADD VALUE IF NOT EXISTS 'AUDIO_EXPOSURE_ENV';
|
|
ALTER TYPE "measurement_type" ADD VALUE IF NOT EXISTS 'AUDIO_EXPOSURE_HEADPHONE';
|
|
ALTER TYPE "measurement_type" ADD VALUE IF NOT EXISTS 'TIME_IN_DAYLIGHT';
|