-
Notifications
You must be signed in to change notification settings - Fork 35
Code / data consistency checking for modeled infusions #1304
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
Open
kylebaron
wants to merge
15
commits into
main
Choose a base branch
from
strict-infusion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
|
Developed this code to extend dosing_cmts , but I think I'll revert to the old code until we need these extra outputs. The addition pulls in not only the compartment names, but also what type of feature is implemented (lag time, infusion rate etc). dosing_cmts <- function(x, what) {
ans <- list(
cmt = character(0),
model_rate = character(0),
model_dur = character(0)
)
if(!is.character(x)) return(ans)
x <- strsplit(x, "\n", fixed = TRUE)
x <- unlist(x, use.names = FALSE)
m <- regexpr("(ALAG|F|R|D)\\_[^= ]+", x, perl = TRUE)
m <- regmatches(x, m)
m <- trimws(m)
m <- strsplit(m, "_", fixed = TRUE)
if(!length(m)) return(ans)
op <- s_pick(m, 1)
cmt <- s_pick(m, 2)
keep <- cmt %in% what
op <- op[keep]
cmt <- cmt[keep]
ans$cmt <- unique(cmt)
ans$model_rate <- unique(cmt[op=="R"])
ans$model_dur <- unique(cmt[op=="D"])
return(ans)
} |
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.
This PR provides adds check between modeled infusions duration (
D) or rate (R) and theratecolumn in the input data set, going the opposite way of what we have now.For dosing records, if there is a positive infusion duration and data set rate is not -2, an error will be issued. If there is a positive infusion rate and data set rate is not -1, a similar error will be issued.
This will be the default behavior (do the check and issue the error). Original behavior can be restored by turning off these checks both by a block option (
@!check_modeled_infusions) or through theCHECK_MODELED_INSUSIONSmacro available in$PREAMBLE).