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
+7
View File
@@ -12,6 +12,7 @@ from reporting import (
daily_gmi,
day_of_week_pattern,
detect_events,
gmi_mmol_per_mol,
gmi_percent,
gmi_trend,
minutes_per_day,
@@ -35,6 +36,12 @@ def test_gmi_percent_matches_bergenstal_formula():
assert gmi_percent(7.0) == pytest.approx(6.3, abs=0.05)
def test_gmi_mmol_per_mol_matches_known_ifcc_reference_values():
# 6.5% is de bekende diagnostische drempel = 48 mmol/mol (IFCC).
assert gmi_mmol_per_mol(6.5) == 48
assert gmi_mmol_per_mol(7.0) == 53
def test_daily_gmi_aggregates_per_calendar_day():
glucose = _series(
[