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.
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/Lfrom 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'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.
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.
python -m unittest discover -s tests -v # 22 testsCI matrix: Python 3.10 ā 3.14 on Ubuntu/macOS/Windows.
Built by Duk Ā· dukdev.com Ā· MIT licensed