GlucoseIQ
API Reference@glucoseiq/core

Meals & AUC

Meal-response and area-under-the-curve analysis.

analyzeMealResponse

Import: @glucoseiq/core/metrics

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

Analyzes the glucose response to a meal.

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

import { type GlucoseReading } from '@glucoseiq/core'
import { analyzeMealResponse } from '@glucoseiq/core/metrics'

const readings: GlucoseReading[] = [
  { value: 98, unit: 'mg/dL', timestamp: '2024-01-01T12:25:00Z' },
  { value: 162, unit: 'mg/dL', timestamp: '2024-01-01T13:15:00Z' },
  { value: 125, unit: 'mg/dL', timestamp: '2024-01-01T13:45:00Z' },
]
const result = analyzeMealResponse(readings, '2024-01-01T12:30:00Z')
const delta = result.valid ? result.delta : null
void delta
ParameterDescription
readingsGlucose readings with ISO 8601 timestamps
mealTimeISO 8601 timestamp of the meal (t=0)
optionsWindow length and output unit

glucoseAUC

Import: @glucoseiq/core/metrics

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

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

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

import { type GlucoseReading } from '@glucoseiq/core'
import { glucoseAUC } from '@glucoseiq/core/metrics'

const readings: GlucoseReading[] = [
  { value: 100, unit: 'mg/dL', timestamp: '2024-01-01T08:00:00Z' },
  { value: 120, unit: 'mg/dL', timestamp: '2024-01-01T08:05:00Z' },
]
const area = glucoseAUC(readings) // mg/dL·min
ParameterDescription
readingsGlucose readings with ISO 8601 timestamps
optionsOutput unit

incrementalAUC

Import: @glucoseiq/core/metrics

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.

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

import { type GlucoseReading } from '@glucoseiq/core'
import { incrementalAUC } from '@glucoseiq/core/metrics'

const readings: GlucoseReading[] = [
  { value: 100, unit: 'mg/dL', timestamp: '2024-01-01T08:00:00Z' },
  { value: 140, unit: 'mg/dL', timestamp: '2024-01-01T08:30:00Z' },
]
const preMealValue: number = 100
const area = incrementalAUC(readings, preMealValue)
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)

On this page