mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
test(units): sweep the AI and Coach producers for unit literals
The unit sweep covered the display trees and the insight library; the
prompt and snapshot builders, the text-writing jobs and the target and
digest producers were outside it, which is where a band in mg/dL, a
threshold in kg/week and a distance in metres reached the model. The
sweep now walks those trees too and matches prose units ("kg/week",
"5 metres") as well as symbols. The four allowlist entries for prompts
that stated weight in kilograms are gone with the literals; the new
entries each name why the literal is not a reader-facing unit.
A line scanner cannot see a canonical number printed with no unit at
all, so the guard also names every producer that carries a
preference-dependent figure into a prompt, a snapshot or a stored
sentence and requires each to call a reader-unit resolver. The canonical
weight signal of the day loses its kilogram label; the reader's unit is
attached where the signal is converted.
Refs #1067
This commit is contained in:
1 parent
0028290117
commit
615f5a8070
2 files changed
+109
-16
No files matched your search
@@ -202,8 +202,7 @@ export function computeSignalsOfDay(
|
||||
"mmHg",
|
||||
),
|
||||
);
|
||||
// Glucose uses the canonical stored value (the model reads the snapshot,
|
||||
// not display units); absent data simply produces no signal.
|
||||
// Absent data simply produces no signal.
|
||||
push(buildSignal("glucose", "blood glucose", byType("BLOOD_GLUCOSE"), now));
|
||||
push(
|
||||
buildSignal(
|
||||
@@ -215,7 +214,10 @@ export function computeSignalsOfDay(
|
||||
),
|
||||
);
|
||||
push(buildSignal("pulse", "pulse", byType("PULSE"), now, "bpm"));
|
||||
push(buildSignal("weight", "weight", byType("WEIGHT"), now, "kg"));
|
||||
// Weight and glucose are canonical here and carry no unit: the reader's
|
||||
// unit is attached where the signal is converted for the prompt
|
||||
// (`featuresInReaderUnits`), so no canonical symbol can leak into one.
|
||||
push(buildSignal("weight", "weight", byType("WEIGHT"), now));
|
||||
// Sleep is stored one row per stage per night, so a raw "latest" point
|
||||
// would mis-sum; the sleep aggregates carry that signal already. Steps
|
||||
// ingest as many intraday `stats:`-prefixed samples, so the newest raw row
|
||||
|
||||
Reference in new issue
Block a user