GlucoseIQ
API Reference@glucoseiq/core

Types & Interfaces

Public contracts for ingestion, analytics, rendering, and integrations.

A1CReading

interface A1CReading

Import: @glucoseiq/core

Single A1C reading (value and ISO date).

PropertyTypeDescription
datestring
valuenumber

AGPChartOptions

interface AGPChartOptions

Import: @glucoseiq/core/render

Options for agpChartToSVG.

PropertyTypeDescription
readonly binMinutes?numberBin width in minutes for the underlying profile (default 5).
readonly height?numberSVG height in px (default 320).
readonly theme?'light' | 'dark'Color theme (default 'dark').
readonly timeZone?stringIANA time zone for time-of-day bucketing (default 'UTC').
readonly title?stringOptional chart title.
readonly width?numberSVG width in px (default 800).

AGPMetricsOptions

interface AGPMetricsOptions

Import: @glucoseiq/core/metrics

Options for the aggregate AGP metrics calculation.

PropertyTypeDescription
readonly activePercent?ActivePercentOptionsActive percent configuration (expected interval)
readonly conga?CONGAOptionsCONGA configuration (hours, tolerance)
readonly modd?MODDOptionsMODD tolerance configuration

AGPMetricsResult

interface AGPMetricsResult

Import: @glucoseiq/core/metrics

Selected aggregate AGP metrics result.

PropertyTypeDescription
readonly activePercentActivePercentResultTimestamp-slot coverage estimate; not proof of sensor wear.
readonly adrrnumberAverage Daily Risk Range
readonly conganumberContinuous Overall Net Glycemic Action (mg/dL)
readonly cvnumberCoefficient of variation (%)
readonly gradeGRADEResultGRADE score and partitioned components
readonly griGRIResultGlycemia Risk Index
readonly hbginumberHigh Blood Glucose Index
readonly jIndexnumberJ-Index
readonly lbginumberLow Blood Glucose Index
readonly meanGlucosenumberMean glucose in mg/dL
readonly moddnumberMean of Daily Differences (mg/dL)
readonly sdnumberStandard deviation in mg/dL
readonly totalReadingsnumberNumber of valid readings used

AGPProfileBin

interface AGPProfileBin

Import: @glucoseiq/core/metrics

A single time-of-day bin in the AGP profile.

PropertyTypeDescription
readonly minuteOfDaynumberMinute-of-day at the start of this bin (0–1439).
readonly nnumberNumber of pooled readings in this bin.
readonly percentilesRecord<number, null | number>Percentile value keyed by percentile; null when the bin has no readings.

AGPProfileOptions

interface AGPProfileOptions

Import: @glucoseiq/core/metrics

Options for buildAGPProfile.

PropertyTypeDescription
readonly binMinutes?numberBin width in minutes (default 5). Integer in [1, 1440].
readonly method?PercentileMethodPercentile method (default 'nearest-rank').
readonly percentiles?number[]Percentiles to compute per bin (default [5, 25, 50, 75, 95]). Values outside [0, 100] are ignored.
readonly timeZone?stringIANA time zone used to assign readings to a minute-of-day (default 'UTC').
readonly unit?GlucoseUnitOutput unit for percentile values (default 'mg/dL'). Input readings are normalized to this unit.

AGPProfileResult

interface AGPProfileResult

Import: @glucoseiq/core/metrics

Result of buildAGPProfile.

PropertyTypeDescription
readonly binMinutesnumberBin width used (minutes).
readonly binsAGPProfileBin[]All time-of-day bins across the full day (always present, empty bins included).
readonly percentilesnumber[]Percentiles computed (sanitized to [0, 100]).
readonly timeZonestringIANA time zone applied when bucketing readings.
readonly totalReadingsnumberCount of valid readings pooled into the profile.
readonly unitGlucoseUnitOutput unit of percentile values.
readonly validbooleanfalse when no valid readings were available.

AUCOptions

interface AUCOptions

Import: @glucoseiq/core/metrics

Options for AUC helpers.

PropertyTypeDescription
readonly unit?GlucoseUnitOutput unit for values (default 'mg/dL'); area is expressed in this unit × minutes.

ActivePercentOptions

interface ActivePercentOptions

Import: @glucoseiq/core/metrics

Options for active percent calculation.

PropertyTypeDescription
readonly expectedIntervalMinutes?numberPositive finite expected interval between readings in minutes (default: 5).

ActivePercentResult

interface ActivePercentResult

Import: @glucoseiq/core/metrics

Result of the active percent calculation.

PropertyTypeDescription
readonly activePercentnumberPercentage of expected timestamp slots that were occupied (0-100).
readonly actualReadingsnumberNumber of expected-interval slots containing at least one parseable timestamp.
readonly expectedReadingsnumberNumber of expected timestamp slots based on time span and interval.
readonly meetsClinicalMinimumbooleanWhether the unrounded slot-coverage ratio is at least 70%. Compatibility field; not a clinical determination.
readonly totalMinutesnumberTotal time span covered in minutes

AlignOptions

interface AlignOptions

Import: @glucoseiq/core

Options for alignToGrid.

PropertyTypeDescription
readonly intervalMin?numberGrid interval in minutes (default 5).
readonly maxInterpolateGapMin?numberInterpolate only across gaps up to this many minutes (default 15).
readonly unit?GlucoseUnitOutput unit (default 'mg/dL'). Input units are normalized.

AnalyzeGlucoseOptions

interface AnalyzeGlucoseOptions

Import: @glucoseiq/core

Options for analyzeGlucose.

PropertyTypeDescription
readonly includeProfile?booleanInclude the AGP percentile-band series (default true).
readonly minActivePercent?numberMinimum active/wear percent for the consensus sufficiency flag (default 70).
readonly minDays?numberMinimum days of data for the consensus sufficiency flag (default 14).
readonly timeZone?stringIANA time zone for the AGP profile (default 'UTC').

AnalyzeGlucoseResult

interface AnalyzeGlucoseResult

Import: @glucoseiq/core

Result of analyzeGlucose.

PropertyTypeDescription
readonly agpProfilenull | AGPProfileResult
readonly cvnumber
readonly dataSufficiencyDataSufficiency
readonly episodesnull | EpisodeResult
readonly gminumber
readonly meanGlucosenumber
readonly risknull | RiskMetrics
readonly sdnumber
readonly tightRangenull | TITRResult
readonly timeInRangenull | EnhancedTIRResult
readonly validboolean

CONGAOptions

interface CONGAOptions

Import: @glucoseiq/core/metrics

Options for CONGA calculation.

PropertyTypeDescription
readonly hours?numberNumber of hours for the time lag (default: 1)
readonly toleranceMinutes?numberTolerance window in minutes for matching readings (default: 15)

CSVParseOptions

interface CSVParseOptions

Import: @glucoseiq/core

Options for parseGlucoseCSV.

PropertyTypeDescription
readonly delimiter?stringField delimiter (default ,). Must be exactly one UTF-16 code unit other than double quote, NUL, CR, or LF.
readonly timestampColumnstringHeader name of the timestamp column.
readonly unit?GlucoseUnitUnit of the values (default 'mg/dL').
readonly valueColumnstringHeader name of the glucose value column.

CohortResult

interface CohortResult

Import: @glucoseiq/core

Result of aggregateCohort.

PropertyTypeDescription
readonly cvDistributionStatsDistribution of CV% across patients.
readonly gmiDistributionStatsDistribution of GMI across patients.
readonly meanGlucoseDistributionStatsDistribution of mean glucose (mg/dL) across patients.
readonly patientCountnumberNumber of patients with at least one valid reading.
readonly tirDistributionStatsDistribution of in-range % across patients.

ConnectorCapabilities

interface ConnectorCapabilities

Import: @glucoseiq/core/connectors

Declarative capabilities of a CGM data source.

PropertyTypeDescription
readonly clockModelClockModelWhether timestamps come straight from the device or via a relay.
readonly historyDepthDaysnumberTypical history depth available from the feed, in days.
readonly maxFreshnessSecnumberReadings older than this (seconds) should be considered stale.
readonly sourceCGMSourceThe source this describes.
readonly tier1 | 2Connector tier: 1 = full-fidelity vendor feed, 2 = community/relay.
readonly trendVocabularyTrendVocabularyTrend-arrow vocabulary coverage.
readonly updateIntervalSecnumberTypical seconds between new readings.

ConversionResult

interface ConversionResult

Import: @glucoseiq/core

Result of glucose unit conversion. Provides converted value and new unit for interoperability.

See: https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/BIOPRO_L.htm

PropertyTypeDescription
readonly unitGlucoseUnitNew glucose unit after conversion
readonly valuenumberConverted glucose value

DataSufficiency

interface DataSufficiency

Import: @glucoseiq/core

Data-sufficiency assessment for an analytics result.

PropertyTypeDescription
readonly activePercentnumberRounded expected-slot coverage; duplicate/same-slot rows count once.
readonly daysOfDatanumberSpan of the data in days (last − first).
readonly meetsCGMStandardbooleanWhether the observed span and unrounded slot coverage meet the configured numeric thresholds.
readonly totalReadingsnumberNumber of valid readings analyzed.

DayNightOptions

interface DayNightOptions

Import: @glucoseiq/core

Options for splitDayNight.

PropertyTypeDescription
readonly nightEndHour?numberHour the night window ends, exclusive (default 6).
readonly nightStartHour?numberHour the night window begins (default 0).
readonly timeZone?stringIANA time zone used to classify each reading's local hour (default 'UTC').

DayNightSplit

interface DayNightSplit

Import: @glucoseiq/core

Result of splitDayNight.

PropertyTypeDescription
readonly dayGlucoseReading[]
readonly nightGlucoseReading[]

DexcomShareEntry

interface DexcomShareEntry

Import: @glucoseiq/core/connectors

Raw glucose entry returned by the Dexcom Share service. Matches the shape of @diakem/dexcom-api-client and dexcom-share-client responses.

PropertyTypeDescription
DT?stringOptional: Dexcom device serial or record id
ST?stringStable record identifier
TrendDexcomTrendStringDexcom trend string
ValuenumberGlucose value in mg/dL
WTstringDexcom date string, e.g. "Date(1700000000000)" or ISO 8601

DistributionStats

interface DistributionStats

Import: @glucoseiq/core

Distribution of a metric across a cohort.

PropertyTypeDescription
readonly maxnumber
readonly meannumber
readonly mediannumber
readonly minnumber
readonly p25number
readonly p75number

EnhancedTIROptions

interface EnhancedTIROptions

Import: @glucoseiq/core

Options that select a population goal set or override Enhanced TIR thresholds.

PropertyTypeDescription
readonly highThreshold?numberOverride for the high threshold (181-250 mg/dL). Value must be provided in mg/dL.
readonly lowThreshold?numberOverride for the low threshold (54-69 mg/dL). Value must be provided in mg/dL.
readonly population?TIRPopulationPopulation type for target assessment (default: 'standard')
readonly veryHighThreshold?numberOverride for the very high threshold (>250 mg/dL). Value must be provided in mg/dL.
readonly veryLowThreshold?numberOverride for the very low threshold (<54 mg/dL). Value must be provided in mg/dL.

EnhancedTIRResult

interface EnhancedTIRResult

Import: @glucoseiq/core

Complete Enhanced Time-in-Range result. Provides a five-range glucose breakdown using the 2019 consensus thresholds.

See: International Consensus on Time in Range (2019)

PropertyTypeDescription
readonly highRangeMetricsHigh: 181-250 mg/dL (10.1-13.9 mmol/L) - Level 1 Hyperglycemia. Average value is reported in mg/dL.
readonly inRangeRangeMetricsIn Range: 70-180 mg/dL (3.9-10.0 mmol/L) - Target Range. Average value is reported in mg/dL.
readonly lowRangeMetricsLow: 54-69 mg/dL (3.0-3.8 mmol/L) - Level 1 Hypoglycemia. Average value is reported in mg/dL.
readonly meetsTargetsTargetAssessmentAssessment against the configured targets
readonly summaryTIRSummarySummary statistics
readonly veryHighRangeMetricsVery High: >250 mg/dL (>13.9 mmol/L) - Level 2 Hyperglycemia. Average value is reported in mg/dL.
readonly veryLowRangeMetricsVery Low: <54 mg/dL (3.0 mmol/L) - Level 2 Hypoglycemia. Average value is reported in mg/dL.

EpisodeOptions

interface EpisodeOptions

Import: @glucoseiq/core/metrics

Options for detectEpisodes. Thresholds are in mg/dL.

PropertyTypeDescription
readonly endDurationMin?numberMinimum gap between flagged readings that separates candidates, in minutes (default 15).
readonly hyperLevel2?numberLevel 2 hyperglycemia threshold (default 250).
readonly hyperThreshold?numberHyperglycemia threshold (default 180).
readonly hypoLevel2?numberLevel 2 hypoglycemia threshold (default 54).
readonly hypoThreshold?numberHypoglycemia threshold (default 70).
readonly minDurationMin?numberMinimum episode duration in minutes (default 15).

EpisodeResult

interface EpisodeResult

Import: @glucoseiq/core/metrics

Result of detectEpisodes.

PropertyTypeDescription
readonly hyperEventsGlucoseEpisode[]
readonly hypoEventsGlucoseEpisode[]
readonly summaryEpisodeSummary

EpisodeSummary

interface EpisodeSummary

Import: @glucoseiq/core/metrics

Summary counts across timestamp-grouped episode candidates.

PropertyTypeDescription
readonly hyperCountnumber
readonly hyperLevel2Countnumber
readonly hypoCountnumber
readonly hypoLevel2Countnumber
readonly totalHyperMinutesnumber
readonly totalHypoMinutesnumber

EstimateGMIOptions

interface EstimateGMIOptions

Import: @glucoseiq/core

Options for GMI (Glucose Management Indicator) estimation. Used to standardize GMI calculation input.

See: https://diatribe.org/glucose-management-indicator-gmi

PropertyTypeDescription
unitGlucoseUnit
valuenumber

FHIRCGMComponent

interface FHIRCGMComponent

Import: @glucoseiq/core/interop

LOINC-coded CGM summary observation component.

PropertyTypeDescription
readonly codeFHIRCodeableConceptCoded component descriptor
readonly valueQuantityFHIRQuantityMeasured value in FHIR valueQuantity shape

FHIRCGMSensorReading

interface FHIRCGMSensorReading

Import: @glucoseiq/core/interop

Lightweight FHIR-aligned CGM sensor reading. Follows the structure of the HL7 CGM IG sensor reading profile.

See: https://build.fhir.org/ig/HL7/cgm/StructureDefinition-cgm-sensor-reading-mass-per-volume.html

PropertyTypeDescription
readonly codeFHIRCodeableConcept
readonly effectiveDateTimestring
readonly resourceType'Observation'
readonly status'final'
readonly valueQuantityFHIRQuantity

FHIRCGMSummary

interface FHIRCGMSummary

Import: @glucoseiq/core/interop

Lightweight FHIR-aligned CGM summary observation. Follows the structure of the HL7 CGM IG CGMSummaryObservation profile without requiring a full FHIR library.

See: https://build.fhir.org/ig/HL7/cgm/StructureDefinition-cgm-summary.html

PropertyTypeDescription
readonly codeFHIRCodeableConcept
readonly componentreadonly FHIRCGMComponent[]
readonly effectivePeriod{ readonly end: string; readonly start: string }
readonly resourceType'Observation'
readonly status'final'

FHIRCodeableConcept

interface FHIRCodeableConcept

Import: @glucoseiq/core/interop

PropertyTypeDescription
readonly codingreadonly FHIRCoding[]

FHIRCoding

interface FHIRCoding

Import: @glucoseiq/core/interop

PropertyTypeDescription
readonly codestring
readonly displaystring
readonly systemstring

FHIRQuantity

interface FHIRQuantity

Import: @glucoseiq/core/interop

PropertyTypeDescription
readonly codestring
readonly systemstring
readonly unitstring
readonly valuenumber

GRADEResult

interface GRADEResult

Import: @glucoseiq/core/metrics

Result of the partitioned GRADE calculation.

PropertyTypeDescription
readonly gradenumberMean GRADE score across all valid readings
readonly gradeEuglycemianumber% of total GRADE contributed by euglycemic readings (70-140 mg/dL)
readonly gradeHyperglycemianumber% of total GRADE contributed by hyperglycemic readings (>140 mg/dL)
readonly gradeHypoglycemianumber% of total GRADE contributed by hypoglycemic readings (<70 mg/dL)

GRIInput

interface GRIInput

Import: @glucoseiq/core/metrics

Input percentages for GRI calculation.

PropertyTypeDescription
readonly highPercentnumber% time 181-250 mg/dL
readonly lowPercentnumber% time 54-69 mg/dL
readonly veryHighPercentnumber% time > 250 mg/dL
readonly veryLowPercentnumber% time < 54 mg/dL

GRIResult

interface GRIResult

Import: @glucoseiq/core/metrics

GRI result with numeric score and risk zone.

PropertyTypeDescription
readonly hyperComponentnumber
readonly hypoComponentnumber
readonly scorenumber
readonly zone'A' | 'B' | 'C' | 'D' | 'E'

GVIPGSOptions

interface GVIPGSOptions

Import: @glucoseiq/core/metrics

Options for calculateGVIPGS.

PropertyTypeDescription
readonly maxGapMinutes?numberMaximum minutes between readings to count a step (default ~5.17).
readonly targetHigh?numberIn-range upper bound, mg/dL, exclusive (default 180).
readonly targetLow?numberIn-range lower bound, mg/dL, inclusive (default 70).

GVIPGSResult

interface GVIPGSResult

Import: @glucoseiq/core/metrics

Result of calculateGVIPGS.

PropertyTypeDescription
readonly gvinumberGlucose Variability Index (actual path length / ideal).
readonly meanGlucosenumberMean glucose used (mg/dL, floored).
readonly pgsnumberPatient Glycemic Status.
readonly timeInRangeFractionnumberTime-in-range fraction used (PTIR).

GapDetectionOptions

interface GapDetectionOptions

Import: @glucoseiq/core

Options for detectGaps.

PropertyTypeDescription
readonly maxGapMinutes?numberA gap is any interval longer than this many minutes (default 15).

GlucoseEpisode

interface GlucoseEpisode

Import: @glucoseiq/core/metrics

A timestamp-grouped glucose episode candidate.

PropertyTypeDescription
readonly durationMinutesnumberEpisode duration in minutes (span of flagged readings).
readonly endTimestringISO 8601 timestamp of the last reading in the episode.
readonly extremeValuenumberNadir (hypo) or peak (hyper) glucose in mg/dL.
readonly level1 | 2Clinical level: 1 (moderate) or 2 (clinically significant).
readonly meanValuenumberMean glucose of the flagged readings (mg/dL).
readonly readingCountnumberNumber of flagged readings in the episode.
readonly startTimestringISO 8601 timestamp of the first reading in the episode.
readonly type'hypo' | 'hyper''hypo' (below threshold) or 'hyper' (above threshold).

GlucoseGap

interface GlucoseGap

Import: @glucoseiq/core

A detected gap between consecutive readings.

PropertyTypeDescription
readonly durationMinutesnumberGap duration in minutes.
readonly endstringISO 8601 timestamp of the reading after the gap.
readonly startstringISO 8601 timestamp of the reading before the gap.

GlucoseIQScore

interface GlucoseIQScore

Import: @glucoseiq/core

Result of glucoseIQScore.

PropertyTypeDescription
readonly grinumberUnderlying Glycemia Risk Index.
readonly ratingGlucoseIQRatingQualitative rating.
readonly scorenumber0–100 score, higher is better (100 − GRI).
readonly validbooleanWhether the score could be computed.
readonly zonenull | 'A' | 'B' | 'C' | 'D' | 'E'GRI risk zone (A best … E worst), or null if not computable.

GlucoseReading

interface GlucoseReading

Import: @glucoseiq/core

Single glucose reading. Includes value, unit, and ISO 8601 timestamp for analytics.

See: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7445493/

PropertyTypeDescription
readonly timestampstring
readonly unitGlucoseUnit
readonly valuenumber

GlucoseStatsOptions

interface GlucoseStatsOptions

Import: @glucoseiq/core

Options for glucose statistics analytics. Controls which metrics are calculated and reported.

PropertyTypeDescription
a1c?boolean
gmi?boolean
range[number, number]
readingsGlucoseReading[]
tir?boolean
tirPercent?boolean
tirPercentAbove?boolean
tirPercentAboveRounded?boolean
tirPercentBelow?boolean
tirPercentBelowRounded?boolean
tirPercentInRange?boolean
tirPercentInRangeRounded?boolean
tirRange?[number, number]
unitGlucoseUnit

GlucoseTrendOptions

interface GlucoseTrendOptions

Import: @glucoseiq/core

Options for computeGlucoseTrend.

PropertyTypeDescription
readonly windowMin?numberTrailing window in minutes over which rate-of-change is fit (default 15).

GlucoseTrendResult

interface GlucoseTrendResult

Import: @glucoseiq/core

Result of computeGlucoseTrend.

PropertyTypeDescription
readonly readingsUsednumberNumber of readings used in the fit.
readonly rocPerMinnumberRate-of-change in mg/dL per minute (NaN when not computable).
readonly trendCGMTrendDerived CGM trend (or 'unknown' when not computable).
readonly windowMinutesnumberTrailing window used (minutes).

GridPoint

interface GridPoint

Import: @glucoseiq/core

A resampled grid point.

PropertyTypeDescription
readonly interpolatedbooleanTrue when the value was linearly interpolated rather than observed.
readonly timestampstringISO 8601 timestamp of the grid slot.
readonly valuenumberGlucose value in the output unit.

IGCOptions

interface IGCOptions

Import: @glucoseiq/core/metrics

Options for calculateIGC. All thresholds are in mg/dL.

PropertyTypeDescription
readonly hyperExponent?numberHyperglycemia exponent a (default 1.1).
readonly hyperScale?numberHyperglycemia scale factor c (default 30).
readonly hypoExponent?numberHypoglycemia exponent b (default 2.0).
readonly hypoScale?numberHypoglycemia scale factor d (default 30).
readonly lltr?numberLower limit of target range (default 80).
readonly ultr?numberUpper limit of target range (default 140).
readonly unit?GlucoseUnitUnit of the input values (default 'mg/dL'); 'mmol/L' is converted to mg/dL.

IGCResult

interface IGCResult

Import: @glucoseiq/core/metrics

Result of calculateIGC.

PropertyTypeDescription
readonly hyperIndexnumber
readonly hypoIndexnumber
readonly igcnumber

LibreLinkUpEntry

interface LibreLinkUpEntry

Import: @glucoseiq/core/connectors

Raw glucose entry from the Libre LinkUp API. Matches the shape of librelinkup-api-client and libre-client responses.

PropertyTypeDescription
FactoryTimestamp?stringFactory timestamp
GlucoseUnits?0 | 1Display unit flag: 1 = mg/dL, 0 = mmol/L
MeasurementColor?numberMeasurement color (vendor-specific)
TimestampstringISO 8601 timestamp string
TrendArrowLibreTrendValueTrend arrow (1=falling fast, 2=falling, 3=stable, 4=rising, 5=rising fast)
ValuenumberGlucose value in the account's display unit (see GlucoseUnits)
ValueInMgPerDl?numberGlucose value in mg/dL, when provided by the API (preferred)

MAGEOptions

interface MAGEOptions

Import: @glucoseiq/core

Configuration options for MAGE calculation.

PropertyTypeDescription
direction?'auto' | 'ascending' | 'descending'Excursion direction: 'auto', 'ascending', or 'descending'
longWindow?numberLong moving-average window; defaults to max(shortWindow + 2, min(32, floor(usableLength / 3)))
shortWindow?numberShort moving-average window; defaults to max(3, min(5, floor(usableLength / 8)))

MODDOptions

interface MODDOptions

Import: @glucoseiq/core/metrics

Options for MODD calculation.

PropertyTypeDescription
readonly toleranceMinutes?numberTolerance window in minutes for matching readings across days (default: 15)

MValueOptions

interface MValueOptions

Import: @glucoseiq/core/metrics

Options for glucoseMValue.

PropertyTypeDescription
readonly includeCorrection?booleanAdd the W = range/20 correction term (default true, per the 1965 manuscript).
readonly index?numberIdeal reference glucose in mg/dL (default 120).
readonly unit?GlucoseUnitUnit of the input values (default 'mg/dL'); 'mmol/L' is converted to mg/dL.

MealResponseOptions

interface MealResponseOptions

Import: @glucoseiq/core/metrics

Options for analyzeMealResponse.

PropertyTypeDescription
readonly unit?GlucoseUnitOutput unit for values (default 'mg/dL').
readonly windowMin?numberMinutes after the meal to analyze (default 120).

MealResponseResult

interface MealResponseResult

Import: @glucoseiq/core/metrics

Result of analyzeMealResponse.

PropertyTypeDescription
readonly baselinenumberPre-meal baseline value (output unit).
readonly deltanumberPeak minus baseline (output unit).
readonly iAUCnumberIncremental AUC above baseline (output unit × minutes).
readonly peakValuenumberPeak glucose value in the window (output unit).
readonly readingCountnumberNumber of readings in the window.
readonly returnToBaselineMinnull | numberMinutes from the meal until glucose first returns to baseline after the peak, or null.
readonly timeToPeakMinnumberMinutes from the meal to the peak.
readonly validbooleanWhether a response could be computed.
readonly windowMinutesnumberWindow analyzed (minutes).

NightscoutEntry

interface NightscoutEntry

Import: @glucoseiq/core/connectors

Nightscout SGV (Sensor Glucose Value) entry. Matches the /api/v1/entries response shape.

See: https://nightscout.github.io/nightscout/setup_variables/#api

PropertyTypeDescription
_id?stringNightscout record _id
datenumberEpoch timestamp in milliseconds
dateString?stringISO 8601 date string
direction?NightscoutDirectionTrend direction
sgvnumberSensor glucose value in mg/dL
type?stringEntry type (usually "sgv")

NormalizeError

interface NormalizeError

Import: @glucoseiq/core/connectors

A single entry that failed to normalize.

PropertyTypeDescription
readonly code?GlucoseIQErrorCodeStable machine-readable code for intentional library errors.
readonly indexnumberIndex of the failing entry in the input array.
readonly messagestringThe error message.

NormalizedCGMReading

interface NormalizedCGMReading extends GlucoseReading

Import: @glucoseiq/core/connectors

Extended glucose reading that preserves vendor metadata. A GlucoseReading superset usable by APIs that accept reading objects, subject to each API's unit, ordering, and sufficiency contract.

PropertyTypeDescription
readonly dedupKey?stringSource-qualified key used to de-duplicate records across polls.
readonly nativeUnit?GlucoseUnitUnit the vendor natively reported, when it differs from unit.
readonly sourceCGMSourceData source vendor
readonly timestampstring
readonly trendCGMTrendTrend direction from the CGM device
readonly unitGlucoseUnit
readonly valuenumber
readonly vendorId?stringOriginal vendor-specific identifier, if available

OMHBloodGlucose

interface OMHBloodGlucose

Import: @glucoseiq/core/interop

Open mHealth blood-glucose datapoint body.

See: https://www.openmhealth.org/documentation/schema-docs/schema-library/

PropertyTypeDescription
readonly blood_glucose{ readonly unit: GlucoseUnit; readonly value: number }
readonly effective_time_frame{ readonly date_time: string }
readonly specimen_source'interstitial fluid' | 'capillary blood' | 'plasma'

OMHDataPoint

interface OMHDataPoint<T = OMHBloodGlucose>

Import: @glucoseiq/core/interop

Wrapped OMH datapoint with header metadata.

PropertyTypeDescription
readonly bodyT
readonly header{ readonly creation_date_time: string; readonly id: string; readonly schema_id: { readonly name: string; readonly namespace: string; readonly version: string } }

PregnancyTIROptions

interface PregnancyTIROptions

Import: @glucoseiq/core

Options for Pregnancy TIR calculation.

PropertyTypeDescription
readonly unit?GlucoseUnitUnit used to normalize mixed-unit readings for pregnancy thresholds. Defaults to the predominant reading unit.

PregnancyTIRResult

interface PregnancyTIRResult

Import: @glucoseiq/core

Pregnancy-specific Time-in-Range result. Uses tighter target range per ADA 2024 guidelines for pregnancy.

See: ADA Standards of Care (2024)

PropertyTypeDescription
readonly aboveRangeRangeMetricsAbove Range: >140 mg/dL (7.8 mmol/L)
readonly belowRangeRangeMetricsBelow Range: <63 mg/dL (3.5 mmol/L)
readonly belowRangeLevel2RangeMetricsLevel 2 Below Range: <54 mg/dL (<3.0 mmol/L). This is a subset of belowRange.
readonly inRangeRangeMetricsIn Range: 63-140 mg/dL (3.5-7.8 mmol/L)
readonly meetsPregnancyTargetsbooleanWhether metrics meet type 1 diabetes pregnancy targets (TIR >70%, TBR <63 mg/dL <4%, TBR <54 mg/dL <1%, TAR >140 mg/dL <25%)
readonly recommendationsreadonly string[]Informational notes derived from the metrics
readonly summaryTIRSummarySummary statistics

RangeMetrics

interface RangeMetrics

Import: @glucoseiq/core

Detailed metrics for a single glucose range. Provides percentage, duration, count, and average value for analytics.

PropertyTypeDescription
readonly averageValuenull | numberAverage glucose value in this range (mg/dL or mmol/L)
readonly durationnumberEstimated occupied-slot duration allocated to this range (minutes).
readonly percentagenumberPercentage of readings in this range (0-100)
readonly readingCountnumberCount of readings in this range

RiskMetrics

interface RiskMetrics

Import: @glucoseiq/core

Risk-metric block of an AnalyzeGlucoseResult.

PropertyTypeDescription
readonly adrrnumber
readonly conganumber
readonly gradeGRADEResult
readonly griGRIResult
readonly hbginumber
readonly jIndexnumber
readonly lbginumber
readonly moddnumber

SafeNormalizeResult

interface SafeNormalizeResult

Import: @glucoseiq/core/connectors

Result of a safe normalization pass.

PropertyTypeDescription
readonly errorsNormalizeError[]Per-entry failures (empty when everything parsed).
readonly readingsNormalizedCGMReading[]Successfully normalized readings, sorted chronologically.

TIRBarOptions

interface TIRBarOptions

Import: @glucoseiq/core/render

Options for tirBarToSVG.

PropertyTypeDescription
readonly height?numberSVG height in px (default 320).
readonly theme?'light' | 'dark'Surface color theme (default 'dark'). This changes the SVG background and text only; the five zone fills remain fixed so existing charts stay stable.
readonly width?numberSVG width in px (default 180).

TIROptions

interface TIROptions

Import: @glucoseiq/core

Options for Time-in-Range (TIR) analytics.

PropertyTypeDescription
range[number, number]
readingsGlucoseReading[]
unitGlucoseUnit

TIRResult

interface TIRResult

Import: @glucoseiq/core

Result object for Time-in-Range (TIR) analytics. Percentages for in-range, below-range, and above-range readings.

See: https://care.diabetesjournals.org/content/42/8/1593

PropertyTypeDescription
aboveRangenumber
belowRangenumber
inRangenumber

TIRSummary

interface TIRSummary

Import: @glucoseiq/core

Summary statistics for TIR calculation.

PropertyTypeDescription
readonly dataQuality'excellent' | 'good' | 'fair' | 'poor'Coverage grade based on observed span and at least 70% occupied slots.
readonly totalDurationnumberEstimated occupied 5-minute timestamp-slot coverage (minutes).
readonly totalReadingsnumberTotal number of glucose readings analyzed

TITROptions

interface TITROptions

Import: @glucoseiq/core

Options for calculateTITR. Thresholds are in mg/dL.

PropertyTypeDescription
readonly highThreshold?numberUpper bound of the tight range (mg/dL, inclusive). Default 140.
readonly lowThreshold?numberLower bound of the tight range (mg/dL, inclusive). Default 70.
readonly target?numberTarget percentage of readings in the tight range. Default 50.

TITRResult

interface TITRResult

Import: @glucoseiq/core

Result of calculateTITR.

PropertyTypeDescription
readonly aboveRangenumberPercentage of readings above the tight range.
readonly belowRangenumberPercentage of readings below the tight range.
readonly inRangenumberPercentage of readings within the tight range (0-100).
readonly meetsTargetbooleanWhether inRange meets the target.
readonly readingCountnumberNumber of readings analyzed.
readonly targetnumberTarget percentage used.

TargetAssessment

interface TargetAssessment

Import: @glucoseiq/core

Assessment of raw TIR percentages against population goals. Custom range thresholds retain the percentage goals but are explicitly marked as configured rather than consensus ranges.

See: International Consensus on Time in Range (2019)

PropertyTypeDescription
readonly overallAssessmentTIRAssessmentOverall assessment label derived from the configured targets
readonly recommendationsreadonly string[]Informational notes derived from the metrics
readonly targetBasis'consensus-ranges' | 'configured-ranges'Whether percentage goals were applied to consensus ranges or caller-configured ranges.
readonly tarLevel1AcceptablebooleanWhether cumulative raw TAR is <25% for standard or <50% for older/high-risk populations.
readonly tarLevel2AcceptablebooleanWhether raw Level 2 TAR is <5% for standard or <10% for older/high-risk populations.
readonly tbrLevel1SafebooleanWhether cumulative raw TBR is <4% for standard or <1% for older/high-risk populations.
readonly tbrLevel2SafebooleanWhether raw Level 2 TBR is <1%.
readonly tirMeetsGoalbooleanWhether raw TIR exceeds 70% for standard or 50% for older/high-risk populations.

TrendTileOptions

interface TrendTileOptions

Import: @glucoseiq/core/render

Options for trendTileToSVG.

PropertyTypeDescription
readonly height?numberSVG height in px (default 140).
readonly theme?'light' | 'dark'Color theme (default 'dark').
readonly width?numberSVG width in px (default 240).

CGMSource

type CGMSource = 'dexcom' | 'libre' | 'nightscout' | 'unknown'

Import: @glucoseiq/core/connectors

Known CGM data source vendors.


CGMTrend

type CGMTrend = 'rapidRising' | 'rising' | 'slightlyRising' | 'flat' | 'slightlyFalling' | 'falling' | 'rapidFalling' | 'unknown'

Import: @glucoseiq/core/connectors

Trend direction reported by CGM devices. Normalized across vendors into a common set.

See:

  • Dexcom: DoubleUp, SingleUp, FortyFiveUp, Flat, FortyFiveDown, SingleDown, DoubleDown
  • Libre: 1-5 numeric scale

ClockModel

type ClockModel = 'direct' | 'relay'

Import: @glucoseiq/core/connectors

How a source's clock relates to the sensor's.


DexcomTrendString

type DexcomTrendString = 'DoubleUp' | 'SingleUp' | 'FortyFiveUp' | 'Flat' | 'FortyFiveDown' | 'SingleDown' | 'DoubleDown' | 'None' | 'NotComputable' | 'RateOutOfRange'

Import: @glucoseiq/core/connectors

Trend strings returned by the Dexcom Share API.


GlucoseIQErrorCode

type GlucoseIQErrorCode = 'EMPTY_DATASET' | 'INVALID_GLUCOSE_VALUE' | 'INVALID_A1C_VALUE' | 'INVALID_INSULIN_VALUE' | 'INVALID_UNIT' | 'INVALID_OPTION' | 'INVALID_TIMEZONE' | 'PARSE_FAILED' | 'CSV_COLUMN_NOT_FOUND' | 'TIMESTAMP_UNPARSEABLE'

Import: @glucoseiq/core

Stable machine-readable error codes.


GlucoseIQRating

type GlucoseIQRating = 'excellent' | 'good' | 'fair' | 'needs attention' | 'insufficient'

Import: @glucoseiq/core

Qualitative rating derived from the Glucose IQ score.


GlucoseUnit

type GlucoseUnit = typeof MG_DL | typeof MMOL_L

Import: @glucoseiq/core

Supported glucose units for analytics and conversions.

See: https://wwwn.cdc.gov/Nchs/Data/Nhanes/Public/2021/DataFiles/BIOPRO_L.htm


LibreTrendValue

type LibreTrendValue = 1 | 2 | 3 | 4 | 5

Import: @glucoseiq/core/connectors

Trend values returned by Libre LinkUp (numeric 1-5).


NightscoutDirection

type NightscoutDirection = 'DoubleUp' | 'SingleUp' | 'FortyFiveUp' | 'Flat' | 'FortyFiveDown' | 'SingleDown' | 'DoubleDown' | 'NONE' | 'NOT COMPUTABLE' | 'RATE OUT OF RANGE' | string & {}

Import: @glucoseiq/core/connectors

Nightscout direction string for trend arrows.


PercentileMethod

type PercentileMethod = 'nearest-rank' | 'linear'

Import: @glucoseiq/core/metrics

Percentile estimation method.

  • nearest-rank (default): matches glucosePercentiles for reproducibility with existing library outputs.
  • linear: interpolated (type-7) percentiles, an opt-in for smoother bands.

TIRAssessment

type TIRAssessment = 'excellent' | 'good' | 'needs improvement' | 'concerning'

Import: @glucoseiq/core

Overall glycemic control assessment based on TIR metrics.


TIRPopulation

type TIRPopulation = 'standard' | 'older-adults' | 'high-risk'

Import: @glucoseiq/core

Population type for TIR target assessment. Different populations use different published target sets.

See: International Consensus on Time in Range (2019)


TrendVocabulary

type TrendVocabulary = 'full' | 'coarse' | 'none'

Import: @glucoseiq/core/connectors

How complete a source's trend vocabulary is.

On this page