mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
feat(insights): add the same-time baseline for cumulative metrics
Compare today's running total at the last completed local hour against this person's own typical total at that same hour, over a trailing four weeks of stored intraday profiles. Same estimator as the vitals baseline — median for the centre, median plus or minus k times MAD for the band — so a reader who understands one understands the other. It refuses to speak below fourteen usable days and says so through the existing insufficient arm rather than a band built on three days. It ships no projected day total: extrapolating a partial day is a guess, and this exists to replace guesses. Steps first; active energy, distance and flights ride the same engine.
This commit is contained in:
1 parent
22d7e8c30c
commit
b2955beffd
5 files changed
+407
-1
No files matched your search
@@ -178,4 +178,14 @@ export const METRIC_PROVENANCE: Record<DerivedMetricId, MetricProvenanceMeta> =
|
||||
},
|
||||
caveatKey: "insights.derived.composite.TRAJECTORY.caveat",
|
||||
},
|
||||
SAME_TIME_BASELINE: {
|
||||
methodKey: "insights.derived.composite.SAME_TIME_BASELINE.method",
|
||||
standard: {
|
||||
// Same robust median ± k·MAD estimator as the vitals baseline, applied
|
||||
// to the window's totals at one local hour rather than to daily means.
|
||||
name: "Leys et al. 2013, J. Exp. Soc. Psychol.",
|
||||
url: "https://doi.org/10.1016/j.jesp.2013.03.013",
|
||||
},
|
||||
caveatKey: "insights.derived.composite.SAME_TIME_BASELINE.caveat",
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user