-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RXR-550: bring 48-hour criteria to KDIGO staging definitions #23
Conversation
Rise of 0.3 mg/dl is considered an AKI *if* it occurs within a 48-hour period
Age isn't required if egfr is provided, but then if we don't use `isTRUE()` then that conditional has length 0. Adds test for fixed age behavior -- previously if age was NULL this would return a stage of NA which was incorrect
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a couple minor suggestions, otherwise approach lgtm
Co-authored-by: Jasmine Hughes <43552465+jasmineirx@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, clean solution to the floating point precision problem.
Looks like CI wants x and y to be documented for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
R/calc_aki_stage.R
Outdated
# there's a rise to 1.5x baseline*. We only check for the 0.3 mg/dl rise if | ||
# i > 1, since otherwise we don't have any prior timepoints to compare to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just noticed that this comment is now out of date.
# there's a rise to 1.5x baseline*. We only check for the 0.3 mg/dl rise if | |
# i > 1, since otherwise we don't have any prior timepoints to compare to. | |
# there's a rise to 1.5x baseline*. We only check for the 0.3 mg/dl rise if | |
# scr_last_48h contains at last one value, since otherwise we don't have | |
# any prior timepoints to compare to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 good catch, made the changes locally so I could fix a small typo
#' | ||
#' @param x Numeric vector | ||
#' @param y Numeric vector | ||
`%>=%` <- function(x, y) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought: do we want to use this in non-clinPK package to address floating point precision issues? Could be useful to have this in irxtools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that might be useful, but irxtools is currently private and clinPK is public, so if clinPK is going to take on that dependency we'd need to make irxtools public as well. That seemed like a bigger discussion, maybe we can revisit it separately? It wouldn't be hard to update this later if we do decide to move it to a different package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
Pulls KDIGO logic into its own function so that we can iterate over the timepoints to check that rises of >=0.3 mg/dl happen within a 48 hour window. A few tests needed to be updated based on this logic. We may need to update some tests on the insightrxr side as well, I haven't checked those yet.
While working on this I also found that we had a bug if age was NULL here:
clinPK/R/calc_aki_stage.R
Line 167 in a2e6ad0
That line would evaluate to
logical(0)
, even if the other criteria (i.e. scr >= 4) were met. That is also fixed in this branch, and a new test has been added for it.Please do pay close attention to the logic here. I think I captured the 48 hour restriction, but after all of our discussion I want to make extra sure that we've got this right.