feat(insights): populate the trailing sparkline series on derived metrics

The Derived<T> tile (SparklineDeltaTile) renders a trailing series, but the
engines never filled it, so the inline sparkline was always empty. Each engine
now carries a capped trailing series sourced from the rows it already reads:

- baseline-band metrics (incl. wrist-temperature / stair ascent+descent) ship
  the per-day mean series the band is built from;
- HRV balance reuses the day-mean read it already does for the recent average;
- the wellness scores (recovery / stress / strain) ship their window scores;
- the six-minute-walk band ships its reading series;
- BMI reads a bounded recent-weight set and derives a BMI series at the fixed
  profile height.

All series cap at the last 30 points. The vitals dashboard wires the series
into the baseline, HRV and BMI tiles; the tile already renders >= 2 points and
collapses the sparkline row otherwise.
This commit is contained in:
Marc-André Bombeck committed 2026-06-03 19:48:48 +02:00
1 parent e2c7d08bad
commit 99e089ff4c
13 files changed
+149 -14

No files matched your search

@@ -192,6 +192,7 @@ function BaselineTile({
value={v.center}
unit={unit}
icon={Icon}
series={v.series}
framing={framing}
directionSentiment={vitalSentiment(type)}
provenance={
@@ -320,6 +321,7 @@ function HrvBalanceTile({ read, isLoading }: TileProps) {
value={v.recentAvg}
unit={getUnitForType("HEART_RATE_VARIABILITY")}
icon={HeartPulse}
series={v.series}
directionSentiment="up-good"
framing={framing}
precision={0}
@@ -345,6 +347,7 @@ function BmiTile({ read, isLoading }: TileProps) {
value={v.bmi}
unit={getUnitForType("BODY_MASS_INDEX")}
icon={Scale}
series={v.series}
directionSentiment="neutral"
framing={framing}
precision={1}