mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 00:12:18 +00:00
feat(schema): Apple Health measurement types + sleep stages + dedup index
Extend MeasurementType with the seven HealthKit-shaped values the iOS batch ingest needs (HRV, resting HR, active energy, flights climbed, distance, VO2 max, body temperature) and add APPLE_HEALTH to the MeasurementSource enum. Sleep duration unit shifts from hours to minutes so per-stage HKCategorySample rows persist without precision loss; the new SleepStage enum mirrors the existing GlucoseContext column shape and a CHECK constraint scopes it to SLEEP_DURATION rows. The composite unique index `(user_id, type, source, external_id)` gives the new batch endpoint an idempotent dedup key while the legacy `(user_id, type, measured_at, source)` index continues to back the manual UI's no-duplicate-at-the-same-wall-clock guard. NULL externalId rows stay distinct under Postgres semantics so manual entries never collide. Migration is strictly additive: new enum values append, new columns are nullable, no rows mutate. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
8569a1879f
commit
95209ebf79
9 files changed
+256
-8
No files matched your search
@@ -283,6 +283,13 @@
|
||||
"typeTotalBodyWater": "Gesamtkörperwasser",
|
||||
"typeBoneMass": "Knochenmasse",
|
||||
"typeOxygenSaturation": "Sauerstoffsättigung",
|
||||
"typeHeartRateVariability": "Herzfrequenzvariabilität",
|
||||
"typeRestingHeartRate": "Ruheherzfrequenz",
|
||||
"typeActiveEnergyBurned": "Aktive Energie",
|
||||
"typeFlightsClimbed": "Treppen",
|
||||
"typeWalkingRunningDistance": "Geh- und Laufstrecke",
|
||||
"typeVo2Max": "VO₂max",
|
||||
"typeBodyTemperature": "Körpertemperatur",
|
||||
"glucoseContext": "Kontext",
|
||||
"glucoseContextFasting": "Nüchtern (≥8 h ohne Nahrung)",
|
||||
"glucoseContextPostprandial": "Postprandial (2 h nach dem Essen)",
|
||||
|
||||
@@ -283,6 +283,13 @@
|
||||
"typeTotalBodyWater": "Total body water",
|
||||
"typeBoneMass": "Bone mass",
|
||||
"typeOxygenSaturation": "Oxygen saturation",
|
||||
"typeHeartRateVariability": "Heart-rate variability",
|
||||
"typeRestingHeartRate": "Resting heart rate",
|
||||
"typeActiveEnergyBurned": "Active energy",
|
||||
"typeFlightsClimbed": "Flights climbed",
|
||||
"typeWalkingRunningDistance": "Walking + running distance",
|
||||
"typeVo2Max": "VO₂ max",
|
||||
"typeBodyTemperature": "Body temperature",
|
||||
"glucoseContext": "Context",
|
||||
"glucoseContextFasting": "Fasting (≥8h without food)",
|
||||
"glucoseContextPostprandial": "Post-meal (2h after eating)",
|
||||
|
||||
Reference in new issue
Block a user