Skip to content
Draft
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 @@ -6,6 +6,20 @@ the dosing including dose amount and route.

# PKNCA 0.12.2

## 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 @@ -313,29 +313,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 @@ -344,29 +352,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
32 changes: 24 additions & 8 deletions R/aucint.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ add.interval.col("aucint.last",
unit_type="auc",
pretty_name="AUCint (based on AUClast extrapolation)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast)",
formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL))
formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL),
pptestcd_cdisc="AUCINT",
pptest_cdisc="AUC from T1 to T2")
PKNCA.set.summary(
name="aucint.last",
description="geometric mean and geometric coefficient of variation",
Expand All @@ -257,7 +259,9 @@ add.interval.col("aucint.last.dose",
unit_type="auc",
pretty_name="AUCint (based on AUClast extrapolation, dose-aware)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast) with dose-aware interpolation/extrapolation of concentrations",
formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"))
formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"),
pptestcd_cdisc="AUCINTD",
pptest_cdisc="AUC from T1 to T2 Normalized by Dose")
PKNCA.set.summary(
name="aucint.last.dose",
description="geometric mean and geometric coefficient of variation",
Expand All @@ -271,7 +275,9 @@ add.interval.col("aucint.all",
unit_type="auc",
pretty_name="AUCint (based on AUCall extrapolation)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall)",
formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL))
formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL),
pptestcd_cdisc="AUCINTA",
pptest_cdisc="AUCint (based on AUCall extrapolation)")
PKNCA.set.summary(
name="aucint.all",
description="geometric mean and geometric coefficient of variation",
Expand All @@ -285,7 +291,9 @@ add.interval.col("aucint.all.dose",
unit_type="auc",
pretty_name="AUCint (based on AUCall extrapolation, dose-aware)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall) with dose-aware interpolation/extrapolation of concentrations",
formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"))
formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"),
pptestcd_cdisc="AUCINTAD",
pptest_cdisc="AUCint (based on AUCall extrapolation, dose-aware)")
PKNCA.set.summary(
name="aucint.all.dose",
description="geometric mean and geometric coefficient of variation",
Expand All @@ -300,7 +308,9 @@ add.interval.col("aucint.inf.obs",
pretty_name="AUCint (based on AUCinf,obs extrapolation)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast)",
formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL),
depends=c("lambda.z", "clast.obs"))
depends=c("lambda.z", "clast.obs"),
pptestcd_cdisc="AUCINTIS",
pptest_cdisc="AUCint (based on AUCinf,obs extrapolation)")
PKNCA.set.summary(
name="aucint.inf.obs",
description="geometric mean and geometric coefficient of variation",
Expand All @@ -315,7 +325,9 @@ add.interval.col("aucint.inf.obs.dose",
pretty_name="AUCint (based on AUCinf,obs extrapolation, dose-aware)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with zeros (matching AUClast) with dose-aware interpolation/extrapolation of concentrations",
formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"),
depends=c("lambda.z", "clast.obs"))
depends=c("lambda.z", "clast.obs"),
pptestcd_cdisc="AUCINTID",
pptest_cdisc="AUCint (based on AUCinf,obs extrapolation, dose-aware)")
PKNCA.set.summary(
name="aucint.inf.obs.dose",
description="geometric mean and geometric coefficient of variation",
Expand All @@ -330,7 +342,9 @@ add.interval.col("aucint.inf.pred",
pretty_name="AUCint (based on AUCinf,pred extrapolation)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall)",
formalsmap=list(conc="conc.group", time="time.group", time.dose=NULL),
depends=c("lambda.z", "clast.pred"))
depends=c("lambda.z", "clast.pred"),
pptestcd_cdisc="AUCINTIP",
pptest_cdisc="AUCint (based on AUCinf,pred extrapolation)")
PKNCA.set.summary(
name="aucint.inf.pred",
description="geometric mean and geometric coefficient of variation",
Expand All @@ -345,7 +359,9 @@ add.interval.col("aucint.inf.pred.dose",
pretty_name="AUCint (based on AUCinf,pred extrapolation, dose-aware)",
desc="The area under the concentration time curve in the interval extrapolating from Tlast to infinity with the triangle from Tlast to the next point and zero thereafter (matching AUCall) with dose-aware interpolation/extrapolation of concentrations",
formalsmap=list(conc="conc.group", time="time.group", time.dose="time.dose.group"),
depends=c("lambda.z", "clast.pred"))
depends=c("lambda.z", "clast.pred"),
pptestcd_cdisc="AUCINTPD",
pptest_cdisc="AUCint (based on AUCinf,pred extrapolation, dose-aware)")
PKNCA.set.summary(
name="aucint.inf.pred.dose",
description="geometric mean and geometric coefficient of variation",
Expand Down
48 changes: 36 additions & 12 deletions R/auciv.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ add.interval.col(
depends = c("auclast", "c0"),
desc = "The AUClast calculated with back-extrapolation for intravenous dosing using extrapolated C0",
sparse = FALSE,
formalsmap = list(auc="auclast")
formalsmap = list(auc="auclast"),
pptestcd_cdisc="AUCIVLST",
pptest_cdisc="AUClast (IV dosing)"
)

add.interval.col(
Expand All @@ -63,7 +65,9 @@ add.interval.col(
depends = c("aucall", "c0"),
desc = "The AUCall calculated with back-extrapolation for intravenous dosing using extrapolated C0",
sparse = FALSE,
formalsmap = list(auc="aucall")
formalsmap = list(auc="aucall"),
pptestcd_cdisc="AUCIVA",
pptest_cdisc="AUCall (IV dosing)"
)

add.interval.col(
Expand All @@ -74,7 +78,9 @@ add.interval.col(
depends = c("aucint.last", "c0"),
desc = "The AUCint,last calculated with back-extrapolation for intravenous dosing using extrapolated C0",
sparse = FALSE,
formalsmap = list(auc="aucint.last")
formalsmap = list(auc="aucint.last"),
pptestcd_cdisc="AUCIVILT",
pptest_cdisc="AUCint,last (IV dosing)"
)

add.interval.col(
Expand All @@ -85,7 +91,9 @@ add.interval.col(
depends = c("aucint.all", "c0"),
desc = "The AUCint,all calculated with back-extrapolation for intravenous dosing using extrapolated C0",
sparse = FALSE,
formalsmap = list(auc="aucint.all")
formalsmap = list(auc="aucint.all"),
pptestcd_cdisc="AUCIVINA",
pptest_cdisc="AUCint,all (IV dosing)"
)

add.interval.col(
Expand All @@ -96,7 +104,9 @@ add.interval.col(
depends = c("aucinf.obs", "c0"),
desc = "The AUCinf,obs calculated with back-extrapolation for intravenous dosing using extrapolated C0",
sparse = FALSE,
formalsmap = list(auc="aucinf.obs")
formalsmap = list(auc="aucinf.obs"),
pptestcd_cdisc="AUCIVIS",
pptest_cdisc="AUCinf,obs (IV dosing)"
)

add.interval.col(
Expand All @@ -107,7 +117,9 @@ add.interval.col(
depends = c("aucinf.pred", "c0"),
desc = "The AUCinf,pred calculated with back-extrapolation for intravenous dosing using extrapolated C0",
sparse = FALSE,
formalsmap = list(auc="aucinf.pred")
formalsmap = list(auc="aucinf.pred"),
pptestcd_cdisc="AUCIVIP",
pptest_cdisc="AUCinf,pred (IV dosing)"
)

PKNCA.set.summary(
Expand Down Expand Up @@ -135,7 +147,9 @@ add.interval.col(
depends = c("auclast", "aucivlast"),
desc = "The back-extrapolation percent for intravenous dosing based on AUClast",
sparse = FALSE,
formalsmap = list(auc="auclast", auciv="aucivlast")
formalsmap = list(auc="auclast", auciv="aucivlast"),
pptestcd_cdisc="AUCIVPLT",
pptest_cdisc="AUCbext (based on AUClast)"
)

add.interval.col(
Expand All @@ -146,7 +160,9 @@ add.interval.col(
depends = c("aucall", "aucivall"),
desc = "The back-extrapolation percent for intravenous dosing based on AUCall",
sparse = FALSE,
formalsmap = list(auc="aucall", auciv="aucivall")
formalsmap = list(auc="aucall", auciv="aucivall"),
pptestcd_cdisc="AUCIVPEA",
pptest_cdisc="AUCbext (based on AUCall)"
)

add.interval.col(
Expand All @@ -157,7 +173,9 @@ add.interval.col(
depends = c("aucint.last", "aucivint.last"),
desc = "The back-extrapolation percent for intravenous dosing based on AUCint,last",
sparse = FALSE,
formalsmap = list(auc="aucint.last", auciv="aucivint.last")
formalsmap = list(auc="aucint.last", auciv="aucivint.last"),
pptestcd_cdisc="AUCIVPIL",
pptest_cdisc="AUCbext (based on AUCint,last)"
)

add.interval.col(
Expand All @@ -168,7 +186,9 @@ add.interval.col(
depends = c("aucint.all", "aucivint.all"),
desc = "The back-extrapolation percent for intravenous dosing based on AUCint,all",
sparse = FALSE,
formalsmap = list(auc="aucint.all", auciv="aucivint.all")
formalsmap = list(auc="aucint.all", auciv="aucivint.all"),
pptestcd_cdisc="AUCIVPIA",
pptest_cdisc="AUCbext (based on AUCint,all)"
)

add.interval.col(
Expand All @@ -179,7 +199,9 @@ add.interval.col(
depends = c("aucinf.obs", "aucivinf.obs"),
desc = "The back-extrapolation percent for intravenous dosing based on AUCinf,obs",
sparse = FALSE,
formalsmap = list(auc="aucinf.obs", auciv="aucivinf.obs")
formalsmap = list(auc="aucinf.obs", auciv="aucivinf.obs"),
pptestcd_cdisc="AUCIVPEI",
pptest_cdisc="AUCbext (based on AUCinf,obs)"
)

add.interval.col(
Expand All @@ -190,7 +212,9 @@ add.interval.col(
depends = c("aucinf.pred", "aucivinf.pred"),
desc = "The back-extrapolation percent for intravenous dosing based on AUCinf,pred",
sparse = FALSE,
formalsmap = list(auc="aucinf.pred", auciv="aucivinf.pred")
formalsmap = list(auc="aucinf.pred", auciv="aucivinf.pred"),
pptestcd_cdisc="AUCIVPEP",
pptest_cdisc="AUCbext (based on AUCinf,pred)"
)

PKNCA.set.summary(
Expand Down
Loading
Loading