Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ the dosing including dose amount and route.
* 9 volume of distribution at steady state parameters (`vss.*`)
* 13 terminal volume of distribution parameters (`vz.*`)

## Features added

* `add.interval.col()` gains `pptestcd_cdisc` and `pptest_cdisc` arguments for
CDISC standard parameter code and name mappings. Route-dependent parameters
(CL, VZ, MRT, VSS) accept a nested list to distinguish intravascular and
extravascular CDISC codes (#403)
* `as.data.frame.PKNCAresults()` gains `out_format = "cdisc"` to translate
PPTESTCD to CDISC standard codes and add a PPTEST column. Route-dependent
translations are resolved from the dose data (#403)
* When `out_format = "cdisc"` and any parameter has "INT" in its PPTESTCD,
PPSTINT and PPENINT columns are added with ISO 8601 durations relative to
the last dose time. The time unit is taken from `timeu_pref` or `timeu`
(#403)

## Bug Fixes

* `normalize.data.frame()` no longer triggers a dplyr deprecation warning
Expand Down
30 changes: 28 additions & 2 deletions R/001-add.interval.col.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ assign("interval.cols", list(), envir=.PKNCAEnv)
#' to NCA parameter names. See the details for information on use of
#' `formalsmap`.
#' @param datatype The type of data used for the calculation
#' @param pptestcd_cdisc The CDISC PPTESTCD code for this parameter. Can be a
#' character string for simple mappings, or a named list for route-dependent
#' mappings (e.g., `list(route = list(extravascular = "CLF/FO", intravascular
#' = "CLO"))`). Defaults to `name` if not provided.
#' @param pptest_cdisc The CDISC PPTEST name for this parameter. Can be a
#' character string or a named list (same structure as `pptestcd_cdisc`).
#' Defaults to `desc` if not provided.
#' @returns NULL (Calling this function has a side effect of changing the
#' available intervals for calculations)
#'
Expand Down Expand Up @@ -90,7 +97,9 @@ add.interval.col <- function(name,
formalsmap=list(),
datatype=c("interval",
"individual",
"population")) {
"population"),
pptestcd_cdisc=NULL,
pptest_cdisc=NULL) {
# Check inputs
if (!is.character(name)) {
stop("name must be a character string")
Expand Down Expand Up @@ -159,6 +168,21 @@ add.interval.col <- function(name,
stop("All names for the formalsmap list must be arguments to the function.")
}
}
# Default CDISC mappings to name/desc when not provided
if (is.null(pptestcd_cdisc)) {
pptestcd_cdisc <- name
}
if (is.null(pptest_cdisc)) {
pptest_cdisc <- desc
}
# Validate CDISC arguments: must be a character string or a named list
# with a "route" element containing named sub-elements
if (!is.character(pptestcd_cdisc) && !is.list(pptestcd_cdisc)) {
stop("pptestcd_cdisc must be a character string or a list")
}
if (!is.character(pptest_cdisc) && !is.list(pptest_cdisc)) {
stop("pptest_cdisc must be a character string or a list")
}
current <- get("interval.cols", envir=.PKNCAEnv)
current[[name]] <-
list(
Expand All @@ -170,7 +194,9 @@ add.interval.col <- function(name,
sparse=sparse,
formalsmap=formalsmap,
depends=depends,
datatype=datatype
datatype=datatype,
pptestcd_cdisc=pptestcd_cdisc,
pptest_cdisc=pptest_cdisc
)
assign("interval.cols", current, envir=.PKNCAEnv)
}
Expand Down
32 changes: 24 additions & 8 deletions R/auc.R
Original file line number Diff line number Diff line change
Expand Up @@ -315,29 +315,37 @@ add.interval.col("aucinf.obs",
unit_type="auc",
pretty_name="AUCinf,obs",
desc="The area under the concentration time curve from the beginning of the interval to infinity with extrapolation to infinity from the observed Clast",
depends=c("lambda.z", "clast.obs"))
depends=c("lambda.z", "clast.obs"),
pptestcd_cdisc="AUCIFO",
pptest_cdisc="AUC Infinity Obs")

add.interval.col("aucinf.pred",
FUN="pk.calc.auc.inf.pred",
values=c(FALSE, TRUE),
unit_type="auc",
pretty_name="AUCinf,pred",
desc="The area under the concentration time curve from the beginning of the interval to infinity with extrapolation to infinity from the predicted Clast",
depends=c("lambda.z", "clast.pred"))
depends=c("lambda.z", "clast.pred"),
pptestcd_cdisc="AUCIFP",
pptest_cdisc="AUC Infinity Pred")

add.interval.col("auclast",
FUN="pk.calc.auc.last",
values=c(FALSE, TRUE),
unit_type="auc",
pretty_name="AUClast",
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification")
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification",
pptestcd_cdisc="AUCLST",
pptest_cdisc="AUC to Last Nonzero Conc")

add.interval.col("aucall",
FUN="pk.calc.auc.all",
values=c(FALSE, TRUE),
unit_type="auc",
pretty_name="AUCall",
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification plus the triangle from that last concentration to 0 at the first concentration below the limit of quantification"
desc="The area under the concentration time curve from the beginning of the interval to the last concentration above the limit of quantification plus the triangle from that last concentration to 0 at the first concentration below the limit of quantification",
pptestcd_cdisc="AUCALL",
pptest_cdisc="AUC All"
)

add.interval.col("aumcinf.obs",
Expand All @@ -346,29 +354,37 @@ add.interval.col("aumcinf.obs",
unit_type="aumc",
pretty_name="AUMC,inf,obs",
desc="The area under the concentration time moment curve from the beginning of the interval to infinity with extrapolation to infinity from the observed Clast",
depends=c("lambda.z", "clast.obs"))
depends=c("lambda.z", "clast.obs"),
pptestcd_cdisc="AUMCIFO",
pptest_cdisc="AUMC Infinity Obs")

add.interval.col("aumcinf.pred",
FUN="pk.calc.aumc.inf.pred",
values=c(FALSE, TRUE),
unit_type="aumc",
pretty_name="AUMC,inf,pred",
desc="The area under the concentration time moment curve from the beginning of the interval to infinity with extrapolation to infinity from the predicted Clast",
depends=c("lambda.z", "clast.pred"))
depends=c("lambda.z", "clast.pred"),
pptestcd_cdisc="AUMCIFP",
pptest_cdisc="AUMC Infinity Pred")

add.interval.col("aumclast",
FUN="pk.calc.aumc.last",
values=c(FALSE, TRUE),
unit_type="aumc",
pretty_name="AUMC,last",
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification")
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification",
pptestcd_cdisc="AUMCLST",
pptest_cdisc="AUMC to Last Nonzero Conc")

add.interval.col("aumcall",
FUN="pk.calc.aumc.all",
values=c(FALSE, TRUE),
unit_type="aumc",
pretty_name="AUMC,all",
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification plus the moment of the triangle from that last concentration to 0 at the first concentration below the limit of quantification")
desc="The area under the concentration time moment curve from the beginning of the interval to the last concentration above the limit of quantification plus the moment of the triangle from that last concentration to 0 at the first concentration below the limit of quantification",
pptestcd_cdisc="AUMCALL",
pptest_cdisc="AUMC All")

PKNCA.set.summary(
name=
Expand Down
Loading