Derive glucose isSpotEstimate from reading density

Hard-coding isSpotEstimate: true mislabels a dense Nightscout CGM stream
(~288 readings/day) as a spot estimate and undersells the data in the
clinical panel and coach. Compute readings-per-day over the covered span
and treat the series as continuous below the spot caveat once it clears a
~hourly bar (24 readings/day); sparse spot fingersticks keep the caveat.
The panel only renders the spot-reading line when isSpotEstimate, and the
OpenAPI field relaxes from a literal-true to a boolean.
This commit is contained in:
Marc-André Bombeck committed 2026-06-14 20:54:32 +02:00
1 parent c5a7e06e35
commit c268ace58c
6 files changed
+98 -31

No files matched your search

+4 -3
View File
@@ -1539,9 +1539,10 @@ async function buildCoachSnapshotImpl(
? Math.round(clinicalRaw.variability.cv)
: null,
unstable: clinicalRaw.variability?.unstable ?? null,
// Spot-reading estimate, never a CGM AGP — pinned so the model
// never narrates these as continuous-trace clinical figures.
isSpotEstimate: true as const,
// Density-derived: a sparse spot series stays a spot-reading
// estimate, a continuous CGM stream (Nightscout) reads false so the
// model can narrate the TIR/GMI as continuous-trace figures.
isSpotEstimate: clinicalRaw.isSpotEstimate,
};
// The display unit travels with the block so the prompt renders
// "<value> <unit>" and the EVIDENCE BLOCK tags glucose lines correctly.