Repository navigation
Clamp HbA1c to a physiological floor after diabetes medication impacts - #1723
Open
developer-rpai wants to merge 1 commit into
Open
developer-rpai wants to merge 1 commit into
developer-rpai wants to merge 1 commit into
Conversation
LifecycleModule subtracted a fixed HbA1c impact for every active diabetes medication with no lower bound, so patients on several drugs could receive HbA1c values that cannot occur in a living person (observed as low as 2.39%, with negative values arithmetically possible). Clamp the post-medication HbA1c to 4.0%, the physiological floor described in the issue: below roughly 4% HbA1c does not occur in living people, and via the ADAG equation (Nathan et al.) 4.0% implies an average glucose of ~68 mg/dL, just below the ADA hypoglycemia threshold of 70 mg/dL. This implements option 1 (clamp the result) from the issue's proposed fixes. Adds a regression test that activates every drug in DIABETES_DRUG_HBA1C_IMPACTS on a diabetic patient (baseline 6.6, total impact -11.5, unclamped -4.9) and asserts the recorded HbA1c equals the 4.0 floor. Fixes synthetichealth#1693
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LifecycleModule.calculateVitalSignssubtracts a fixed HbA1c impact for every active diabetes medication with no lower bound. A diabetic patient on several drugs (e.g. basal + prandial insulin + metformin) is assigned an HbA1c that cannot occur in a living person -- observed as low as 2.39% in generated data, with negative values arithmetically possible (see #1693). The defect only affects treated patients, which makes it easy to miss: untreated patients look entirely plausible, while the patients whose HbA1c matters most are wrong.Fix
Implements option 1 from the issue's proposed fixes: clamp the post-medication HbA1c to a physiological floor of 4.0% (
MIN_HBA1C). Below roughly 4.0%, HbA1c does not occur in living people; via the ADAG equation (Nathan et al., Diabetes Care 2008: eAG = 28.7 x A1C - 46.7 mg/dL), 4.0% implies an average glucose of ~68 mg/dL, just below the ADA hypoglycemia threshold of 70 mg/dL.Interaction with #1699
PR #1699 (which reworks diabetes medication modeling) explicitly states it does not address #1693. This PR targets #1693 directly on current
master; if #1699 merges first, the clamp should be re-evaluated against the new model.Testing
testHbA1cMedicationImpactsDoNotGoBelowPhysiologicalFloorinLifecycleModuleTest: activates every drug inDIABETES_DRUG_HBA1C_IMPACTSon a diabetic patient (baseline 6.6, total impact -11.5, unclamped result -4.9) and asserts the recorded HbA1c equals the 4.0 floor. Verified the test fails without the fix (expected:<4.0> but was:<-4.9>) and passes with it.LifecycleModuleTestsuite: 9/9 tests pass.javac/java(JUnit 4) against Maven Central dependencies instead of via./gradlew test. The repo's checkstyle config also cannot execute under the declared checkstyle 10.17.0 (it nestsLineLengthinsideTreeWalker, which that version rejects) -- a pre-existing issue on master; the changed files introduce no new violations relative to master under the same rules.Fixes #1693