Skip to content

ump_spec.models.common

module ump-spec

Shared value objects: Interval, FallbackEntry, Note, ShownNumber, Problem (RFC 9457).

class

class Interval(StrictModel)

Fields

NameTypeDefaultDescription
lofloat
hifloat
levelfloat0.9
methodstr | NoneNone
segmentslist[tuple[float, float]] | NoneNoneSpec §5: an hdi region that is not one interval, as ordered, non-overlapping [lo, hi] segments inside [lo, hi] (note MULTIMODAL_HDI).
Methods and properties (3)

width property

width: float

contains method

def contains(self, x: float) -> bool

covers method

def covers(self, other: Interval) -> bool

Source: packages/ump-spec/src/ump_spec/models/common.py, line 28

class

class FallbackEntry(StrictModel)

§19 fallback note. effect says how the interval changed, in plain words.

Fields

NameTypeDefaultDescription
codeCode
gatestr
fieldstr | NoneNone
assumedstr
effectstr
envelope_kindLiteral['bound', 'range'] | NoneNoneG-DEP-01 (spec §7): bound for sums, means, CVaR and monotone functions of sums; range for quantile-type, non-monotone outputs and EVOI. A range is never a bound.
interval_beforeInterval | NoneNone
interval_afterInterval | NoneNone
acknowledged_bystr | NoneNone
acknowledged_atdatetime | NoneNone

Source: packages/ump-spec/src/ump_spec/models/common.py, line 65

class

class Note(StrictModel)

Informational or warning note (e.g. ENGINE_STUB, NOT_IMPLEMENTED_IN_POC).

Fields

NameTypeDefaultDescription
codeCode
messagestr
severityLiteral['info', 'warn']'info'
gatestr | NoneNone

Source: packages/ump-spec/src/ump_spec/models/common.py, line 84

class

class ShownNumber(StrictModel)

The display contract: a value can only be shown with its interval, estimand and trust labels.

Fields

NameTypeDefaultDescription
valuefloat
intervalInterval
estimandEstimand
plain_wordsstrEstimand in plain words, including any assumed field.
labelstr | NoneNoneShort caption, e.g. ‘Paid Social iROAS’.
unit_labelstr | NoneNone
trust_levelint2
audit_levelAuditLevel2
fallbackslist[FallbackEntry]list()
noteslist[Note]list()
artifact_idstr | NoneNoneG-REP-01: the artifact this number resolves to.
width_labelstr | NoneNonenarrow|moderate|wide (proposed cut points).
headlinestr | NoneNonePlain short label, e.g. ‘Return per $1 on Linear TV’.
range_wordsstr | NoneNoneThe interval in words, e.g. ‘likely between $0.60 and $1.87’.
confidenceLiteral['high', 'medium', 'low'] | NoneNoneFrom trust level and interval width (rule in ump_spec.rules.plain; proposed).
why_best_guessstr | NoneNoneOne plain sentence when the number rests on fallbacks.

Source: packages/ump-spec/src/ump_spec/models/common.py, line 93

class

class ProblemIssue(StrictModel)

One entry of a problem’s errors member (spec §19): {code, gate_id, pointer, detail}.

Fields

NameTypeDefaultDescription
codeCode
gate_idstr | NoneNoneThe gate that raised this problem, when a gate did.
pointerstr | NoneNone
detailstr | NoneNone

Source: packages/ump-spec/src/ump_spec/models/common.py, line 126

class

class Problem(StrictModel)

RFC 9457 problem details plus the UMP extension members of spec §19: stable code, gate_id, pointer, suggested_action, errors (every problem when several are returned) and untrusted_text kept apart from platform text. type is always the code’s registered URI. Served as application/problem+json.

Fields

NameTypeDefaultDescription
typestr''Always the registered URI of code (set on validation).
titlestr
statusint
detailstr | NoneNone
instancestr | NoneNone
codeCode
pointerstr | NoneNone
suggested_actionstr | NoneNone
untrusted_textstr | NoneNone
gate_idstr | NoneNone
errorslist[ProblemIssue]list()
fallbackslist[FallbackEntry]list()
extradict[str, Any]dict()

Source: packages/ump-spec/src/ump_spec/models/common.py, line 136

function

def as_audit_level(n: int) -> AuditLevel

Narrow an int to AuditLevel (raises ValueError outside 1..4), for typed callers.

Source: packages/ump-spec/src/ump_spec/models/common.py, line 20

function

def problem_type(code: str) -> str

Spec §19: the one registered type URI of a code (base + lower case, underscores to hyphens).

Source: packages/ump-spec/src/ump_spec/models/common.py, line 121

NameTypeValueDescription
TrustLevelint1 is lowest (taken on trust / unvalidated vendor). POC scale 1..4.
AuditLevelLiteral[1, 2, 3, 4]§13: 4 exact rerun, 3 close rerun, 2 logged, 1 taken on trust.
PROBLEM_BASE'https://ump.dev/problems/'Spec §19 problem type base (fixed at publication, §24).