Description
The Shiny UI applies volume unit simplification after PKNCA_create_data_object() in tab_data.R (lines ~243-260). This step calls simplify_unit() on volume-type parameters and updates PPSTRESU and conversion_factor in the PKNCAdata units table.
The R script template (script_template.R) does not include this step. This means R scripts generated from the app may produce different unit representations for volume parameters compared to the app.
Part of #718. Related: #1191 (another missing step in the R script template).
Relevant code
In inst/shiny/modules/tab_data.R:
pknca_object$units <- pknca_object$units %>%
mutate(
PPSTRESU = {
new_ppstresu <- ifelse(
PPTESTCD %in% metadata_nca_parameters$PKNCA[
metadata_nca_parameters$unit_type == "volume"
],
sapply(PPSTRESU, function(x) simplify_unit(x, as_character = TRUE)),
PPSTRESU
)
ifelse(nchar(new_ppstresu) < 3, new_ppstresu, .data[["PPSTRESU"]])
},
conversion_factor = ifelse(...)
)
Definition of Done
Description
The Shiny UI applies volume unit simplification after
PKNCA_create_data_object()intab_data.R(lines ~243-260). This step callssimplify_unit()on volume-type parameters and updatesPPSTRESUandconversion_factorin the PKNCAdata units table.The R script template (
script_template.R) does not include this step. This means R scripts generated from the app may produce different unit representations for volume parameters compared to the app.Part of #718. Related: #1191 (another missing step in the R script template).
Relevant code
In
inst/shiny/modules/tab_data.R:Definition of Done
PKNCA_create_data_object()PKNCA_create_data_object()itself so both paths get it automatically