Skip to content

VOLPK default unit shows mg/(ng/mL) instead of physical volume unit (mL) #1145

@Gero1999

Description

@Gero1999

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

  1. Upstream (PKNCA): Add a new unit type (e.g., "sample_volume") that resolves to the VOLUMEU column value. This would be the cleanest fix.
  2. aNCA workaround: Post-process the units table in PKNCA_build_units_table() to replace the volpk PPORRESU with the actual VOLUMEU value 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

No one assigned

    Labels

    Next SprintThis issue will be picked on the next sprintbugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions