From 1d3ee1d93c8dbedd5a0de7e32d80f2628f5349a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sun, 14 Jun 2026 21:46:20 +0200 Subject: [PATCH] test(integrations): expect six integration pills and drop unused field maps The mobile settings test asserted three integration pills; Polar, Oura and Nightscout bring the list to six. Remove the unused Oura and Polar field-map documentation constants and the unused advanced-indices interface the dead-code gate flagged. --- e2e/settings-integrations-mobile.spec.ts | 3 +-- src/lib/analytics/glucose-metrics.ts | 34 ------------------------ src/lib/oura/client.ts | 29 -------------------- src/lib/polar/client.ts | 31 --------------------- 4 files changed, 1 insertion(+), 96 deletions(-) diff --git a/e2e/settings-integrations-mobile.spec.ts b/e2e/settings-integrations-mobile.spec.ts index 5a7c79457..37f199529 100644 --- a/e2e/settings-integrations-mobile.spec.ts +++ b/e2e/settings-integrations-mobile.spec.ts @@ -143,9 +143,8 @@ test.describe("/settings/integrations Pixel-5 layout", () => { // Wait for the pills to mount (queries resolve after first paint). const pills = page.locator('[data-testid="integration-status-pill"]'); - // Three integration cards now (Withings, WHOOP, Google Health) → three // pills. - await expect(pills).toHaveCount(3, { timeout: 10_000 }); + await expect(pills).toHaveCount(6, { timeout: 10_000 }); // Withings is connected in this fixture; WHOOP is a BYO-keys card that // stays dormant until an operator adds credentials, so assert the one diff --git a/src/lib/analytics/glucose-metrics.ts b/src/lib/analytics/glucose-metrics.ts index a1d7be797..7e008ef4c 100644 --- a/src/lib/analytics/glucose-metrics.ts +++ b/src/lib/analytics/glucose-metrics.ts @@ -146,40 +146,6 @@ export interface TimeInRangeDistribution { }; } -/** - * Advanced glycaemic indices — the "advanced" disclosure tier of the panel. - * Each is a single scalar over the in-window readings; all are derivable from - * spot samples (unlike the dense-stream MAGE/CONGA/MODD family this module - * deliberately defers). Surfaced behind a progressive disclosure because they - * read as research-grade composites a casual user does not need up front. - */ -export interface GlucoseAdvancedIndices { - /** - * J-index — a single number folding central tendency AND variability: - * J = 0.001 × (mean + SD)², mean & SD in mg/dL. - * Reference bands (Wojcicki 1995): ~10–20 ideal/non-diabetic, - * 20–30 good control, 30–40 fair, > 40 poor. Reported here as an estimate - * over spot data, not a continuous-trace J. - * Wojcicki 1995, Horm Metab Res 27(1):41-42, DOI 10.1055/s-2007-979906. - */ - jIndex: number; - /** - * Low Blood Glucose Index — Kovatchev hypoglycaemia risk. Mean of the - * left-branch risk values `rl(BG)` over all readings; higher = more / deeper - * lows. Interpretation bands (Kovatchev 2006): < 1.1 minimal, 1.1–2.5 low, - * 2.5–5 moderate, > 5 high hypo risk. - * Kovatchev 2006, Diabetes Care 29(11):2433-2438, DOI 10.2337/dc06-1085. - */ - lbgi: number; - /** - * High Blood Glucose Index — Kovatchev hyperglycaemia risk. Mean of the - * right-branch risk values `rh(BG)`; higher = more / higher highs. - * Interpretation bands (Kovatchev 2006): < 4.5 low, 4.5–9 moderate, - * > 9 high hyper risk. - * Kovatchev 2006, Diabetes Care 29(11):2433-2438, DOI 10.2337/dc06-1085. - */ - hbgi: number; -} /** Variability summary: SD + CV% with the Monnier stability flag. */ export interface GlucoseVariability { diff --git a/src/lib/oura/client.ts b/src/lib/oura/client.ts index 96ca16c84..dcbf43cce 100644 --- a/src/lib/oura/client.ts +++ b/src/lib/oura/client.ts @@ -401,32 +401,3 @@ export function mapDailyActivity(a: OuraDailyActivity): MappedMeasurement[] { return out; } -export const OURA_FIELD_MAP: Record< - string, - { type: string; unit: string; note?: string } -> = { - "daily_readiness.score": { - type: "RECOVERY_SCORE", - unit: "score", - note: "0-100 readiness; feeds recovery ladder below WHOOP", - }, - "sleep.{light,deep,rem}_sleep_duration": { - type: "SLEEP_DURATION", - unit: "minutes", - note: "s->min, one row per stage", - }, - "sleep.awake_time": { - type: "SLEEP_DURATION", - unit: "minutes", - note: "AWAKE stage", - }, - "sleep.efficiency": { type: "SLEEP_EFFICIENCY", unit: "%" }, - "sleep.average_hrv": { type: "HRV_RMSSD", unit: "ms" }, - "sleep.lowest_heart_rate": { type: "RESTING_HEART_RATE", unit: "bpm" }, - "sleep.average_breath": { type: "RESPIRATORY_RATE", unit: "breaths/min" }, - "daily_activity.steps": { type: "ACTIVITY_STEPS", unit: "steps" }, - "daily_activity.active_calories": { - type: "ACTIVE_ENERGY_BURNED", - unit: "kcal", - }, -}; diff --git a/src/lib/polar/client.ts b/src/lib/polar/client.ts index 11e246cdb..322b0a160 100644 --- a/src/lib/polar/client.ts +++ b/src/lib/polar/client.ts @@ -432,34 +432,3 @@ export function mapActivity(a: PolarActivity): MappedMeasurement[] { } /** Field→Measurement reference table (mirror of the mappers above). */ -export const POLAR_FIELD_MAP: Record< - string, - { type: string; unit: string; note?: string } -> = { - "nightly_recharge.nightly_recharge_status": { - type: "RECOVERY_SCORE", - unit: "score", - note: "1-6 band rescaled to 0-100; feeds recovery ladder below WHOOP", - }, - "nightly_recharge.hrv_avg": { type: "HRV_RMSSD", unit: "ms" }, - "nightly_recharge.heart_rate_avg": { - type: "RESTING_HEART_RATE", - unit: "bpm", - }, - "nightly_recharge.breathing_rate_avg": { - type: "RESPIRATORY_RATE", - unit: "breaths/min", - }, - "sleep.{light,deep,rem}_sleep": { - type: "SLEEP_DURATION", - unit: "minutes", - note: "s->min, one row per stage (light->CORE, deep->DEEP, rem->REM)", - }, - "sleep.sleep_score": { type: "SLEEP_PERFORMANCE", unit: "%" }, - "activity.active-steps": { type: "ACTIVITY_STEPS", unit: "steps" }, - "activity.active-calories": { - type: "ACTIVE_ENERGY_BURNED", - unit: "kcal", - note: "active portion only (NOT total calories incl. BMR)", - }, -};