-
Notifications
You must be signed in to change notification settings - Fork 64
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
Bug: derive_param_qtc() expects QT and RR in "msec" #2513
Comments
The workaround found so far is to oversmart derive_param_qtc(
adeg,
by_vars = exprs(USUBJID, VISIT),
method = "Fridericia",
set_values_to = exprs(
PARAMCD = "QTCFR",
PARAM = "QTcF - Fridericia's Correction Formula Rederived (ms)",
AVALU = "ms"
),
get_unit_expr = "msec" # Workaround
) However, you lose the check made by |
Could we allow the function to take in either ms or msec - @pharmaverse/admiral ? |
Hi all, @pharmaverse/admiral We would like users to be able to use either msec or ms. I believe the assert function can handle this, but it might take a little more thought in what that means if they use msec or ms? Let's discuss more! |
I looked through the code before posting the issue. Unfortunately, assert_unit <- function(dataset,
param,
required_unit,
get_unit_expr,
arg_name = rlang::caller_arg(required_unit),
message = NULL,
class = "assert_unit",
call = parent.frame()) {
assert_data_frame(dataset, required_vars = exprs(PARAMCD))
assert_character_scalar(param)
#assert_character_scalar(required_unit)
assert_character_vector(required_unit) # <--- Updated here
get_unit_expr <- enexpr(get_unit_expr)
units <- dataset %>%
mutate(`_unit` = !!get_unit_expr) %>%
filter(PARAMCD == param & !is.na(`_unit`)) %>%
pull(`_unit`) %>%
unique()
if (length(units) != 1L) {
message <-
message %||%
"Multiple units {.val {units}} found for {.val {param}}. Please review and update the units."
cli_abort(
message = message,
call = call,
class = c(class, "assert-admiraldev")
)
}
#if (tolower(units) != tolower(required_unit)) {
if (tolower(units) %notin% tolower(required_unit)) { # <--- Updated here
message <-
message %||%
"It is expected that {.val {param}} has unit of {.or {required_unit}}.
In the input dataset the unit is {.val {units}}." # <--- Also changed .val to .or for required_unit
cli_abort(
message = message,
call = call,
class = c(class, "assert-admiraldev")
)
}
invisible(dataset)
}
assert_unit(
dataset,
param = qt_code,
required_unit = c("msec", "ms"),
get_unit_expr = !!get_unit_expr
)
assert_unit(
dataset,
param = rr_code,
required_unit = c("msec", "ms"),
get_unit_expr = !!get_unit_expr
) |
ah! that is unfortunate. I thought we had made Thanks again @yurovska for digging deep and giving code to look at. Helps move things along and really appreciate it!! |
I think we could just update the |
Sounds good! Do you mind making an issue in admiraldev for this update to We should make sure to note in the documentation that it has this flexibility as well. |
Done, see pharmaverse/admiraldev#468. |
What happened?
In fact this is not really a bug but a sort of obsolescence. It was fine at the time when
derive_param_qtc()
was created. However, on 2022-06-24 the CDISC Submission Value for milliseconds was changed frommsec
toms
in the SDTM Controlled Terminology.See line 1084 in SDTM Terminology Changes 2022-06-24.xls
So in all clinical trials started after that date, the following error is thrown:
Session Information
No response
Reproducible Example
The text was updated successfully, but these errors were encountered: