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

@@ -206,10 +206,15 @@ export function GlucoseClinicalPanel() {
) : null}
</section>
{/* Spot-reading honesty caveat — always present. */}
<p className="text-muted-foreground/80 text-xs" data-slot="glucose-spot-caveat">
{t("insights.bloodGlucose.clinical.spotCaveat")}
</p>
{/* Spot-reading honesty caveat — only for sparse spot data. A dense
continuous stream (a CGM such as Nightscout) clears the density bar
and reports `isSpotEstimate: false`, so the caveat would undersell
the data. */}
{clinical.isSpotEstimate ? (
<p className="text-muted-foreground/80 text-xs" data-slot="glucose-spot-caveat">
{t("insights.bloodGlucose.clinical.spotCaveat")}
</p>
) : null}
{/* Advanced indices behind a disclosure. */}
{clinical.advanced ? (