Skip to content

Latest commit

Ā 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 
Ā 

Repository files navigation

🧪 labcompass

CI License: MIT zero dependencies Python 3.10+

Lab values, instantly in context. Reference ranges (sex- and age-aware), interpretation (normal / low / high / critical), conventional ↔ SI unit conversion, critical-value flags — bilingual English/Deutsch, LOINC-coded. Zero dependencies, pure standard library.

āš ļø Decision support for education and prototyping. Your laboratory's own reference ranges always take precedence — they vary by method and population.

Quick start

pip install labcompass            # or: python -m labcompass from a clone

$ labcompass hemoglobin 11.2 --sex female
Hemoglobin: 11.2 g/dL
  → LOW   (reference 12.0–15.5 g/dL (female))
  note: Neonates run physiologically high; pregnancy lowers the female range.

$ labcompass HƤmoglobin 18.0 --age 0          # German + pediatrics
Hemoglobin: 18.0 g/dL
  → NORMAL   (reference 13–20 g/dL (any 0-1y))

$ labcompass --convert glucose 90 --to si
Glucose (fasting): 90 mg/dL = 5.0 mmol/L

Library API

from labcompass import interpret, convert, panel

interpret("creatinine", 1.2, sex="female")
# → Interpretation(test='Creatinine', value=1.2, status='high',
#                  reference='0.59–1.04 mg/dL (female)', note='Muscle mass matters…')

interpret("hemoglobin", 8.0, sex="male")     # → status='critical low' (panic value)

convert("glucose", 90)                        # → 5.0 mmol/L (HbA1c converts IFCC-nonlinear!)

panel({"hb": 8.0, "k": 6.8, "na": 140}, sex="male", age=70)
# → criticals collected, summary: '3 interpreted, 2 abnormal, 2 critical — REVIEW CRITICALS IMMEDIATELY'

What's inside

30+ tests across hematology (CBC, INR), chemistry/metabolic (glucose, HbA1c, electrolytes, renal), lipids, liver, iron/inflammation and endocrine — each with:

  • LOINC code + conventional & SI units + exact conversion factor
  • Sex-specific ranges (hemoglobin, creatinine, ferritin, uric acid, AST/ALT, ESR, HDL)
  • Pediatric bands (hemoglobin neonate/child/adolescent/adult)
  • One-sided limits (cholesterol, LDL, CRP, triglycerides)
  • Critical/panic thresholds (K⁺ 6.5, glucose 40/500, sodium 120/160, …)
  • Clinical interpretation notes (AST/ALT ratio, BUN/Cr ratio, HbA1c IFCC)

German names and umlaut folding built in: HƤmoglobin, Leukozyten, Blutzucker, BSG, GPT all resolve.

Honest scope

Ranges are typical educational reference intervals. Assay-dependent analytes (troponin, d-dimer, vitamin B12) are deliberately excluded — their ranges are method-specific and a generic number would be wrong. Contributions adding tests should follow the same rule: citable ranges only.

Testing

python -m unittest discover -s tests -v    # 22 tests

CI matrix: Python 3.10 → 3.14 on Ubuntu/macOS/Windows.


Built by Duk Ā· dukdev.com Ā· MIT licensed

About

🧪 Lab reference ranges with interpretation, conventional↔SI conversion, critical values — bilingual EN/DE, LOINC-coded. Zero deps.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages