-
Notifications
You must be signed in to change notification settings - Fork 7
VOLPK default unit shows mg/(ng/mL) instead of physical volume unit (mL) #1145
Description
Problem
The VOLPK parameter (Total Urine Volume) displays a wrong default unit in the Parameter Units table. Instead of showing the physical volume unit from the data (e.g., mL), it shows mg/(ng/mL) — the pharmacokinetic volume of distribution formula.
Root cause
In R/PKNCA_extra_parameters.R (line 199), volpk is registered with unit_type = "volume":
PKNCA::add.interval.col(
"volpk",
FUN = "pk.calc.volpk",
values = c(FALSE, TRUE),
unit_type = "volume", # <-- this is the problem
pretty_name = "Total Urine Volume",
desc = "The sum of urine volumes for the interval"
)In PKNCA's unit system, unit_type = "volume" resolves to doseu / concu via pknca_units_table_conc_dose():
volume <- sprintf("%s/%s", pknca_units_add_paren(doseu), pknca_units_add_paren(concu))This is correct for volume of distribution parameters (Vd, Vss, Vz) but wrong for volpk, which sums physical sample volumes and should use the VOLUMEU unit from the data.
This is an upstream PKNCA limitation — PKNCA has no built-in unit type for physical sample volume. The available unit types (volume, conc, dose, time, amount, etc.) don't include one that maps to VOLUMEU.
Reproducible example
library(PKNCA)
# Register volpk (as aNCA does)
pk.calc.volpk <- function(volume) {
if (length(volume) == 0) return(NA_real_)
sum(volume)
}
PKNCA::add.interval.col(
"volpk", FUN = "pk.calc.volpk",
values = c(FALSE, TRUE),
unit_type = "volume",
pretty_name = "Total Urine Volume",
desc = "The sum of urine volumes for the interval"
)
# Generate units table with typical urine data units
units_tbl <- PKNCA::pknca_units_table(
concu = "ng/mL",
doseu = "mg",
amountu = "ng",
timeu = "h"
)
# VOLPK gets the Vd unit instead of physical volume
units_tbl[units_tbl$PPTESTCD == "volpk", ]
#> PPTESTCD PPORRESU
#> volpk mg/(ng/mL)
#
# Expected: mL (or whatever VOLUMEU is in the data)Possible fixes
- Upstream (PKNCA): Add a new unit type (e.g.,
"sample_volume") that resolves to theVOLUMEUcolumn value. This would be the cleanest fix. - aNCA workaround: Post-process the units table in
PKNCA_build_units_table()to replace thevolpkPPORRESU with the actualVOLUMEUvalue from the concentration data.
Expected behavior
VOLPK should display mL (or the value of VOLUMEU from the data) as its default unit, not mg/(ng/mL).
Metadata
Metadata
Assignees
Labels
Type
Projects
Status