cdisc¶
CDISC map of the parameters: PKPARMCD codes, PKUNIT spellings and the PP domain.
A submission does not carry the variable names of an analysis package: every
parameter of the PP domain (and of the ADaM ADPP dataset derived from it)
is named by a code of the CDISC controlled terminology, PKPARMCD, and its
unit by a value of PKUNIT. This module holds the crosswalk from the variables
pkpdutils reports to those codes and writes the domain.
The codes are read from pkpdutils/data/pkparmcd.csv, which was extracted from
the tab-delimited NCI EVS package of the CDISC SDTM controlled terminology
(codelist C85839, "PK Parameters Code"); the header of the file names the
source, the date and the checksum of the package it was taken from. Nothing is
transcribed by hand, and a variable the terminology has no code for maps to
None and is left out of the domain with a warning. Several codes that are
commonly assumed do not exist (CLSTP for the predicted last concentration,
CMAXSS and CMINSS for the steady state peak and trough, ACCIND,
PTROUGH, AEAMT, FE): the steady state peak and trough are CMAX and
CMIN with PPSCAT = "STEADY STATE", the accumulation index is AILAMZ and
the peak trough ratio PTROUGHR.
pkunit
¶
The PKUNIT spelling of a unit of a result.
The exact submission value of PKUNIT when the table knows the unit,
otherwise the same unit written in the CDISC symbols of PKUNIT_SYMBOLS
in the order pint spells it (milligram / liter becomes mg/L, which the
terminology does not have, since it spells mass concentrations per
milliliter; ParameterResult.to_units converts such a result to a unit the
terminology spells). A dimensionless unit is the empty string, a unit which
is not a unit of the registry is passed through unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit
|
str
|
the unit string of a variable of a result, e.g.
|
required |
Returns:
| Type | Description |
|---|---|
str
|
The |
pkparmcd
¶
The PKPARMCD code of a variable of a result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variable
|
str
|
name of the variable, e.g. |
required |
route
|
Route | str | None
|
the route of administration, for a variable whose code depends
on it ( |
None
|
Returns:
| Type | Description |
|---|---|
str | None
|
The code, or |
str | None
|
when the code needs a route which was not given. |
to_pp
¶
to_pp(
result,
*,
subject_dim,
usubjid=None,
spec="SDTM",
studyid=None,
route=None,
ppspec=None,
digits=6,
)
Lay a result out as the CDISC PP domain, one row per subject and parameter.
Every parameter of the result which the terminology has a code for
(pkparmcd) becomes one row per sample: PPTESTCD the code, PPTEST its
CDISC name, PPORRES the value as it was reported and PPORRESU its unit
in the PKUNIT spelling (pkunit), PPSTRESN and PPSTRESU the same
value as a number. PPCAT is the substance the analysis was run on and
PPSPEC the specimen; PPSEQ numbers the rows of a subject from 1.
PPSCAT tells a single dose parameter from a steady state one, and the
analysis of the sample decides it: every parameter of a sample which was
analysed over its dosing intervals (more than one dose, or
NCAOptions.tau, _steady_state_samples) describes the steady state,
since its peak, its exposure and its clearance are computed from the last
dose on; a variable of STEADY_STATE_VARIABLES is STEADY STATE whatever
the sample, which is what tells the steady state peak and trough from a
single dose one (both are CMAX and CMIN, there is no CMAXSS). PPRFTDTC, the
reference date-time of the analysis, is empty: the analysis works on
elapsed times and never sees a date.
A parameter without a code is left out and named in a warning. The
variables which CDISC defines as a percentage while the package reports a
fraction (PERCENT_VARIABLES) are multiplied by 100 and carry the unit
%. A sample whose parameter is NaN (a parameter of the other route or
of the other dosing path) gets no row. The uncertainty and summary
variables of a parameter, the per-interval point variables and the status
variables are not part of the domain.
The substance and the route are read from the coordinates substance and
route of the result when it carries them (a batch of several analytes or
of several routes) and from its attributes otherwise; route names the
route of a result which carries neither and is needed for the mean
residence time, whose code depends on it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
ParameterResult
|
the result, e.g. of |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
subject_dim |
str
|
the sample dimension whose labels are the subjects |
usubjid |
Mapping[Any, str] | Sequence[str] | None
|
the |
spec |
Literal['SDTM', 'ADaM']
|
|
studyid |
str | None
|
the |
route |
Route | str | None
|
route of administration, when the result names none itself |
ppspec |
str | None
|
the specimen, |
digits |
int
|
significant digits of the character result |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The domain, one row per subject and parameter. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
write_pp
¶
Write a result as the PP domain into a csv file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
ParameterResult
|
the result |
required |
path
|
str | Path
|
the file to write |
required |
**options
|
Any
|
the keyword arguments of |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
The domain that was written. |