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.

example/clinical_lab_values_example.dart

import 'package:clinical_lab_values/clinical_lab_values.dart';

void main() {
  const glucose = Glucose(
    value: 7.8,
    unit: GlucoseUnit.mmolL,
    context: GlucoseContext.fasting,
  );
  print('Glucose 7.8 mmol/L fasting:');
  print('  = ${glucose.convertTo(GlucoseUnit.mgDl).toStringAsFixed(1)} mg/dL');
  print('  category: ${glucose.category.name}');
  print('  range:    ${glucose.referenceRange.description}');

  const afterMeal = Glucose(
    value: 7.8,
    unit: GlucoseUnit.mmolL,
    context: GlucoseContext.postprandial,
  );
  print('  same value postprandial → ${afterMeal.category.name}\n');

  const hba1c = HbA1c(value: 6.5, unit: HbA1cUnit.percent);
  print('HbA1c 6.5 %:');
  print(
      '  = ${hba1c.convertTo(HbA1cUnit.mmolMol).toStringAsFixed(1)} mmol/mol');
  print('  category: ${hba1c.category.name}\n');

  const 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),
  );
  print('Lipid panel:');
  print('  TC/HDL ratio: ${panel.totalCholesterolHdlRatio.toStringAsFixed(1)}');
  print(
    '  non-HDL:      '
    '${panel.nonHdlCholesterol(CholesterolUnit.mmolL).toStringAsFixed(1)} mmol/L',
  );
  print('  CV risk:      ${panel.cardiovascularRisk.name} (heuristic)\n');

  const creatinine = Creatinine(
    value: 1.3,
    unit: CreatinineUnit.mgDl,
    patient: PatientContext(sex: PatientSex.female),
  );
  print('Creatinine 1.3 mg/dL (female):');
  print('  category: ${creatinine.category.name}');
  print('  range:    ${creatinine.referenceRange.description}');
}
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