mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
fix(series): follow the source priority ladder in the dense and raw series reads
The rollup tier and sleep resolve every (type, day) to the source the person's ladder picks before they aggregate. The dense and raw reads of /api/measurements/series filtered on user and type only, so with a second provider a day's value blended the two, a reading present in both showed twice, and the configured ladder had no effect on those charts. Both reads now take the ladder-winning source per day through the shared canonicalMeasurementsCte helper, as the other live readers do: - the day and hour bucket read of the dense kinds (pulse, glucose, HRV, SpO2), and the stats strip over its rows; - the generic raw read (weight, body fat, steps, resting heart rate, ...). The collapse is per day for the hour grain too, as everywhere else. The helper gains an optional single-type scope so a series scans one metric, not every row the person has in the window. Only a type that has a ladder is collapsed. For a type without one (glucose, body water, bone mass) the helper breaks the tie by source name, which would silently hide one of two real sources, so those keep every source as before. A single-source account reads exactly what is stored. Tests: a real-database test covering the ladder in both directions, the per-day fallback, a reading mirrored into two sources, the day-bucket, hour- bucket and raw reads, a type with no ladder and a single-source account. The route's unit test file reads its fixtures through a small adapter for the new raw statements, and the dense-read guard drops the exception for the removed findMany. The OpenAPI description states the rule. Refs #1108
This commit is contained in:
1 parent
02b6f06521
commit
bb1acfab64
10 files changed
+566
-57
No files matched your search
@@ -3885,7 +3885,10 @@ paths:
|
||||
explicit `unit` token and a summary `stats` block. `bloodPressure` pairs systolic + diastolic (`secondary`)
|
||||
within ±5 min so one fetch renders the dual-line chart; `sleep` collapses per-stage rows into one per-night
|
||||
point carrying time-asleep in hours (`sleepStages` holds the per-stage breakdown) and is internally capped to
|
||||
365 days. `glucose` values + `unit` resolve to the user's mg/dL|mmol/L preference. Auth via cookie or Bearer.
|
||||
365 days. `glucose` values + `unit` resolve to the user's mg/dL|mmol/L preference. Where a metric has a
|
||||
source-priority ladder (pulse, weight, SpO2, HRV, ...), each day shows the readings of the source the person's
|
||||
ladder picks for that day, so a second provider never blends into or duplicates a day; a metric without a ladder
|
||||
(glucose, body water, bone mass) keeps every source. Auth via cookie or Bearer.
|
||||
parameters:
|
||||
- in: query
|
||||
name: kind
|
||||
|
||||
Reference in new issue
Block a user