Skip to content

feat(modules): add CKD-staging module (eGFR-driven, KDIGO G1-G5) - #46

Merged
ArioMoniri merged 1 commit into
ArioMoniri:mainfrom
aerenkaradag:feat/ckd-module
Jun 7, 2026
Merged

feat(modules): add CKD-staging module (eGFR-driven, KDIGO G1-G5)#46
ArioMoniri merged 1 commit into
ArioMoniri:mainfrom
aerenkaradag:feat/ckd-module

Conversation

@aerenkaradag

@aerenkaradag aerenkaradag commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

What

Adds a Synthea-style CKD-staging module (src/syntha/modules/ckd.py) that fires on the Kronik_Bobrek source flag and stages the patient G1–G5 from egfr_latest per KDIGO 2024.

For each CKD-flagged episode it emits:

Resource When Code
Encounter (nephrology follow-up) always reason = stage-specific SNOMED (or generic 709044004 if eGFR missing)
Procedure — eGFR measurement always SNOMED 80274001
Procedure — ACR reflex test G3a+ (eGFR < 60) SNOMED 271000000
Procedure — nephrology referral G3b+ (eGFR < 45) SNOMED 103696004
CarePlan — CKD management always monitoring + diet + nephrotoxic-drug avoidance (413332001)

Also adds CKD_STAGES + ckd_stage_for_egfr() to fhir/codes.py with stage-specific SNOMED CT and ICD-10 N18.1N18.5 (replacing the generic N18.9 when eGFR is present), registers CKDModule() in the module REGISTRY, and adds 6 tests in tests/test_modules.py.

Why

Per COLLABORATE.md / ROADMAP.md v0.6, CKD is a high-prevalence condition with egfr_latest + creatinine_latest available on every source patient but no module yet. Closes #17.

Verification

  • pytest -q108 passed (was 102; +6 new CKD tests)
  • ruff check clean on all changed files
  • CLI smoke test (syntha fhir on examples/sample_output/sample_episodes.csv) passes; CKD eGFR Procedure + CarePlan confirmed present in generated bundles
  • New module does not fire for existing tests (default fixture has no Kronik_Bobrek), so no regression

⚠️ Clinical confirmation needed (reviewer / clinician sign-off)

I implemented the international KDIGO standard; the following are clinical-judgment calls that need a Turkish primary-care clinician's confirmation before merge:

  • eGFR cut-points — G1 ≥ 90, G2 60–89, G3a 45–59, G3b 30–44, G4 15–29, G5 < 15. Confirm TR uses the same.
  • Nephrology-referral stage — currently modelled at G3b and worse (eGFR < 45). Confirm TR primary-care referral threshold (some refer at G4, some at G3b with progression/albuminuria).
  • ACR reflex trigger — modelled from G3a (eGFR < 60). Confirm.
  • Nephrotoxic-drug avoidance is surfaced as a CarePlan note only; the module does not de-prescribe. Acceptable, or should it interact with other modules' MedicationRequests (e.g. metformin/NSAID flags at low GFR)?
  • SNOMED/ICD-10 stage codes — confirm N18.3 for both G3a and G3b is acceptable (ICD-10 has no a/b split; SNOMED does, and is used).

Happy to adjust any thresholds per your guidance.


Submitted as an invited contributor (@aerenkaradag). The Turkish source cohort behind syntha originates from the Check-Up dataset work.

Adds a Synthea-style chronic kidney disease module that fires on the
Kronik_Bobrek source flag and stages the patient G1-G5 from egfr_latest
per KDIGO 2024. Emits a nephrology follow-up Encounter, an eGFR Procedure
(always), an ACR reflex Procedure (G3a+, eGFR < 60), a nephrology-referral
Procedure (G3b+, eGFR < 45), and a stage-appropriate CarePlan including a
nephrotoxic-drug-avoidance activity.

Adds CKD_STAGES + ckd_stage_for_egfr() to fhir/codes.py with stage-specific
SNOMED CT and ICD-10 N18.1-N18.5 codes, registers CKDModule in the module
REGISTRY, and adds 6 tests in test_modules.py.

Clinical thresholds (referral stage, ACR trigger, KDIGO cut-points for TR
primary care) are flagged for clinician confirmation in the PR.

Closes ArioMoniri#17
@aerenkaradag
aerenkaradag requested a review from ArioMoniri as a code owner June 5, 2026 07:12
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 90.19608% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/syntha/fhir/codes.py 66.6% 4 Missing ⚠️
src/syntha/modules/ckd.py 97.3% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
@@           Coverage Diff           @@
##            main     #46     +/-   ##
=======================================
- Coverage   91.1%   91.0%   -0.1%     
=======================================
  Files         38      39      +1     
  Lines       1551    1602     +51     
=======================================
+ Hits        1413    1459     +46     
- Misses       138     143      +5     
Flag Coverage Δ
unittests 91.0% <90.1%> (-0.1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/syntha/modules/__init__.py 100.0% <100.0%> (ø)
src/syntha/modules/ckd.py 97.3% <97.3%> (ø)
src/syntha/fhir/codes.py 68.1% <66.6%> (-1.9%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ArioMoniri
ArioMoniri merged commit 8629cdf into ArioMoniri:main Jun 7, 2026
11 checks passed
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.

[clinical-curation] Author a CKD-staging module (eGFR-driven, G1-G5)

3 participants