Show estimated HbA1c in mmol/mol (IFCC) alongside the % value

Dutch lab results conventionally report HbA1c in mmol/mol rather than
DCCT/NGSP %. Adds gmi_mmol_per_mol() using the standard IFCC conversion
(Hoelzel et al. 2004) and shows it next to the existing % value on the
Samenvatting page and in the PDF summary.

Closes gitea #25.
This commit is contained in:
2026-08-01 23:12:43 +02:00
parent 374ead70e5
commit b8e01fa8c9
4 changed files with 28 additions and 2 deletions
+11
View File
@@ -36,6 +36,17 @@ def gmi_percent(mean_mmol: float) -> float:
return round(3.31 + 0.4311 * mean_mmol, 1)
def gmi_mmol_per_mol(gmi_pct: float) -> int:
"""Zet een GMI-percentage (DCCT/NGSP) om naar IFCC mmol/mol.
mmol/mol = 10.929 x (% - 2.15) — de standaard IFCC-omrekening
(Hoelzel et al. 2004, Clin Chem 50(1):166-174), gangbare eenheid in
Nederlandse labuitslagen naast het %-getal (gitea #25). Bijv. 6.5% =
48 mmol/mol, de bekende diagnostische drempel.
"""
return round(10.929 * (gmi_pct - 2.15))
GMI_TREND_COLUMNS = ["date", "gmi", "rolling_avg", "trend", "trend_lower", "trend_upper"]