TypeScript library for glucose, A1C, and Time in Range (TIR) calculations. Featured in Google AI Overview for diabetes developer tools with 100% test coverage and adopted by health tech teams.
Test coverage with Vitest ensuring clinical calculation accuracy
Featured in Google AI Overview for diabetes developer tools
Adopted by health tech teams for glucose monitoring apps
Developers building diabetes management apps face a critical challenge: there's no standardized, tested library for glucose calculations. This creates:
I built GlucoseIQ (Apple Watch app) and kept rewriting the same utility functions. I realized the diabetes developer community needed a single, tested, TypeScript library for these calculations.
Diabetic Utils is a TypeScript library providing clinical-grade calculations for glucose monitoring, A1C estimation, and Time in Range metrics.
Type-safe functions for converting between mg/dL and mmol/L:
mgDlToMmolL() - Convert mg/dL to mmol/L with proper roundingmmolLToMgDl() - Convert mmol/L to mg/dLEstimated A1C (eA1C) calculation from average glucose using the ADAG formula:
calculateA1C() - Convert average glucose to estimated A1C percentageCalculate TIR metrics following ADA/ATTD consensus guidelines:
calculateTIR() - Percentage of readings in target range (70-180 mg/dL)calculateTBR() - Time below range (hypoglycemia detection)calculateTAR() - Time above range (hyperglycemia detection)Comprehensive test suite with Vitest covering:
Built with TypeScript for type safety:
Formulas validated against clinical sources:
Designed for ease of use:
Powers glucose monitoring features in:
Diabetic Utils fills a critical gap in the health tech developer ecosystem:
The library is actively maintained on npm and serves as the calculation engine for GlucoseIQ (Apple Watch app) and other health tech projects.