Skip to content

Repository files navigation

Lab Result Interpretation Engine

Deterministic Dart and JavaScript implementations of Lab Health Pocket's versioned interpretation and recommendation domain. They cover:

  • uric acid, glucose, hemoglobin, lipid panels, blood pressure, and BMI;
  • canonical unit conversion and technical input validation;
  • statuses veryLow, low, normal, caution, and high;
  • action levels from self-care education through urgent-care escalation;
  • deterministic Recommendation, Limit, Avoid, and Safety groups;
  • 103 generated recommendation images with bilingual names and image descriptions.

They contain no Flutter UI, database, account, analytics, network, user history, or backend configuration.

Production showcase

Packages

Package Runtime
packages/dart Dart and Flutter
packages/javascript Node.js and modern browsers

The JavaScript data snapshot is generated from the Dart ruleset. Both implementations are checked against fixtures/interpretation-cases.json.

Examples

Dart

final engine = DeterministicInterpretationEngine();
final result = engine.evaluate(
  context: const MeasurementContext(
    metric: MetricType.glucose,
    subtype: 'fasting',
    sex: PhysiologicalSex.male,
    ageYears: 35,
    interpretedAtMs: 0,
  ),
  measurement: const CanonicalMeasurement(value1: 126),
);

final guidance = DefaultRecommendationResolver().resolvePackages(
  result.recommendationPackageIds,
);

JavaScript

const engine = new DeterministicInterpretationEngine();
const result = engine.evaluate({
  context: {
    metric: MetricType.GLUCOSE,
    subtype: 'fasting',
    sex: PhysiologicalSex.MALE,
    ageYears: 35,
    interpretedAtMs: 0,
  },
  measurement: { value1: 126 },
});

const guidance = new DefaultRecommendationResolver().resolvePackages(
  result.recommendationPackageIds,
);

The result carries the matched rule, clinical-2026.1 version, status, action level, facts, source IDs, and recommendation-package IDs. The resolver returns stable items and concrete object advice grouped as Recommendation, Limit, Avoid, or Safety.

Images and descriptions

assets/recommendations/manifest.json inventories all 103 WebP files. Every entry has a stable object ID, local path, Indonesian and English name, neutral Indonesian and English image description, and accessibility key. Images are optional presentation assets; recommendation behavior is driven by structured rules, not image recognition.

Release and clinical status

The code, original documentation, and original generated assets are MIT-licensed. The ruleset itself remains marked clinical-review-required; publish_to: none prevents accidental registry publication before an accountable clinical review. External medical sources are citations, not part of the MIT grant.

Read MEDICAL_SAFETY.md, LICENSE-STATUS.md, and the traceability documents in docs/sources before integration.

Local verification

cd packages/dart
dart pub get --offline
dart run tool/build_asset_manifest.dart
dart run tool/export_javascript_data.dart
dart analyze
dart test
cd ../javascript && npm test

About

Universal Dart/Flutter and JavaScript engine for lab-result interpretation, unit conversion, safety levels, and recommendations.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages