GlucoseIQ

Types & Interfaces

The public contracts that connect ingestion, analytics, rendering, and integrations.

87 exports

Generated from the public source TSDoc and TypeScript declarations.

A1CReading

interface A1CReading

Single clinical A1C reading (value and ISO date).

PropertyTypeDescription
datestring
valuenumber

ActivePercentOptions

interface ActivePercentOptions

Options for active percent calculation.

PropertyTypeDescription
expectedIntervalMinutes?numberExpected interval between readings in minutes (default: 5 for CGM)

ActivePercentResult

interface ActivePercentResult

Result of the active percent calculation.

PropertyTypeDescription
activePercentnumberPercentage of expected readings that were captured (0-100)
actualReadingsnumberNumber of actual readings in the dataset
expectedReadingsnumberNumber of expected readings based on time span and interval
meetsClinicalMinimumbooleanWhether the active percent meets the clinical minimum (>= 70%)
totalMinutesnumberTotal time span covered in minutes

AGPChartOptions

interface AGPChartOptions

Options for agpChartToSVG.

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

AGPMetricsOptions

interface AGPMetricsOptions

Options for the aggregate AGP metrics calculation.

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

AGPMetricsResult

interface AGPMetricsResult

Comprehensive AGP metrics result.

PropertyTypeDescription
activePercentActivePercentResultCGM active percent / wear time
adrrnumberAverage Daily Risk Range
conganumberContinuous Overall Net Glycemic Action (mg/dL)
cvnumberCoefficient of variation (%)
gradeGRADEResultGRADE score and partitioned components
griGRIResultGlycemia Risk Index
hbginumberHigh Blood Glucose Index
jIndexnumberJ-Index
lbginumberLow Blood Glucose Index
meanGlucosenumberMean glucose in mg/dL
moddnumberMean of Daily Differences (mg/dL)
sdnumberStandard deviation in mg/dL
totalReadingsnumberNumber of valid readings used

AGPProfileBin

interface AGPProfileBin

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

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

AGPProfileOptions

interface AGPProfileOptions

Options for buildAGPProfile.

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

AGPProfileResult

interface AGPProfileResult

Result of buildAGPProfile.

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

AlignOptions

interface AlignOptions

Options for alignToGrid.

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

AnalyzeGlucoseOptions

interface AnalyzeGlucoseOptions

Options for analyzeGlucose.

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

AnalyzeGlucoseResult

interface AnalyzeGlucoseResult

Result of analyzeGlucose.

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

AUCOptions

interface AUCOptions

Options for AUC helpers.

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

CGMSource

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

Known CGM data source vendors.


CGMTrend

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

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


ClockModel

type ClockModel = "direct" | "relay"

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


CohortOptions

interface CohortOptions

Options for aggregateCohort.

PropertyTypeDescription
unit?GlucoseUnitUnit for TIR validation (default 'mg/dL').

CohortResult

interface CohortResult

Result of aggregateCohort.

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

CONGAOptions

interface CONGAOptions

Options for CONGA calculation.

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

ConnectorCapabilities

interface ConnectorCapabilities

Declarative capabilities of a CGM data source.

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

ConversionResult

interface ConversionResult

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

PropertyTypeDescription
unitGlucoseUnitNew glucose unit after conversion
valuenumberConverted glucose value

CSVParseOptions

interface CSVParseOptions

Options for parseGlucoseCSV.

PropertyTypeDescription
delimiter?stringField delimiter (default ',').
timestampColumnstringHeader name of the timestamp column.
unit?GlucoseUnitUnit of the values (default 'mg/dL').
valueColumnstringHeader name of the glucose value column.

DataSufficiency

interface DataSufficiency

Data-sufficiency assessment for a report.

PropertyTypeDescription
activePercentnumberCGM active/wear percent.
daysOfDatanumberSpan of the data in days (last − first).
meetsCGMStandardbooleanWhether the data meets the consensus recording standard.
totalReadingsnumberNumber of valid readings analyzed.

DayNightOptions

interface DayNightOptions

Options for splitDayNight.

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

DayNightSplit

interface DayNightSplit

Result of splitDayNight.

PropertyTypeDescription
dayGlucoseReading[]
nightGlucoseReading[]

DexcomShareEntry

interface DexcomShareEntry

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

DexcomTrendString

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

Trend strings returned by the Dexcom Share API.


DistributionStats

interface DistributionStats

Distribution of a metric across a cohort.

PropertyTypeDescription
maxnumber
meannumber
mediannumber
minnumber
p25number
p75number

EnhancedTIROptions

interface EnhancedTIROptions

Options for Enhanced TIR calculation. Allows customization for different clinical populations and use cases.

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

EnhancedTIRResult

interface EnhancedTIRResult

Complete Enhanced Time-in-Range result. Provides detailed breakdown across five clinical glucose ranges per International Consensus 2019.

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

EpisodeOptions

interface EpisodeOptions

Options for detectEpisodes. Thresholds are in mg/dL.

PropertyTypeDescription
endDurationMin?numberRecovery duration that ends an episode, in minutes (default 15).
hyperLevel2?numberLevel 2 hyperglycemia threshold (default 250).
hyperThreshold?numberHyperglycemia threshold (default 180).
hypoLevel2?numberLevel 2 hypoglycemia threshold (default 54).
hypoThreshold?numberHypoglycemia threshold (default 70).
minDurationMin?numberMinimum episode duration in minutes (default 15).
unit?GlucoseUnitUnit of input readings (default 'mg/dL'); mmol/L is converted to mg/dL.

EpisodeResult

interface EpisodeResult

Result of detectEpisodes.

PropertyTypeDescription
hyperEventsGlucoseEpisode[]
hypoEventsGlucoseEpisode[]
summaryEpisodeSummary

EpisodeSummary

interface EpisodeSummary

Summary counts across detected episodes.

PropertyTypeDescription
hyperCountnumber
hyperLevel2Countnumber
hypoCountnumber
hypoLevel2Countnumber
totalHyperMinutesnumber
totalHypoMinutesnumber

EstimateGMIOptions

interface EstimateGMIOptions

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

PropertyTypeDescription
unitGlucoseUnit
valuenumber

FHIRCGMComponent

interface FHIRCGMComponent

LOINC-coded CGM summary observation component.

PropertyTypeDescription
codeFHIRCodeableConceptCoded component descriptor
valueQuantityFHIRQuantityMeasured value in FHIR valueQuantity shape

FHIRCGMSensorReading

interface FHIRCGMSensorReading

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

PropertyTypeDescription
codeFHIRCodeableConcept
effectiveDateTimestring
resourceType"Observation"
status"final"
valueQuantityFHIRQuantity

FHIRCGMSummary

interface FHIRCGMSummary

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

PropertyTypeDescription
codeFHIRCodeableConcept
componentunknown
effectivePeriod&#123; … &#125;
resourceType"Observation"
status"final"

GapDetectionOptions

interface GapDetectionOptions

Options for detectGaps.

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

GlucoseEpisode

interface GlucoseEpisode

A detected glucose episode.

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

GlucoseGap

interface GlucoseGap

A detected gap between consecutive readings.

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

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"

Stable machine-readable error codes.


GlucoseIQOptions

interface GlucoseIQOptions

Options for glucoseIQScore.

PropertyTypeDescription
unit?GlucoseUnitUnit for TIR validation (default 'mg/dL').

GlucoseIQRating

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

Qualitative rating derived from the Glucose IQ score.


GlucoseIQScore

interface GlucoseIQScore

Result of glucoseIQScore.

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

GlucoseReading

interface GlucoseReading

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

PropertyTypeDescription
timestampstring
unitGlucoseUnit
valuenumber

GlucoseStatsOptions

interface GlucoseStatsOptions

Options for clinical 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

Options for computeGlucoseTrend.

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

GlucoseTrendResult

interface GlucoseTrendResult

Result of computeGlucoseTrend.

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

GlucoseUnit

type GlucoseUnit = unknown | unknown

Supported clinical glucose units. Used for all clinical analytics and conversions.


GRADEResult

interface GRADEResult

Result of the partitioned GRADE calculation.

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

GridPoint

interface GridPoint

A resampled grid point.

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

GRIInput

interface GRIInput

Input percentages for GRI calculation.

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

GRIResult

interface GRIResult

GRI result with numeric score and risk zone.

PropertyTypeDescription
hyperComponentnumber
hypoComponentnumber
scorenumber
zone"A" | "B" | "C" | "D" | "E"

GVIPGSOptions

interface GVIPGSOptions

Options for calculateGVIPGS.

PropertyTypeDescription
maxGapMinutes?numberMaximum minutes between readings to count a step (default ~5.17).
targetHigh?numberIn-range upper bound, mg/dL, exclusive (default 180).
targetLow?numberIn-range lower bound, mg/dL, inclusive (default 70).
unit?GlucoseUnitUnit of input readings (default 'mg/dL'); 'mmol/L' is converted to mg/dL.

GVIPGSResult

interface GVIPGSResult

Result of calculateGVIPGS.

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

IGCOptions

interface IGCOptions

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

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

IGCResult

interface IGCResult

Result of calculateIGC.

PropertyTypeDescription
hyperIndexnumber
hypoIndexnumber
igcnumber

LibreLinkUpEntry

interface LibreLinkUpEntry

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)

LibreTrendValue

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

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


MAGEOptions

interface MAGEOptions

Configuration options for MAGE calculation.

PropertyTypeDescription
direction?"auto" | "ascending" | "descending"Excursion direction: 'auto', 'ascending', or 'descending'
longWindow?numberLong moving average window (default: 32)
shortWindow?numberShort moving average window (default: 5)

MealResponseOptions

interface MealResponseOptions

Options for analyzeMealResponse.

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

MealResponseResult

interface MealResponseResult

Result of analyzeMealResponse.

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

MODDOptions

interface MODDOptions

Options for MODD calculation.

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

MValueOptions

interface MValueOptions

Options for glucoseMValue.

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

NightscoutDirection

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

Nightscout direction string for trend arrows.


NightscoutEntry

interface NightscoutEntry

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

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")

NormalizedCGMReading

interface NormalizedCGMReading extends GlucoseReading

Extended glucose reading that preserves vendor metadata. Superset of GlucoseReading — can be passed directly to all analytics functions.

PropertyTypeDescription
dedupKey?stringDeterministic key for cross-poll de-duplication.
nativeUnit?GlucoseUnitUnit the vendor natively reported, when it differs from unit.
sourceCGMSourceData source vendor
trendCGMTrendTrend direction from the CGM device
vendorId?stringOriginal vendor-specific identifier, if available

NormalizeError

interface NormalizeError

A single entry that failed to normalize.

PropertyTypeDescription
indexnumberIndex of the failing entry in the input array.
messagestringThe error message.

OMHBloodGlucose

interface OMHBloodGlucose

Open mHealth blood-glucose datapoint body.

PropertyTypeDescription
blood_glucose&#123; … &#125;
effective_time_frame&#123; … &#125;
specimen_source"interstitial fluid" | "capillary blood" | "plasma"

OMHDataPoint

interface OMHDataPoint

Wrapped OMH datapoint with header metadata.

PropertyTypeDescription
bodyT
header&#123; … &#125;

PercentileMethod

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

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.

PregnancyTIROptions

interface PregnancyTIROptions

Options for Pregnancy TIR calculation.

PropertyTypeDescription
unit?GlucoseUnitGlucose unit for input validation (default: 'mg/dL')

PregnancyTIRResult

interface PregnancyTIRResult

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

PropertyTypeDescription
aboveRangeRangeMetricsAbove Range: >140 mg/dL (7.8 mmol/L)
belowRangeRangeMetricsBelow Range: <63 mg/dL (3.5 mmol/L)
inRangeRangeMetricsIn Range: 63-140 mg/dL (3.5-7.8 mmol/L)
meetsPregnancyTargetsbooleanWhether metrics meet pregnancy-specific targets (TIR >70%, TBR <4%, TAR <25%)
recommendationsunknownClinical recommendations
summaryTIRSummarySummary statistics

RangeMetrics

interface RangeMetrics

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

PropertyTypeDescription
averageValuenull | numberAverage glucose value in this range (mg/dL or mmol/L)
durationnumberTotal duration in this range (minutes)
percentagenumberPercentage of readings in this range (0-100)
readingCountnumberCount of readings in this range

RiskMetrics

interface RiskMetrics

Risk-metric block of an AnalyzeGlucoseResult.

PropertyTypeDescription
adrrnumber
conganumber
gradeGRADEResult
griGRIResult
hbginumber
jIndexnumber
lbginumber
moddnumber

SafeNormalizeResult

interface SafeNormalizeResult

Result of a safe normalization pass.

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

TargetAssessment

interface TargetAssessment

Assessment of whether TIR metrics meet clinical targets. Based on International Consensus on Time in Range (2019).

PropertyTypeDescription
overallAssessmentTIRAssessmentOverall assessment of glycemic control
recommendationsunknownClinical recommendations based on metrics
tarLevel1AcceptablebooleanTAR Level 1 <25% (all populations)
tarLevel2AcceptablebooleanTAR Level 2 <5% (all populations)
tbrLevel1SafebooleanTBR Level 1 <4% for standard, <1% for older adults
tbrLevel2SafebooleanTBR Level 2 <1% for standard, <0.5% for older adults
tirMeetsGoalbooleanTIR ≥70% for standard population, ≥50% for older adults

TIRAssessment

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

Overall glycemic control assessment based on TIR metrics.


TIRBarOptions

interface TIRBarOptions

Options for tirBarToSVG.

PropertyTypeDescription
height?numberSVG height in px (default 320).
theme?"light" | "dark"Color theme (default 'dark').
width?numberSVG width in px (default 180).

TIROptions

interface TIROptions

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

PropertyTypeDescription
range[number, number]
readingsGlucoseReading[]
unitGlucoseUnit

TIRPopulation

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

Population type for TIR target assessment. Different populations have different clinical goals.


TIRResult

interface TIRResult

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

PropertyTypeDescription
aboveRangenumber
belowRangenumber
inRangenumber

TIRSummary

interface TIRSummary

Summary statistics for TIR calculation.

PropertyTypeDescription
dataQuality"excellent" | "good" | "fair" | "poor"Data quality assessment
totalDurationnumberTotal duration of data analyzed (minutes)
totalReadingsnumberTotal number of glucose readings analyzed

TITROptions

interface TITROptions

Options for calculateTITR. Thresholds are in mg/dL.

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

TITRResult

interface TITRResult

Result of calculateTITR.

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

TrendTileOptions

interface TrendTileOptions

Options for trendTileToSVG.

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

TrendVocabulary

type TrendVocabulary = "full" | "coarse" | "none"

How complete a source's trend vocabulary is.

On this page