health@1 daily body metrics, sleep sessions with stages, workouts, food eaten and body measurements from wearables, scales and health apps
One row of sleep_sessions is one sleep (a night or a nap) as one device recorded it; one row of daily_metrics is one value of one metric code on one local day from one device; one row of workouts is one workout; one row of nutrition (1.2) is one diary day of food from one app; one row of body is one day's weigh-in (and body fat, waist) from one scale or app. The Apple Health export fills all three (it also carries Apple Watch data and every app that writes to Apple Health: Oura, WHOOP, AutoSleep and others); a folder of health@1 CSV files is the generic lane-1 format any tool can write.
Required tables must exist in every database that says it follows health@1; required fields must be filled. Columns a board adds start with x_.
metarequired table
Key/value facts about this database. Required: schema, schema_version, as_of, data_hash. Recommended (checked at warn): source_built_at (ISO 8601 UTC instant the importer wrote it).
Field
Type
Required
Meaning
key
TEXT
no
value
TEXT
no
metric_codesrequired table
The metric codes this database uses, copied from vocab/metric_codes.csv (the controlled list), so metrics can read units and aggregation rules with a join. HRV is two codes that are never mixed: hrv_sdnn (Apple) and hrv_rmssd (Oura, WHOOP).
connector id that wrote the row (vocab sources): apple-health | health-csv | oura | whoop ...
source_ref
TEXT
no
where it came from: the file (and record type), or the API object id
imported_at
TEXTinstant
no
ISO 8601 UTC instant of the import (left out of meta.data_hash)
sleep_sessionsrequired table
One sleep as one device recorded it: the night's main sleep, or a nap. Stage seconds are measured on a timeline in which overlapping samples from the same device are merged (an interval union), never added: asleep_s = light_s + deep_s + rem_s + asleep_unspecified_s, and in_bed_s >= asleep_s. night_of is the local date of the evening the night began: a sleep belongs to the noon-to-noon window it starts in, in local time.
Field
Type
Required
Meaning
sleep_id
TEXT
yes
the source's id when it has one, else sha1 of source|device|night_of|is_nap|start_utc (first 16 hex)
start_utc
TEXTinstant
yes
first moment in bed or asleep (ISO 8601 UTC)
end_utc
TEXTinstant
yes
last moment in bed or asleep (ISO 8601 UTC)
tz
TEXT
yes
the local time zone: an IANA name (Europe/London), or a fixed offset (+01:00) when the source gives only an offset
start_local
TEXT
no
local wall-clock time it started (YYYY-MM-DDTHH:MM:SS, no zone), for bedtimes
end_local
TEXT
no
local wall-clock time it ended (YYYY-MM-DDTHH:MM:SS), for wake times; across a DST change the two zones differ
night_of
TEXTdate
yes
the local date of the evening the sleep belongs to (noon-to-noon window)
in_bed_s
INTEGER
no
seconds in bed: the union of every in-bed, asleep and awake interval of this device
asleep_s
INTEGER
no
seconds asleep (any stage); NULL when the device only knows in bed
awake_s
INTEGER
no
seconds awake in bed (in_bed_s - asleep_s)
light_s
INTEGER
no
light sleep seconds (Apple calls it Core)
deep_s
INTEGER
no
deep sleep seconds
rem_s
INTEGER
no
REM sleep seconds
asleep_unspecified_s
INTEGER
no
asleep seconds with no stage (older devices and apps, Apple before iOS 16)
latency_s
INTEGER
no
seconds from getting into bed to first sleep, when the device knows both
efficiency
REAL
no
asleep_s / in_bed_s (0..1)
hr_min
REAL
no
lowest heart rate during the sleep, bpm
hrv_sdnn_ms
REAL
no
average HRV as SDNN during the sleep, ms (Apple); never an RMSSD value
hrv_rmssd_ms
REAL
no
average HRV as RMSSD during the sleep, ms (Oura, WHOOP); never an SDNN value
rhr
REAL
no
resting heart rate the device gave for this sleep, bpm
resp_rate
REAL
no
average breaths per minute during the sleep
score
REAL
no
the device's own sleep score (0..100) when it gives one; boards never compute it
is_nap
INTEGER
yes
1 for a nap (a short daytime sleep apart from the night's main sleep)
n_segments
INTEGER
no
how many source samples made the session (Apple sleep records)
device
TEXT
yes
the device or app that recorded it, as the source names it
where it came from: file (and record type), or file:line, or API id
imported_at
TEXTinstant
no
ISO 8601 UTC instant of the import (left out of meta.data_hash)
workoutsrequired table
One workout as one source recorded it. Training Log reads this table; Sleep & Recovery uses it to compare nights after workout days. The same real workout often arrives from two sources (an Apple Watch run that Strava also holds): every source keeps its own row, and a board counts one row per real workout by the person's source priority (the workout rules in README.md). Rows from two sources are never added or merged field by field.
Field
Type
Required
Meaning
workout_id
TEXT
yes
the source's id, else sha1 of source|device|start_utc|sport (first 16 hex)
Optional (1.1): seconds in each heart-rate zone of one workout, as the source measured them from its own heart-rate samples (a Garmin summary, a FIT file's records). Zones are numbered 1 (easiest) to 5. A board that works zones out itself (from avg_hr) keeps that in its own d_ tables, never here.
Field
Type
Required
Meaning
workout_id
TEXT
yes
workouts.workout_id
zone
INTEGER
yes
1..5
seconds
INTEGER
yes
seconds in this zone
lo_bpm
REAL
no
the zone's lower bound in bpm, when the source says
hi_bpm
REAL
no
the zone's upper bound in bpm, when the source says
Optional (1.3): what one stream of a workout's samples measured (power, heart rate, speed or cadence, second by second, from a FIT, GPX or TCX activity file or from Apple Health samples), summarised. The samples themselves are never stored, and neither is any position: a reader works distances out in memory and keeps only these summaries (workout rule 6). Time is measured on the workout's own clock: a gap between samples longer than the reader's max gap is a pause, counted in no stream's seconds.
Optional (1.3): a workout's best efforts, worked out from its streams by the reader: the highest average power, speed or heart rate held for `span` seconds, and the fewest seconds needed to cover `span` metres. The window runs on the elapsed clock: a pause inside it counts as standing still (no power, no distance), so a pause never improves an effort.
Optional (1.3): seconds a workout spent in each bin of one stream (power in 5 W bins, heart rate in 1 bpm bins, speed in 0.1 m/s bins, or wider bins a source chose), so a board can count time in zones of any threshold without the samples. A bin holds lo <= value < lo + width. A workout's seconds over all bins of a stream equal workout_streams.seconds.
Optional body measurements: one row per local day, device and source. The row holds the day's FIRST measurement of each kind (the morning weigh-in is the comparable one); later measurements that day are counted in n_samples, never averaged or added. Stored in kilograms, shares and metres whatever the scale or app showed (lb, st, %, cm, in converted on import).
1.2: ISO 8601 UTC instant of the day's first measurement, when the source gives a time
n_samples
INTEGER
no
1.2: measurements this device and source took that day (the row holds the first of each kind)
nutrition
1.2, optional: food eaten, one row per local day, device (the app) and source. A day's totals as the app logged them for that diary date. A day with nothing logged has NO row (never a row of zeros): an unlogged day is unknown, not zero intake. Two apps or files holding the same day (MyFitnessPal's own export and the copy it wrote to Apple Health) give two rows; a board counts one per day by the person's source priority and never adds them. Food names and notes are never stored.
Field
Type
Required
Meaning
date
TEXTdate
yes
the diary date (local YYYY-MM-DD) the food was logged for
kcal
REAL
no
energy eaten, kilocalories (kilojoules / 4.184 on import)
protein_g
REAL
no
protein, grams
carbs_g
REAL
no
carbohydrates (total, not net), grams
fat_g
REAL
no
fat (total), grams
fiber_g
REAL
no
fibre, grams
n_entries
INTEGER
yes
source rows or records that made the day (meals, servings, daily rows, Apple dietary samples)
completed
INTEGER
no
1 when the person marked the diary day complete in the app, 0 when the app says not complete, NULL when the app has no such flag
device
TEXT
yes
the app that logged it (MyFitnessPal, Cronometer; for Apple Health the app that wrote the samples)
Source accounting: for every input file and record type, how many rows or records were read and what happened to each. n_read = n_used + n_duplicate + n_skipped + n_out_of_scope always. raw_sum is the sum over every record read of its value (quantities) or its seconds (sleep), so an independent reader can confirm nothing vanished.
Field
Type
Required
Meaning
file
TEXT
yes
the input file as written in the board's inputs (data/files/export.zip)
record_type
TEXT
yes
HKCategoryTypeIdentifierSleepAnalysis, a CSV file's table, ...
run · ride · swim · walk · hike · strength · yoga · row · ski · other
streams4 values
power · heart_rate · speed · cadence
units11 values
bpm · ms · breaths_min · share · degC · count · kcal · s · kg · ml_kg_min · score
Changelog
1.4.0 (2026-12-01), minor
For NeverChill Athlete (published by NeverChill). New vocabulary values only: source neverchill-export (the NeverChill account export: ZIP parts and manifest, read in place) and its rows in sport_map.csv (NeverChill's sport and sub-sport, e.g. cycling/virtual -> ride, indoor). No table or column changes: NeverChill's own concepts (its fitness model and freshness bands, durability, Rider DNA, plans, baselines) stay in that board's x_neverchill_ tables, as the extension rule says, until a second board needs one.
No migration: the DDL is unchanged (schema.sql hash unchanged). Boards pinned to 1.3.0 re-pin to 1.4.0.
1.3.0 (2026-11-30), minor
For Athlete Performance. New optional tables, all summaries of a workout's sample streams (the samples themselves and any position are never stored, workout rule 6): workout_streams (per stream: covered seconds, time-weighted average, maximum, weighted power, the reader's max gap), workout_efforts (best average power, speed or heart rate over a span of seconds, fewest seconds over a span of metres, with the offset into the workout) and workout_histograms (seconds per bin of a stream, so a board counts time in zones of any threshold without the samples).
Workout rule 6 (1.3): streams are summarised, never stored; a gap longer than max_gap_s is a pause; a pause inside an effort's window counts as standing still, so it never raises an effort; summaries stay with the row of the source whose file they came from.
Vocabularies: new streams.csv (power, heart_rate, speed, cadence with units) and effort_measures.csv.
New conformance checks at warn: streams_valid, efforts_valid (including a monotone curve within a workout), histograms_valid (bins add up to the stream's seconds).
Fixtures: the Strava archive run's file summarised. Migration migrations/1.2-to-1.3.sql for a stored 1.2 database (boards rebuild theirs on every import).
1.2.0 (2026-11-30), minor
For Nutrition & Weight. New optional table nutrition: one diary day of food per app and source (kcal, protein, carbs, fat, fibre, entries, the app's "day complete" flag). body: optional measured_at and n_samples.
Food and body rules written once (README): the diary date is the day; an unlogged day has no row (never zero intake); one source per day by the person's priority, never added; the day's first weigh-in; units at the door (lb, st, kJ, %, cm, in); food names and notes never stored.
Sources myfitnesspal, cronometer, withings, weigh-ins-csv. New conformance checks at warn: nutrition_plausible, body_plausible. Fixtures: one food day from MyFitnessPal and its Apple Health copy, a Cronometer day marked complete, one weigh-in from Withings and Apple Health.
Migration migrations/1.1-to-1.2.sql for a stored 1.1 database (boards rebuild theirs on every import).
1.1.0 (2026-11-30), minor
For Training Log. workouts: optional external_id (the source's activity id), sport_raw (the source's own activity type), indoor, laps_n.
New optional tables workout_zones (seconds per heart-rate zone 1..5, as the source measured them) and workout_laps (laps or splits).
Workout rules written once (README): one row per source, a board counts one row per real workout by source priority (matched by start time, sport and duration; never added or merged), units at the door, zones and laps are the source's.
Vocabularies: sources strava-archive, garmin-archive, fit-file; new sport_map.csv (each source's activity types and the sport they map to).
New conformance checks at warn: zones_valid, laps_valid, workouts_plausible.
Fixtures: the same run from an Apple Watch and the Strava archive, with zones and laps. No migration: boards rebuild their database from the person's files on every import.
1.0.0 (2026-11-30)
First published version, for Sleep & Recovery (Training Log reads workouts next): metric_codes (the controlled code list with units and day aggregation; HRV as two codes, hrv_sdnn and hrv_rmssd, never mixed), daily_metrics (one value per day, code, device and source), sleep_sessions (nights and naps with in bed, asleep, awake, light/deep/REM/unspecified stages, latency, efficiency, HRV, resting HR, breathing, local times and a time zone), workouts, optional body, import_counts (source accounting per file and record type), data_issues, annotations, metric_registry.
hrv_unverified: HRV a non-Apple source wrote as SDNN, kept apart from hrv_sdnn.
Night rules written once (README): awake wins where one device's samples overlap; periods formed on each device's timeline before night_of (a sleep past noon stays one); pieces 15 minutes apart for naps and evening dozes; interval union per device, one device per night chosen by the board, noon-to-noon night_of, sessions split by a gap, naps.
Conformance checks: codes, units, HRV kinds, ranges, session arithmetic, the noon rule, time zones, one main sleep (warn), workouts, import counts, meta (warn). Fictional fixtures covering every check.