credibility.declaration¶
The declaration of the contexts of use of a model.
A Credibility lists the ContextOfUses of a model. A context of use asks a
question of the model, names the quantities and the domain it is asked for,
the evidence (a selection of the fit mappings with a role) and, optionally,
the rules by which it is accepted. A context of use does not raise: it reports
problems(), and Credibility raises one DeclarationError with the
problems of every context.
The domain of a context claims values of the fields of the metadata of the
fit mappings, a dataclass derived from sbmlsim.fit.objects.MappingMetaData
whose fields are enums, e.g. the route of a dose. The metadata and the fields
a domain can claim belong to the project (metadata_fields,
sbmlsim.project.CredibilitySettings), so the declaration is checked against
them when the project loads it (Credibility.domain_problems,
sbmlsim.project.Project.load_credibility).
CouLevel
¶
Level
¶
Bases: StrEnum
A level of influence, consequence or risk.
EvidenceRole
¶
Bases: StrEnum
What evidence is used for.
DeclarationError
¶
Bases: ValueError
The declaration of the credibility of a model is invalid.
Attributes:
| Name | Type | Description |
|---|---|---|
problems |
every problem of the declaration. |
Create the error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problems
|
list[str]
|
every problem of the declaration. |
required |
Unclaimed
dataclass
¶
The validation points which no other evidence and no limitation selects.
Attributes:
| Name | Type | Description |
|---|---|---|
within |
MappingFilter | None
|
restricts the points to the ones this filter selects. |
QuantityOfInterest
dataclass
¶
A quantity a context of use is asked for.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
the observable of the fit mappings, e.g. |
description |
str
|
what the quantity is. |
ratio |
bool | Pairing
|
whether the quantity is a ratio between arms: |
Domain
dataclass
¶
The domain a context of use claims.
Attributes:
| Name | Type | Description |
|---|---|---|
metadata |
Mapping[str, Collection[StrEnum]]
|
the claimed values by field of the metadata of the fit
mappings, see |
statement |
str
|
what is claimed beyond the metadata, e.g. the dose range. |
problems
¶
Get the problems of the domain: an unknown field or a value of another vocabulary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
Mapping[str, type[StrEnum]]
|
the fields a domain can claim with their enum, see
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Every problem, empty if the domain claims values of the fields. |
Evidence
dataclass
¶
A selection of the data with a role.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
the name of the evidence. |
role |
EvidenceRole
|
what the evidence is used for. |
selection |
Selection
|
the fit mappings it selects. |
description |
str
|
what the evidence is. |
fit |
str | None
|
the subset of the adopted fits it is taken from, |
AcceptanceResult
dataclass
¶
The result of an acceptance rule.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
the name of the rule. |
value |
float
|
the value of the rule on the points, |
limit |
str
|
the limit, e.g. |
met |
bool | None
|
whether the rule is met, |
AcceptanceRule
¶
Acceptance
dataclass
¶
The percentage of the points a criterion accepts is at least minimum.
Attributes:
| Name | Type | Description |
|---|---|---|
criterion |
Criterion
|
the criterion, e.g. |
minimum |
float
|
the minimum percentage (0 to 100). |
MaxGmfe
dataclass
¶
AfeRange
dataclass
¶
The average fold error, the bias, is inside the range.
Attributes:
| Name | Type | Description |
|---|---|---|
low |
float
|
the smallest accepted AFE. |
high |
float
|
the largest accepted AFE. |
ContextOfUse
dataclass
¶
ContextOfUse(
*,
id,
title,
question,
level,
influence,
consequence,
quantities,
domain,
evidence,
acceptance=(),
limitations=(),
rationale="",
extrapolation="",
min_points=None,
extensions=dict(),
)
What a model is used for: the question, the domain, the evidence and the acceptance.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
the slug of the context, unique in the model. |
title |
str
|
the title. |
question |
str
|
the question of the context, one sentence. |
level |
CouLevel
|
the level on the ladder. |
influence |
Level
|
the influence of the model on the decision. |
consequence |
Level
|
the consequence of a wrong decision. |
quantities |
tuple[QuantityOfInterest, ...]
|
the quantities asked for, at least one which is no ratio. |
domain |
Domain
|
the domain claimed, at least one value of the metadata above C1. |
evidence |
tuple[Evidence, ...]
|
the evidence. |
acceptance |
tuple[AcceptanceRule, ...]
|
the rules, empty for the default of the risk. |
limitations |
tuple[Evidence, ...]
|
the evidence of what the model does not describe. |
rationale |
str
|
why this level, influence and consequence. |
extrapolation |
str
|
the argument for a domain without validation evidence. |
min_points |
int | None
|
the evaluable decisive points the verdict needs, at least
1; |
extensions |
Mapping[str, object]
|
the settings of the evidence extensions for this context
by the name of the extension, e.g. the acceptance of the ratio
pairs; a setting with a method |
minimum_points
property
¶
Get the evaluable points the verdict needs: the declared or the default of the risk.
decisive_role
property
¶
Get the role of the evidence which decides, see CouLevel.decisive_role.
problems
¶
Get the problems of the context of use, each naming the context.
The domain is checked against the fields of the metadata by
domain_problems.
extension_problems
¶
Get the settings and the pairings of the context which no extension takes.
A setting of extensions by a name of no extension of the project and
a pairing of a ratio quantity which no extension claims
(EvidenceExtension.claims) is a problem: neither would be assessed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extensions
|
Sequence[EvidenceExtension]
|
the evidence extensions of the project. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Every problem, each naming the context. |
domain_problems
¶
Get the problems of the domain, each naming the context.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
Mapping[str, type[StrEnum]]
|
the fields a domain can claim with their enum, see
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Every problem of the domain. |
Credibility
dataclass
¶
The contexts of use of a model.
Attributes:
| Name | Type | Description |
|---|---|---|
contexts |
tuple[ContextOfUse, ...]
|
the contexts of use. |
limitations |
tuple[Evidence, ...]
|
the model limitations, evidence of what it does not describe. |
notes |
str
|
notes on the declaration. |
covariates |
Mapping[str, str] | None
|
the covariates of the subjects whose simulated values an
evidence extension checks against the reported ones (the
equivalency of the inputs), the target of the model and the
measurement type of its reported value; |
variability |
Variability | None
|
the variability between the subjects, relative
distributions of targets ( |
Raises:
| Type | Description |
|---|---|
DeclarationError
|
with every problem of the declaration but the ones
of the domains, which need the fields of the metadata of the
project, see |
domain_problems
¶
Get the problems of the domains of the contexts of use.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fields
|
Mapping[str, type[StrEnum]]
|
the fields a domain can claim with their enum, see
|
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Every problem of a domain, empty if every domain claims values of |
list[str]
|
the fields. |
extension_problems
¶
Get the settings and the pairings of the contexts which no extension takes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extensions
|
Sequence[EvidenceExtension]
|
the evidence extensions of the project. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Every problem, see |
context
¶
Get a context of use by its id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id
|
str
|
the id of the context. |
required |
Returns:
| Type | Description |
|---|---|
ContextOfUse
|
The context. |
Raises:
| Type | Description |
|---|---|
KeyError
|
if there is no such context. |
metadata_fields
¶
Get the fields of the metadata of the mappings which a domain can claim.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
metadata_type
|
type
|
the metadata of the fit mappings of the project, a
dataclass derived from |
required |
fields
|
Collection[str] | None
|
the fields a domain can claim, every field whose type is an
enum ( |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, type[StrEnum]]
|
The enum of every field, in the order of |
Raises:
| Type | Description |
|---|---|
ValueError
|
if a field of |
acceptance_result
¶
Get the result of a rule, not evaluable for NaN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the rule. |
required |
value
|
float
|
its value on the points. |
required |
limit
|
str
|
its limit. |
required |
met
|
bool
|
whether the value meets the limit. |
required |
Returns:
| Type | Description |
|---|---|
AcceptanceResult
|
The result, |