credibility¶
The evidence and the battery of the credibility of a PBPK model.
The credibility of a model for its contexts of use is sbmlsim.credibility:
the declaration, the selection of the evidence, the assessment, the
verification, the report and the scorecard. pkpdsim adds what is specific to
the models of pkdb_models, registered by every pkpdsim.model.PKPDModel
(pkpdsim.model.CREDIBILITY_SETTINGS: the metadata PKPDMappingMetaData, the
fields of the domain DOMAIN_FIELDS, the extensions and the battery hook):
- the evidence extensions (
EXTENSIONS,sbmlsim.credibility.extensions): the ratio pairs of the ratio quantities with the limits of Guest et al. (ratios,Ratio,GuestAcceptance), the temporal validation on the studies collected after their fit (temporal), the equivalency of the simulated and the reported inputs of the subjects (inputs) and the provenance of the study data (studies); - the battery hook of the PK checks (
PK_BATTERY,pkpdsim.credibility.battery): the dose states of the model, mass balance, zero dose and superposition on the doses of every route of every substance, with the fates of the doses.
Fate
dataclass
¶
Where a dose went at the end of the horizon, the mass balance of a route.
The parts are the differences to the simulation without a dose, so the fate of a dose of an endogenous substance is that of the dose and not of its production.
Attributes:
| Name | Type | Description |
|---|---|---|
build |
str
|
the build, e.g. |
dose |
str
|
the dose state or infusion rate, e.g. |
substance |
str
|
the dosed substance. |
amount |
float
|
the dose (mmole). |
parts |
Mapping[str, float]
|
the parts of the dose (mmole) by name: |
imbalance |
float
|
the imbalance of the dose simulation relative to the largest term of its balance. |
FlatBuild
dataclass
¶
FlatBuild(
*,
name,
path,
substances,
species,
tracked,
amounts,
doses,
dose_states,
unknown_doses,
flows,
inputs,
outside,
states,
accumulating,
sbml,
)
What the battery reads from a flat build of a model.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
the build, e.g. |
path |
Path
|
the flat SBML file. |
substances |
tuple[str, ...]
|
the substances with a molecular weight, the longest id first. |
species |
tuple[str, ...]
|
the species which are states (not constant, no boundary condition, no assignment rule). |
tracked |
Mapping[str, str]
|
the substance of every species which belongs to one. |
amounts |
frozenset[str]
|
the species whose id is their amount ( |
doses |
Mapping[str, str]
|
the substance of every dose state and infusion rate, which a dose is given to. |
dose_states |
Mapping[str, str]
|
the substance of every state of the dose (mg): the dose states and the parameters in mg with a rate rule which reads one, e.g. the drug in the stomach of a model, also through the assignment rules and transitively. |
unknown_doses |
tuple[str, ...]
|
the states in mg which a reaction reads and which are
no dose of any prefix of |
flows |
Mapping[str, float]
|
the net change of the amount of the tracked species per unit of the rate of every reaction which changes it, by reaction id. |
inputs |
frozenset[str]
|
the reactions of |
outside |
tuple[str, ...]
|
the tracked species which a rule or an event changes, not a reaction. |
states |
tuple[str, ...]
|
the ids of the states without the species: the parameters and compartments with a rate rule. |
accumulating |
frozenset[str]
|
the states which nothing drains (the sinks). |
sbml |
str
|
the SBML of the build with a parameter per flow which
integrates it, |
selections
property
¶
Get the selections of a simulation: the states and the flows.
A species is selected as its amount, a parameter by its id.
PKBattery
¶
Bases: BatteryHook
The battery hook of the PBPK models, see the module.
Reads every build as a FlatBuild, simulates the SBML which integrates
the flows of the reactions with the cases of the doses (dose_cases) and
adds the checks PK_CHECKS with the fates of the doses (section fates).
The check dose_states needs no simulation, so a build without a
substance with a molecular weight has it as well.
not_applicable
¶
Leave a build without a substance out of the steady state.
The steady state holds for the physiology of a PBPK model by construction, a build without a substance with a molecular weight is no such model; the other generic checks apply to every build.
contribute
¶
Check the dose states, the mass balance, the zero dose and the superposition.
report_html
¶
Show the fates of the doses after the table of the battery, none without.
report_tables
¶
Write fates.tsv: one row per build, dose and part of the fate of a dose.
Without a battery the sections are empty and the table has no rows.
InputCheck
¶
Bases: TypedDict
The check of a simulated input of a mapping against the reported one.
Attributes:
| Name | Type | Description |
|---|---|---|
fit |
str
|
the subset of the fit. |
experiment |
str
|
the experiment, the study. |
mapping |
str
|
the key of the mapping. |
target |
str
|
the target of the model. |
kind |
str
|
|
measurement |
str
|
the measurement type of the reported value ( |
unit |
str
|
the unit of the target in the model, of every value. |
simulated |
float
|
the simulated value. |
source |
str
|
|
reported |
float | None
|
the reported central value (mean, median, geometric mean,
the value of an individual, the dose) the simulated one is
compared with, |
low |
float | None
|
the low end of the reported range, |
high |
float | None
|
the high end of the reported range, |
reported_by |
list[str]
|
the groups, individuals or interventions of the reported value. |
status |
str
|
the result, see |
ratio |
float | None
|
the simulated over the reported central value, |
InputsExtension
¶
Bases: EvidenceExtension
The equivalency of the inputs of the contexts of use, see the module.
Prepared: the checks of the inputs of every mapping of the adopted fits.
prepare
¶
Check the inputs of the mappings with the covariates of the declaration.
assess_context
¶
Summarize the checks of the decisive mappings, none without the checks.
assessment_section
¶
Get the checks of every mapping as the section of the assessment.
context_report_blocks
¶
Show the inputs of the decisive mappings after the parameter uncertainty.
report_tables
¶
Write inputs.tsv and input_ranges.tsv.
inputs.tsv: one row per mapping of the adopted fits and simulated
input, the reporting groups, individuals and interventions joined by
;; input_ranges.tsv: one row per context of use and input of its
decisive mappings.
scorecard_columns
¶
Get the inputs of the decisive mappings which differ, empty without the checks.
InputsRecord
¶
Bases: TypedDict
The equivalency of the inputs of the decisive mappings of a context.
Attributes:
| Name | Type | Description |
|---|---|---|
n_mappings |
int
|
the decisive mappings. |
n_checked |
int
|
the decisive mappings with at least one input checked. |
inputs |
list[InputSummary]
|
the summary of every input, sorted by kind and target. |
differs |
list[InputCheck]
|
the checks which differ. |
InputStatus
¶
Bases: StrEnum
How a simulated input compares with the reported one.
InputSummary
¶
Bases: TypedDict
The checks of one input over the decisive mappings of a context.
Attributes:
| Name | Type | Description |
|---|---|---|
target |
str
|
the target of the model. |
kind |
str
|
|
unit |
str
|
the unit of the target in the model. |
n_mappings |
int
|
the decisive mappings with the input. |
low |
float
|
the smallest simulated value, the low end of the inputs the evidence covers. |
high |
float
|
the largest simulated value. |
n_equivalent |
int
|
the checks which are equivalent. |
n_in_range |
int
|
the checks in the reported range. |
n_differs |
int
|
the checks which differ. |
n_not_reported |
int
|
the checks without a reported value. |
GuestAcceptance
dataclass
¶
The percentage of the ratio pairs within the limits of Guest et al. is at least minimum.
The setting of the extension ratios of a context of use,
ContextOfUse(extensions={"ratios": GuestAcceptance(80)}).
Attributes:
| Name | Type | Description |
|---|---|---|
minimum |
float
|
the minimum percentage (0 to 100). |
delta |
float
|
the accepted variability at a ratio of 1, see |
evaluate
¶
Evaluate the percentage of the evaluable pairs within the limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pairs
|
Collection[bool | None]
|
whether every pair is within, |
required |
Returns:
| Type | Description |
|---|---|
AcceptanceResult
|
The result, not evaluable without an evaluable pair. |
problems
¶
Get the problems of the rule: a minimum outside 0 to 100, a delta not above 1.
Ratio
dataclass
¶
The arms of a ratio quantity: a numerator over its reference in a study.
The pairing of a ratio quantity (sbmlsim.credibility.extensions.Pairing),
which RatiosExtension claims: per fit and study (the experiment) every
decisive mapping of the observable which numerator selects is paired with
the one which denominator selects, and the ratio of their summaries is
compared for the data and the predictions.
Attributes:
| Name | Type | Description |
|---|---|---|
observable |
str
|
the observable of the arms, e.g. |
numerator |
MappingFilter
|
selects the mappings of the arms, e.g. the renal impairment. |
denominator |
MappingFilter
|
selects the mapping of the reference arm, e.g. healthy. |
summary |
Summary
|
how the points of an arm are summarized. |
RatioRecord
¶
Bases: TypedDict
A pair of arms of a ratio quantity.
Attributes:
| Name | Type | Description |
|---|---|---|
quantity |
str
|
the id of the ratio quantity. |
fit |
str
|
the subset of the fit of the points. |
experiment |
str
|
the experiment, the study of the arms. |
numerator |
str
|
the key of the mapping of the numerator. |
denominator |
str
|
the key of the mapping of the denominator. |
observed |
float
|
the ratio of the summaries of the data, |
predicted |
float
|
the ratio of the summaries of the predictions. |
limit |
float
|
the limit of Guest et al. for the observed ratio. |
within |
bool | None
|
whether the predicted ratio lies within the limits, |
metadata |
dict[str, str]
|
the values of the fields of the domain of the numerator, by
name, e.g. |
RatiosExtension
¶
Bases: EvidenceExtension
The ratio pairs of the ratio quantities, see the module.
Prepared: the fields of the domain of the project, which the pairs record of their numerator.
selection_problems
¶
Report every study of a ratio with more than one denominator.
assess_context
¶
Assess the pairs of the ratio quantities of a context, none without.
acceptance
¶
Evaluate the rule of the ratio pairs on other predictions.
context_report_blocks
¶
Show the ratio pairs after the acceptance of a context with the rule.
report_tables
¶
Write ratios.tsv: one row per context of use and pair of a ratio quantity.
pool_lines
¶
Word the pooled rows (the model all) as the share within the limits of Guest.
pool
¶
Pool the ratio pairs of the models by a value of the metadata of their numerator.
Every evaluable pair of every context of use counts once per study and
arms: a pair which two contexts of a model share counts once; a pair
whose numerator has the value NR (not reported) counts for no value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
contexts
|
Mapping[str, Sequence[Mapping[str, Any] | None]]
|
the sections of the contexts of use, by model. |
required |
options
|
Mapping[str, Any]
|
|
required |
Returns:
| Type | Description |
|---|---|
DataFrame | None
|
The columns of |
DataFrame | None
|
row per model and one pooled row with the model |
DataFrame | None
|
evaluable pairs, the pairs within the limits of Guest et al., their |
DataFrame | None
|
percentage and the geometric mean fold error of the predicted over |
DataFrame | None
|
the observed ratios; sorted by value with the pooled row first. |
Summary
¶
Bases: StrEnum
How the points of an arm of a ratio are summarized, see Ratio.
StudiesExtension
¶
Bases: EvidenceExtension
The provenance of the study data of an assessment, see the module.
Prepared: the StudyData of every study with points in the adopted fits.
StudyData
¶
Bases: TypedDict
The data of a study the adopted fits of a model have points of.
Attributes:
| Name | Type | Description |
|---|---|---|
study |
str
|
the study (the experiment). |
folder |
str | None
|
the folder of the study relative to the folder of the model,
|
fits |
list[str]
|
the subsets of the fits with points of the study. |
n_points |
int
|
the data points of the study in the fits, a point of two fits twice. |
recorded |
bool
|
whether the folder has a record of its collection. |
collected |
str | None
|
the day of the first collection, ISO format. |
dating |
str | None
|
how the day of the first collection is known. |
updated |
str | None
|
the day of the latest collection, ISO format. |
released |
str | None
|
the day PK-DB released the study, ISO format. |
pkdb_id |
str | None
|
the identifier of the release in PK-DB. |
source_digest |
str | None
|
the digest of the source files in PK-DB. |
pkdb_data_commit |
str | None
|
the commit of pkdb_data of the latest collection. |
pkdb_data_dirty |
bool | None
|
whether the study folder of that checkout had changes. |
n_tables |
int
|
the tables of the record. |
changed |
list[str] | None
|
the tables which differ from the record ( |
Chronology
dataclass
¶
When the adopted fits of a model ran and when it collected its studies.
Attributes:
| Name | Type | Description |
|---|---|---|
fits |
Mapping[str, date]
|
the day of every adopted fit, by its subset. |
studies |
Mapping[str, StudyRecord]
|
the record of every study of the data of the model, by study. |
new
¶
Get which points are of a study collected after the day of their fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
points
|
DataFrame
|
data points with the columns |
required |
Returns:
| Type | Description |
|---|---|
Series
|
True for a point whose study the model collected after the day of |
Series
|
its fit; False for a point without a day of collection or fit. |
TemporalExtension
¶
Bases: EvidenceExtension
The temporal validation of the contexts of use, see the module.
Prepared: the Chronology of the model.
assess_context
¶
Split the decisive points by the chronology, none without it.
context_report_blocks
¶
Show the temporal validation after the acceptance of a context.
report_tables
¶
Write temporal.tsv: one row per context of use and study collected after its fit.
scorecard_columns
¶
Get the evaluable new points and whether every rule is met on them.
regressions
¶
Report the rules met on the new studies before which no longer are.
TemporalRecord
¶
Bases: TypedDict
The decisive points of a context of use which are new for their fit.
Attributes:
| Name | Type | Description |
|---|---|---|
studies |
list[TemporalStudy]
|
the new studies, by study and fit. |
n_points |
int
|
the decisive points of the new studies. |
n_evaluable |
int
|
those the fold criteria can evaluate. |
acceptance |
list[AcceptanceRecord]
|
the acceptance rules of the context on the new points. |
n_known |
int
|
the decisive studies which the model collected no later than the day of their fit. |
undated |
list[str]
|
the decisive studies without a day of collection. |
TemporalStudy
¶
Bases: TypedDict
A study a model collected after the fit of its decisive points.
Attributes:
| Name | Type | Description |
|---|---|---|
study |
str
|
the study (the experiment). |
fit |
str
|
the subset of the fit. |
fit_date |
str
|
the day the fit ran, ISO format. |
collected |
str
|
the day the model collected the study, ISO format. |
released |
str | None
|
the day PK-DB released the study, |
pkdb_id |
str | None
|
the identifier of the release in PK-DB. |
n_points |
int
|
the decisive points of the study of this fit. |
n_evaluable |
int
|
those the fold criteria can evaluate. |
input_checks
¶
Check the simulated inputs of every mapping of the adopted fits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Project
|
the model, the folders of its studies hold the reported values. |
required |
fits
|
FitTable
|
the evaluated adopted fits with their reports, see
|
required |
covariates
|
Mapping[str, str]
|
the target of every covariate and the measurement type of
its reported value, see |
required |
Returns:
| Type | Description |
|---|---|
list[InputCheck]
|
The checks of every mapping of the points, in the order of the fits and |
list[InputCheck]
|
their mappings. |
guest_limit
¶
Get the limit of Guest et al. (2011) of an observed ratio.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observed
|
float
|
the observed ratio, positive. |
required |
delta
|
float
|
the accepted variability at a ratio of 1. |
GUEST_DELTA
|
Returns:
| Type | Description |
|---|---|
float
|
The limit, |
study_data
¶
Get the provenance of the studies the data points are of.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Project
|
the model. |
required |
points
|
DataFrame
|
the data points of the adopted fits, with the columns |
required |
Returns:
| Type | Description |
|---|---|
list[StudyData]
|
A record per study of the points, sorted by study. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if a record is not readable, see
|
chronology
¶
Get when the adopted fits of a model ran and when it collected its studies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Project
|
the model. |
required |
Returns:
| Type | Description |
|---|---|
Chronology
|
The days of the adopted fits of the model ( |
Chronology
|
the earliest collection record for each study. If any copy of a study |
Chronology
|
lacks a record, its collection date is unknown. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if a record is not readable, see
|