Skip to content

Add 4-variable Kidney Failure Risk Equation (KFRE) - #1

Merged
nerdoc merged 1 commit into
mainfrom
add-kfre
Nov 26, 2026
Merged

nerdoc merged 1 commit into
mainfrom
add-kfre

Conversation

@nerdoc

@nerdoc nerdoc commented Nov 26, 2026

Copy link
Copy Markdown
Member

Summary

Adds the 4-variable Kidney Failure Risk Equation (Tangri 2016, JAMA 315(2):164-174, eAppendix 2).

  • renal.kfre_2_year / renal.kfre_5_year(egfr, acr, age, gender, region, *, rounded=False) — risk in percent, ACR in mg/g
  • KfreRegion.NORTH_AMERICA / NON_NORTH_AMERICA in constants.py (re-exported from the package root); no default region
  • FormulaInfo records KFRE_2_YEAR / KFRE_5_YEAR in formulas.FORMULAS
  • tests/test_kfre.py; README, CHANGELOG, CLAUDE.md, docs/references.md updated

Decisions to review

  • Verification is secondary. The JAMA supplement was not accessible. Coefficients and the non-North American baseline survival (0.9832 / 0.9365) were checked against the reproduction of eAppendix 2 in the supplement of Ramspek 2021 (JASN); the North American values (0.9750 / 0.9240) against the formula text of the LOINC terms.
  • Domain: raises ValueError for eGFR >= 60 mL/min/1.73m² and below 18 years.
  • LOINC 85624-5 / 85625-2: the terms' formula text shows the North American baseline only; the same codes are given for either region. Set to None if that is too loose.
  • digits=2 is an assumption; no published convention was found.
  • 8-variable equation not included: secondary sources disagree on its North American baseline survival.

Test plan

  • PYTHONPATH=src pytest on Python 3.13 (587 passed, doctests included)
  • ruff check, ruff format on the changed Python files
  • full tox matrix (py311/py312/pypy311, check) — not run locally, left to CI

Expected test values were calculated independently of the library with bc.


Generated by Claude Code

Pooled, regionally calibrated equations of Tangri 2016 (JAMA 315(2):164-174,
eAppendix 2). The calibration is chosen with the new KfreRegion enum; there is
no default region. Raises for eGFR >= 60 mL/min/1.73m2 and below 18 years.
Sources are recorded as secondary in docs/references.md; the 8-variable
equation is left out until its baseline survival is verified.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRmBkrQr7JTBUtBsFF52Hs
@nerdoc
nerdoc merged commit 0c0ec05 into main Nov 26, 2026
12 checks passed
@nerdoc
nerdoc deleted the add-kfre branch November 26, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants