GlucoseIQ

Meals & AUC

Postprandial meal response and area-under-the-curve.

3 functions

Generated from the source TSDoc — every signature, parameter, and example is the real thing.

analyzeMealResponse

analyzeMealResponse(readings: GlucoseReading[], mealTime: string, options?: MealResponseOptions): MealResponseResult

Analyzes the glucose response to a meal.

ParameterDescription
readingsGlucose readings with ISO 8601 timestamps
mealTimeISO 8601 timestamp of the meal (t=0)
optionsWindow length and output unit

Returns — Meal-response metrics; valid: false if the window has fewer than two readings

const r = analyzeMealResponse(readings, '2024-01-01T12:30:00Z')
// { baseline: 98, peakValue: 162, delta: 64, timeToPeakMin: 45, ... }

glucoseAUC

glucoseAUC(readings: GlucoseReading[], options?: AUCOptions): number

Total area under the glucose-time curve (trapezoidal rule).

ParameterDescription
readingsGlucose readings with ISO 8601 timestamps
optionsOutput unit

Returns — Area in (unit × minutes), or NaN if fewer than two valid readings

glucoseAUC(readings) // e.g. 18240 (mg/dL·min)

incrementalAUC

incrementalAUC(readings: GlucoseReading[], baseline: number, options?: AUCOptions): number

Incremental area under the curve above a baseline (Wolever iAUC).

Only above-baseline area is counted; a segment crossing the baseline contributes only its above-baseline triangle, and fully-below segments contribute zero. For a meal response, pass the pre-meal value as baseline.

ParameterDescription
readingsGlucose readings with ISO 8601 timestamps
baselineBaseline value in the output unit (e.g. the pre-meal reading)
optionsOutput unit (must match the unit of baseline)

Returns — Incremental area in (unit × minutes), or NaN if fewer than two valid readings

incrementalAUC(readings, preMealValue) // e.g. 4120 (mg/dL·min above baseline)

On this page