fix(series): bucket heart-rate variability and blood oxygen like pulse

The dense rule in /api/measurements/series covered pulse and glucose
only. Heart-rate variability and blood oxygen read every raw row for
any window up to 3650 days, and a watch or ring that writes them every
minute makes that the same unbounded read pulse had.

Both kinds now fold per local day beyond 90 days and per local hour
inside 90 days once the window holds more than 10 000 readings. A
bucket keeps the point shape of its kind: only pulse carries
valueMin / valueMax. Statistics stay computed over every reading, and
a sparse series inside 90 days is unchanged. The OpenAPI description
names the four kinds.
This commit is contained in:
Marc-André Bombeck committed 2026-10-01 08:52:10 +02:00
1 parent 8949606de9
commit b2c484e25e
4 files changed
+210 -20

No files matched your search

+10 -9
View File
@@ -41066,9 +41066,9 @@ components:
properties:
id:
type: string
description: Measurement row id; `sleep:<wake-day>` for a sleep night; `day:<local-day>` for a day bucket (`pulse` /
`glucose` beyond 90 days); `hour:<ISO start>` for an hour bucket (`pulse` / `glucose` within 90 days
when the window holds more than 10 000 readings).
description: Measurement row id; `sleep:<wake-day>` for a sleep night; `day:<local-day>` for a day bucket (`pulse`,
`glucose`, `heartRateVariability`, `oxygenSaturation` beyond 90 days); `hour:<ISO start>` for an hour
bucket (the same kinds within 90 days when the window holds more than 10 000 readings).
at:
type: string
format: date-time
@@ -41141,12 +41141,13 @@ components:
- stats
additionalProperties: false
description: "iOS-friendly per-kind time series: one point per reading (or per reconstructed night for `sleep`), an
explicit `unit` token, and a summary `stats` block. Sample-dense kinds are bucketed server-side: `pulse` and
`glucose` beyond 90 days per local day, and `pulse` / `glucose` within 90 days per local hour when the window
holds more than 10 000 readings (a continuous glucose sensor, a watch recording heart rate every minute; a cuff
or fingerstick meter stays raw). A bucket carries the mean as `value`; a `pulse` bucket also carries its range
as `valueMin` / `valueMax`, and a `glucose` bucket is converted to the user's unit like a raw reading. `stats`
is always computed over the underlying readings, never over the buckets."
explicit `unit` token, and a summary `stats` block. Sample-dense kinds (`pulse`, `glucose`,
`heartRateVariability`, `oxygenSaturation`) are bucketed server-side: beyond 90 days per local day, and within
90 days per local hour when the window holds more than 10 000 readings (a continuous glucose sensor, a watch or
ring recording every minute; a cuff, a fingerstick meter or a few readings a night stay raw). A bucket carries
the mean as `value` and otherwise has the shape of a reading of its kind; a `pulse` bucket also carries its
range as `valueMin` / `valueMax`, and a `glucose` bucket is converted to the user's unit like a raw reading.
`stats` is always computed over the underlying readings, never over the buckets."
ListMeasurementsResponse:
type: object
properties: