Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Proposals
Proposals
Drafts
Proposed registers

OIP-0018: Trigger definitions and evaluations

DRAFT Source oips/drafts/OIP-0018/OIP-0018.md

On this page
  1. Summary
  2. Requirements
  3. Patches
  4. Proposal text
  5. Draft folder
FieldValue
StatusDRAFT
Affects§4.2 (TriggerDefinition, TriggerEvaluation row), new §15; new schemas trigger-definition and trigger-evaluation
RequiresOIP-0006 (origin vocabulary), OIP-0008 (signature envelope). Answers OIP-0005 open question 1. The shared definitions (SignatureEnvelope with its Digest and ProtocolRole) are copied verbatim, so the patches apply to the current tree on their own
Texton this page · OIP-0018.md · README.md

Summary

OIP-0005 lets an alert notice reference "the trigger definition it evaluated" only by URI and digest. Nothing says what a trigger definition contains, so two operators cannot agree on what a notice proved, a consumer cannot check it, and parametric or anticipatory-action schemes, which pay or act on a declared…

Requirements

  • TRG-1: A definition states subject (observed property or product type, never both), basis (observed, forecast), condition, window, minimum evidence, spatial scope, quality requirement, admitted origins, version and owner role; it is signed; a change is a new version that names the one it supersedes
  • TRG-2: Conditions: threshold (max, min, mean, sum, last), nearest-rank percentile, rate of change (scaled to perSeconds), compound all/any of 2 to 16 conditions, at most four deep; UCUM units, never converted implicitly
  • TRG-3: Admission rules in a fixed order: PROPERTY, WINDOW (start exclusive, end inclusive, by result time), SCOPE, VALUE, UNIT, QUALITY (every flag GOOD, at least one), TIME (trusted), ORIGIN; every considered input is recorded and each excluded one carries the first rule it failed
  • TRG-4: An observed basis never admits SIMULATED; a forecast basis admits MODEL_DERIVED or SIMULATED; the evaluation repeats the basis; a forecast result is never presented as an observation
  • TRG-5: MET, NOT_MET, INSUFFICIENT_EVIDENCE; too few admitted inputs is INSUFFICIENT_EVIDENCE, never NOT_MET; compounds use three-valued (strong Kleene) logic
  • TRG-6: The evaluation references the definition by UNI, version and digest (sha256 over RFC 8785 without signature), carries the window, inputs by digest, exclusions, computed values per condition, result and evaluator, and is signed
  • TRG-7: Deterministic and reproducible, whatever the input order; computed values rounded half to even to six places before comparison; a verifier that gets a different result rejects the evaluation
  • TRG-8: A notice, payout decision or anticipatory action rests on a MET evaluation of the definition it names; INSUFFICIENT_EVIDENCE is never treated as MET or NOT_MET
  • TRG-9: A correction of an input makes the evaluator evaluate again; the new evaluation supersedes the old one and names the correction notice

Patches

The edits acceptance would apply. They are in the protocol repository at the pinned commit and are not served on this site.

FileSize (bytes)
patches/evaluator-cases.patch88019
patches/registers.patch6841
patches/schemas-fixtures.patch88332
patches/spec.patch5542

Proposal text

Field Value
Status DRAFT
Affects §4.2 (TriggerDefinition, TriggerEvaluation row), new §15; new schemas trigger-definition and trigger-evaluation
Requires OIP-0006 (origin vocabulary), OIP-0008 (signature envelope). Answers OIP-0005 open question 1. The shared definitions (SignatureEnvelope with its Digest and ProtocolRole) are copied verbatim, so the patches apply to the current tree on their own
Protocol version obsp/0.1 (additive)

Problem

OIP-0005 lets an alert notice reference “the trigger definition it evaluated” only by URI and digest. Nothing says what a trigger definition contains, so two operators cannot agree on what a notice proved, a consumer cannot check it, and parametric or anticipatory-action schemes, which pay or act on a declared condition, have no protocol object to point at. Nor is there a record of an evaluation: which observations were used, which were left out and why, and whether the result was “not met” or “not enough evidence to say”.

Change

Normative text (new §15 “Trigger definitions and evaluations”)

The full text is in patches/spec.patch; in short:

Id Requirement
TRG-1 A definition states subject (observed property or product type, never both), basis (observed, forecast), condition, window, minimum evidence, spatial scope, quality requirement, admitted origins, version and owner role; it is signed; a change is a new version that names the one it supersedes
TRG-2 Conditions: threshold (max, min, mean, sum, last), nearest-rank percentile, rate of change (scaled to perSeconds), compound all/any of 2 to 16 conditions, at most four deep; UCUM units, never converted implicitly
TRG-3 Admission rules in a fixed order: PROPERTY, WINDOW (start exclusive, end inclusive, by result time), SCOPE, VALUE, UNIT, QUALITY (every flag GOOD, at least one), TIME (trusted), ORIGIN; every considered input is recorded and each excluded one carries the first rule it failed
TRG-4 An observed basis never admits SIMULATED; a forecast basis admits MODEL_DERIVED or SIMULATED; the evaluation repeats the basis; a forecast result is never presented as an observation
TRG-5 MET, NOT_MET, INSUFFICIENT_EVIDENCE; too few admitted inputs is INSUFFICIENT_EVIDENCE, never NOT_MET; compounds use three-valued (strong Kleene) logic
TRG-6 The evaluation references the definition by UNI, version and digest (sha256 over RFC 8785 without signature), carries the window, inputs by digest, exclusions, computed values per condition, result and evaluator, and is signed
TRG-7 Deterministic and reproducible, whatever the input order; computed values rounded half to even to six places before comparison; a verifier that gets a different result rejects the evaluation
TRG-8 A notice, payout decision or anticipatory action rests on a MET evaluation of the definition it names; INSUFFICIENT_EVIDENCE is never treated as MET or NOT_MET
TRG-9 A correction of an input makes the evaluator evaluate again; the new evaluation supersedes the old one and names the correction notice

With OIP-0005: alert-notice.trigger.uri is the definition’s triggerUni and trigger.digest its digest; ALRT-1 then also names the evaluation (an evaluationUni member is proposed for OIP-0005’s trigger object on acceptance of both). ALRT-2’s “every flag GOOD and trusted time” is TRG-3’s admission rule, applied by the evaluator.

Contracts (schemaVersion 3.1.0)

trigger-definition: triggerUni, version (integer), title, owner (role, participantUni), basis, subject (observedProperty or productType, optional unit), condition ($defs.Condition: Threshold, Percentile, RateOfChange, Compound, told apart by kind; a leaf may name its own observedProperty inside a compound), window.durationSeconds, minimumEvidence, spatialScope (bbox, geocodes, featureOfInterestUnis, systemUnis; an input in any of them is in scope), qualityRequirement (acceptedFlags const ["GOOD"], requireTrustedTime const true), originsAllowed (the OIP-0006 origins; basis rules in allOf), issuedAt, optional validFrom, validTo, supersedes, references, required signature, extensions.

trigger-evaluation: evaluationUni, evaluatedAt, definition (triggerUni, version, digest), basis, window (start, end), inputs (recordUni, optional recordVersion, digest), excluded (recordUni, digest, reason), computed (path as a JSON pointer into the definition, kind, result, admitted, value, unit), result, evaluator, optional supersedes (evaluationUni, digest, reason INPUT_CORRECTED, LATE_INPUT or DEFINITION_SUPERSEDED; correctionRef required for INPUT_CORRECTED), required signature.

The repository writes enum values in upper case, so the results are MET, NOT_MET and INSUFFICIENT_EVIDENCE (met, not-met, insufficient-evidence in the work package text); basis keeps the lower-case words it was asked for.

Reference evaluator and vectors

sdk/python/src/obsp/triggers.py (non-normative): evaluate(definition, inputs, evaluatedAt), reproduce, definition_digest, normalise_record (an observation record as an input: numeric result or result.value, the quality entries, trusted time through a time-quality record in hand, the origin member of OIP-0006) and four suite invariants: trigger-definition-consistent (nesting depth, units against the subject, supersedes an earlier version of the same trigger, validity interval), trigger-evaluation-links-definition (definition in the set with that UNI, version, digest and basis), trigger-evaluation-reproducible (a fresh run gives the recorded definition reference, basis, window, inputs, exclusions, computed values and result; superseded evaluations are skipped) and trigger-evaluation-supersedes (TRG-9 links to the old evaluation and the correction notice).

conformance/vectors/triggers/: met, not-met, insufficient-evidence, origin-excluded, quality-excluded (QUALITY and TIME), window-scope-unit-excluded (WINDOW, SCOPE, UNIT, VALUE), rate-of-change, compound (nested any/all, one branch INSUFFICIENT_EVIDENCE, MET overall), compound-all-not-met, forecast-basis (product type, PROPERTY exclusion). Each vector holds the definition, the inputs, the evaluation time and the expected output.

Compatibility

Additive: two new objects, no existing schema or document changes. Records written before OIP-0006 have no origin; the evaluator never admits them (ORIGIN), which the example sets show.

Tests

Requirement Case Kind
TRG-1 to TRG-7, TRG-9 CT-GRID-095 the four invariants on trigger-definition, trigger-evaluation (and the set’s observation, time-quality and correction records)
TRG-4 to TRG-9 CT-CONSUMER-095 trigger-evaluation-links-definition, -reproducible, -supersedes on the consumer’s set

The example evaluation in both sets is honest about the set’s only observation record: it has no unit, so it is excluded (UNIT) and the result is INSUFFICIENT_EVIDENCE. sdk/python/tests/test_triggers.py (17 tests) runs every vector, checks input-order independence, the window boundary, three-valued logic and the digest rule, and breaks each invariant (tampered result, missing input, digest and basis mismatch, unit mismatch, supersession after a correction).

Positive fixtures: trigger-definition.threshold.valid, .compound.valid, .compound-forecast.valid; trigger-evaluation.met.valid, .insufficient.valid. Negative, one rule each: trigger-definition.simulated-on-observed-basis, .forecast-without-model-origin, .quality-not-good-only, .untrusted-time-allowed, .compound-single-condition, .unknown-operator, .missing-signature, .no-spatial-scope, .percentile-zero, .zero-window, .property-and-product; trigger-evaluation.unknown-result, .definition-without-digest, .excluded-without-reason, .missing-signature, .corrected-without-notice.

Relation rows proposed on acceptance (not in the patches)

  - { id: EXT-UCUM, standard: 'Unified Code for Units of Measure (UCUM)', kind: aligns-with, schemas: [trigger-definition, trigger-evaluation] }

and EXT-RFC8785 gains trigger-definition and trigger-evaluation (the definition digest). Then run python3 tools/build_edges.py. registers/functions.yaml: exchange objects gain trigger-definition and trigger-evaluation; that line is also edited by OIP-0001 and OIP-0005, so it is left to acceptance.

Open questions

  1. Coverage placement: both cases cite correct, because the §5.10 index rows are changed by OIP-0001, OIP-0005 and OIP-0009 to OIP-0011 and a case under exchange would stop those patches applying. On acceptance they move to exchange (keeping correct for TRG-9). A manual consumer case for TRG-8 (the decision, not only the evidence) joins with the OBSP-CONSUMER attestations that OIP-0001 and OIP-0005 also edit.
  2. Rounding to six decimal places suits the units in the vectors; should the precision be a definition field?
  3. Percentile reference: reference records where a percentile value comes from (a climatology) but is not read. Should a definition be able to carry the reference distribution itself?
  4. Spatial scope uses bounding boxes, geocodes, features and systems; polygons would need a geometry library in every evaluator. Wanted?
  5. Section number: §15 assumes OIP-0016’s §14; renumber if this proposal is accepted first.
  6. Last call: revision (30 days) or new capability (90 days)?

Draft folder

The proposal and, under patches/, the exact edits acceptance would make. Nothing here changes the protocol until the editors accept the proposal and its patches are applied in the same change. The proposal requires OIP-0006 and OIP-0008; the patches are made against the current tree and apply to it on their own; with all four applied, every patch of every other draft still applies.

File What it changes on acceptance
OIP-0018.md the proposal
patches/spec.patch §4.2 row TriggerDefinition, TriggerEvaluation; new §15 (TRG-1 to TRG-9)
patches/registers.patch registers/requirements.yaml regenerated (TRG-1 to TRG-9; the §5.9 rows gain the new cases)
patches/schemas-fixtures.patch new schemas trigger-definition and trigger-evaluation; five positive and sixteen negative fixtures; a definition and an evaluation in the OBSP-GRID and OBSP-CONSUMER example sets, and the observation record the consumer’s evaluation cites
patches/evaluator-cases.patch reference evaluator and the four invariants in the new sdk/python/src/obsp/triggers.py (registered from obsp/__init__.py); sdk/python/tests/test_triggers.py (17 tests); ten vectors in conformance/vectors/triggers/; cases CT-GRID-095 and CT-CONSUMER-095

Apply all four together. Acceptance removes patches/.

Overlaps (each proposal applies on its own; whichever is accepted second resolves these):

  • OIP-0016 also edits sdk/python/src/obsp/__init__.py (one import line each), the end of spec/OBSP-0.1.md (its §14 before this §15), the §4.2 table next to the same row, and registers/requirements.yaml (regenerate with python3 tools/requirements.py).
  • OIP-0008: the copied $defs.SignatureEnvelope matches its definition; once OIP-0008’s validator group runs, add both schemas (signature member present) to an object class of registers/algorithms.yaml and re-sign the fixtures and examples with the test keys (their signature bytes are placeholders).
  • OIP-0005: see the proposal for alert-notice.trigger.
  • registers/functions.yaml and relation rows: see the proposal.

On acceptance after the drafts it builds on

The example sets cannot show a MET evaluation over a record in the current tree: an observation record written before OIP-0006 has no origin, and the evaluator never admits such a record (ORIGIN). The MET outcome is shown by the vector met and the fixture trigger-evaluation.met.valid. Once OIP-0006 is accepted, OBSP-GRID gains a second definition, trigger-definition.warm.example.json (the same trigger at 20 Cel), and its evaluation trigger-evaluation.met.example.json: MET over the 4.0.0 alert evidence record (GOOD only, trusted time, origin MEASURED), with the SUSPECT record excluded (QUALITY); sdk/python/tests/test_triggers.py selects the evaluations by UNI and checks the admission. The 0.5 integration series does this at step 19.

Check that every patch still applies to the current tree: python3 -m unittest tests.test_validate -k draft_patches.