clinical_lab_values 0.1.0 copy "clinical_lab_values: ^0.1.0" to clipboard
clinical_lab_values: ^0.1.0 copied to clipboard

Type-safe clinical laboratory values with unit conversion, reference ranges and clinical interpretation (glucose, HbA1c, lipids, creatinine) for Dart.

🩺 clinical_lab_values #

Type-safe clinical laboratory values with unit conversion, reference ranges, and clinical interpretation for Dart & Flutter.

Built by a Flutter developer with a medical background β€” because converting mg/dL to mmol/L is easy, but knowing whether 7.8 mmol/L is normal, prediabetes, or diabetes is what actually matters.

pub package CI License: MIT


Why this exists #

Generic unit converters already exist. In healthcare apps the interesting part isn't the arithmetic β€” it's the clinical meaning of a value. This package provides:

  • πŸ”„ Bidirectional conversion between clinical units
  • πŸ“Š Reference ranges based on international guidelines (ADA, NCEP, WHO)
  • 🩺 Clinical categorization (normal / prediabetes / diabetes / …)
  • πŸ‘€ Sex- and context-adjusted ranges where applicable
  • 🎯 A type-safe API β€” units and categories are per-metric enums, so you can't mix up a glucose unit with a cholesterol unit at compile time

Supported metrics #

Metric Status
Glucose (fasting / postprandial / random) βœ… v0.1.0
HbA1c (NGSP % ↔ IFCC mmol/mol) βœ… v0.1.0
Total Cholesterol, HDL, LDL, Triglycerides + LipidPanel βœ… v0.1.0
Creatinine (sex-adjusted) βœ… v0.1.0

Installation #

dependencies:
  clinical_lab_values: ^0.1.0

Usage #

import 'package:clinical_lab_values/clinical_lab_values.dart';

final glucose = Glucose(
  value: 7.8,
  unit: GlucoseUnit.mmolL,
  context: GlucoseContext.fasting,
);

glucose.convertTo(GlucoseUnit.mgDl); // β‰ˆ 140.5
glucose.category;                    // GlucoseCategory.diabetes
glucose.isInNormalRange;             // false
glucose.severity;                    // Severity.moderate
glucose.referenceRange.description;  // "3.9–5.5 mmol/L (fasting)"

Context matters β€” the same number means something different after a meal:

Glucose(value: 7.8, unit: GlucoseUnit.mmolL,
        context: GlucoseContext.postprandial).category;
// GlucoseCategory.prediabetes

Lipid panel #

final panel = LipidPanel(
  totalCholesterol: TotalCholesterol(value: 6.5, unit: CholesterolUnit.mmolL),
  hdl: Hdl(value: 1.0, unit: CholesterolUnit.mmolL),
  ldl: Ldl(value: 4.5, unit: CholesterolUnit.mmolL),
  triglycerides: Triglycerides(value: 2.2, unit: CholesterolUnit.mmolL),
);

panel.totalCholesterolHdlRatio;              // β‰ˆ 6.5 (exact)
panel.nonHdlCholesterol(CholesterolUnit.mmolL); // β‰ˆ 5.5 (exact)
panel.cardiovascularRisk;                    // CardiovascularRisk.high (heuristic)

cardiovascularRisk is a coarse, lipid-only heuristic β€” not a validated risk score (see doc/REFERENCES.md). The ratio and non-HDL numbers are exact.

Sex-specific reference ranges #

final creatinine = Creatinine(
  value: 1.3,
  unit: CreatinineUnit.mgDl,
  patient: PatientContext(sex: PatientSex.female),
);
creatinine.category; // CreatinineCategory.elevated (female upper bound 1.1)

Medical references #

All reference ranges and conversion formulas are documented in doc/REFERENCES.md. Sources include the American Diabetes Association (ADA) Standards of Care, NCEP ATP III, and IFCC molar-mass conversions.

Disclaimer #

This package is a developer tool, not a medical device. It must not be used as the sole basis for clinical decisions. Always consult qualified healthcare professionals.

Contributing #

Contributions are welcome β€” new metrics especially. See doc/ADDING_NEW_METRIC.md for the step-by-step pattern every metric follows.

License #

MIT β€” see LICENSE.

1
likes
160
points
25
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Type-safe clinical laboratory values with unit conversion, reference ranges and clinical interpretation (glucose, HbA1c, lipids, creatinine) for Dart.

Repository (GitHub)
View/report issues

Topics

#health #medical #healthcare #units

License

MIT (license)

More

Packages that depend on clinical_lab_values