# OIP-0030: Risk-index admission profile: the field mapping from protocol objects to an index's intake

| Field | Value |
|---|---|
| Status | DRAFT |
| Functions | `qualify` (§5.6), `correct` (§5.9) and `exchange` (§5.10); no new function (the register keeps exactly twelve) |
| Affects | §4.2 (one row); new §5.10.1 (ADM-1 to ADM-10); new schemas `admission-record`, `admission-batch`; reference functions `sdk/python/src/obsp/admission.py`; five invariants; cases CT-GRID-300 to CT-GRID-304; new crosswalk `crosswalks/risk-index-intake.yaml` with its examples; one relation row `EXT-RISK-INDEX-INTAKE`; `docs/ecosystem/risk-index.md` (one row, one boundary rule) |
| Protocol version | obsp/0.1 |
| Requires | OIP-0006 (origin and subject class), OIP-0014 (usage policy, privacy class, policy decision) and OIP-0001 (read APIs through which an index reads the referenced documents). None of their schemas is needed for the patches to apply: the values of OIP-0006 and OIP-0014 that this proposal uses are repeated in its own schemas, the policy is referenced by UNI, version and digest, and the patches apply to the current tree on their own |
| Last call | 60 days (additive: two new objects, a new subsection and cases) unless the editors rule otherwise |

## Problem

The specification says that qualified observations with provenance feed the risk index (`docs/ecosystem/risk-index.md`,
relation `REL-INDEX`), but says nothing about how. An implementation that wants to offer its data to an index today has
to guess:

1. which protocol objects it offers, and how it names them so the index can read them back and track their corrections;
2. which epistemic class a value carries at the index: whether a model output or a value derived from a radio network
   can be called observed, and what a measurement without a qualification is;
3. whether a value about persons may be offered at all;
4. whether the rights state of the source release and the usage policy allow the offer, and who decides when they do
   not say;
5. how a correction notice (§5.9) becomes the correction an index applies, and what happens when the index itself finds
   a protocol value wrong;
6. how single records roll up to the batches an index intake commits.

Each implementation answers differently, so the index sees modelled values labelled observed, unqualified streams,
corrections it cannot match, and licences inferred from silence. The index owns its own admission contract; what is
missing is the protocol side of it.

## Change

### Normative text (new §5.10.1 "Admission to a risk index"; the exact text is in `patches/spec.patch`)

| Id | Requirement (summary) |
|---|---|
| ADM-1 | Every observation record or product offered to an index is an AdmissionRecord naming subject, qualification, time quality, provenance, source release and policy, and stating observed property, reference time, result state, unit, uncertainty, origin, method, subject class and correction state, copied unchanged; the assessment is the protocol side's (`decisionScope: PROTOCOL_ASSESSMENT`), never the index's decision |
| ADM-2 | Every reference is UNI, version and SHA-256 of the canonical form; version `1` for an object whose schema has no version until a notice supersedes it; references resolve; subject and provenance of every record not `NOT_ADMISSIBLE` are readable |
| ADM-3 | The epistemic mapping table below; method version for model, simulation and network-derived values; never `DERIVED`; no upgrade of a subject version's class |
| ADM-4 | `PERSONS` only when aggregated at or above the policy floor (and at least 2) with coarsened location; `P2` never |
| ADM-5 | The licence gate table below; `PROHIBITED` gives `NOT_ADMISSIBLE`; `REVIEW_REQUIRED` is never assessed `ADMISSIBLE`; the gate never chooses a licence or states lawfulness |
| ADM-6 | A measurement whose time quality is missing or untrusted is not `ADMISSIBLE` |
| ADM-7 | AdmissionBatch: one source release and one class; records by UNI and digest with outcome; counts balance; observed properties and places are the unions |
| ADM-8 | Correction propagation by the table below, every reference UNI, version and digest; a dispute holds, never an intake correction; terminal versions are `NOT_ADMISSIBLE` |
| ADM-9 | An index that finds a protocol value wrong is a consumer: it raises a dispute, never supersedes, withdraws or recalls |
| ADM-10 | A result state other than `PRESENT` is `NOT_ADMISSIBLE` |

### Epistemic mapping (ADM-3)

The intake class vocabulary is the one an index intake profile uses (observed, validated, modelled, derived, draft) and
the four-way class it reports (observed, declared, modelled, derived). `DERIVED` is reserved for values the index
computes from other admitted values and is never written by the protocol; `DRAFT` is never written.

| Origin (OIP-0006) | Condition | Class offered | Method kind |
|---|---|---|---|
| `MEASURED` | qualification present with result `PASS` | `OBSERVED` | `INSTRUMENT` |
| `MEASURED` | as above, and the qualification passed a validation scheme the index recognises (`recognisedValidation`: scheme URI and digest) | `VALIDATED` | `INSTRUMENT` |
| `MEASURED` | no qualification, or a result other than `PASS` | `NOT_ADMISSIBLE` (never offered) | |
| `MODEL_DERIVED` | method version stated | `MODELLED` | `MODEL` |
| `SIMULATED` | method version stated | `MODELLED` | `SIMULATION` |
| `DECLARED` | source release named | `DECLARED` | `AUTHORITY` |
| `NETWORK_DERIVED` | method version stated | `MODELLED` (proposed; open question 1) | `NETWORK_DERIVED` |

Subject class `PERSONS` is never admissible unless aggregated as OIP-0011 (SNS-3) and OIP-0014 (GOV-4) require: k at
or above the floor the usage policy declares, the coarsening cell stated, and privacy class `P1`; `P2` is prohibited at
the gate.

### Licence gate (ADM-5)

| Source release `rightsState` | Usage policy (OIP-0014) | Gate |
|---|---|---|
| `DENIED` | any | `PROHIBITED` |
| any | decision `DENY` for the use `derive` by the index's recipient class, or privacy class `P2` | `PROHIBITED` |
| `APPROVED_FOR_SCOPE`, or no source release | present, decision `PERMIT`, privacy class `P0` or `P1` | `ADMISSIBLE` |
| `UNKNOWN`, `REVIEW_REQUIRED` | any not prohibited | `REVIEW_REQUIRED` |
| any not denied | no policy known, or decision `NOT_EVALUATED` | `REVIEW_REQUIRED` |

`REVIEW_REQUIRED` goes to a person. The gate is a machine reading of declared terms (GOV-10): it never chooses a licence,
never treats `APPROVED_FOR_SCOPE` as a licence, and never states that a use is lawful.

### Correction propagation (ADM-8, ADM-9)

| CorrectionNotice transition | Reason | Intake correction kind | References written |
|---|---|---|---|
| to `SUPERSEDED` | `VALUE_ERROR`, `CALIBRATION_ERROR`, `TIME_ERROR`, `PROVENANCE_ERROR` | `CORRECTION` | new version (`supersededBy`) as the observation, corrected version as the one it supersedes, each UNI@version with digest |
| to `SUPERSEDED` | any other | `SUPERSESSION` | as above |
| to `WITHDRAWN` or `RECALLED` | any | `RETRACTION` | the corrected version |
| to `DISPUTED` | `DISPUTE_RAISED` | none: the offered value is held (`HOLD`) | the notice |
| `DISPUTED` to `CURRENT` | `DISPUTE_RESOLVED_UPHELD` | none: the hold is released (`RELEASE_HOLD`) | the notice |

The notice's dependants with `MARK_STALE` or `RECOMPUTE` are index-side values; the index marks and recomputes them
under its own contract. A correction the index makes of a protocol value comes back as a dispute raised by a `CONSUMER`
(the only transition a consumer may issue under §5.9), never as a supersession.

### Contracts

| Schema | Holds | Rules the schema enforces |
|---|---|---|
| `admission-record` | `admissionUni`, `subject` (UNI, version, digest, record kind `observation-record` or `product-manifest`), `observedProperty`, `placeRef`, `referenceTime`, `resultState`, `unit`, `uncertainty`, `origin`, `method`, `subjectClass`, `aggregation`, `qualification` (id, digest, result, `recognisedValidation`), `timeQuality` (reference, trusted), `provenanceRef`, `sourceReleaseRef`, `licenceGate` (rights state, policy reference, privacy class, policy decision, outcome), `correction` (state, notice), `epistemicClass`, `assessment` (outcome, reasons, `decisionScope`), `assessedBy`, `assessedAt`, `recordedAt` | the whole mapping table; the gate table; `NO_SOURCE_RELEASE` exactly when no source release is named; terminal and disputed versions; persons; missing values; untrusted time; reasons present exactly when not `ADMISSIBLE`; digests SHA-256 lower-case; every reference with a version; uncertainty never a zero |
| `admission-batch` | `batchUni`, `sourceReleaseRef`, `epistemicClass` (never `DERIVED`), `runState`, `records` (UNI, digest, outcome), `counts`, `observedProperties` (at most 200), `placeRefs` (at most 500), `corrections` (notice, corrected and superseding record, transition, reason, issuer role, intake kind), `assembledBy`, `assembledAt`, `recordedAt` | the correction table, including that a consumer only raises a dispute; at least one record or one correction |

The reference functions (`sdk/python/src/obsp/admission.py`, no dependency) compute the class, the gate, the assessment
with its reasons, and the intake kind. The invariants (`sdk/python/src/obsp/admission_invariants.py`) check what a schema
cannot:

| Invariant | Checks |
|---|---|
| `admission-refs-resolve` | every reference to a document in the set matches its digest; subject and provenance of each record not `NOT_ADMISSIBLE` are in the set (ADM-2) |
| `admission-subject-consistent` | observed property, unit, result state, times, origin and subject class equal the subject's; qualification result, time quality trusted flag and the source release's rights state equal their source (ADM-1, ADM-3) |
| `admission-assessment-reproduces` | class, gate, outcome and reasons reproduce from the record; persons at or above the floor; no class upgrade for a subject version (ADM-3 to ADM-6, ADM-10) |
| `admission-batch-rolls-up` | records resolve by digest, share class and source release, counts and unions balance (ADM-7) |
| `admission-correction-propagates` | every notice of an offered subject version has a matching correction row with the table's kind; every row's notice is in the set; a record's non-current state names a notice that corrects that version to that state (ADM-8, ADM-9) |

### The informative mapping to an index intake profile

`crosswalks/risk-index-intake.yaml` maps every required field of both objects to the intake events of an index intake
profile (event catalogue v1): `source.landed` (release reference, content digest, licence reference),
`observation.committed` (batch reference, run state, source release reference, accepted, quarantined and rejected
counts, epistemic state, indicator codes, place references) and `observation.corrected` (observation reference,
superseded reference, correction kind, reason, indicator code, place reference), plus the event envelope (subject
reference, time of record). An observation subject reaches the index through an admission batch as
`observation.committed`; a product, or the source release of a declared value, as `source.landed`; each correction row
except a hold as `observation.corrected`. Rows whose term was read in the intake event schemas say `checked: opened`.
Four mapper rules (`XW-RIX-01` to `XW-RIX-04`) are covered by the cases. The worked example is in
`crosswalks/examples/risk-index-intake/`.

The index's admission decision, its connector and receipt identifiers and the counts it records are its own; the
crosswalk never fills them from the protocol side.

## Compatibility

Additive. Two new schemas, one new subsection, one §4.2 row; no existing schema, enumeration or case changes, and no
existing record changes. The OBSP-GRID example set gains eight documents (two observation records, a source release,
three admission records, two batches); the existing ones are unchanged. One live-tree test assertion is made
independent of the number of shipped crosswalks, the same edit as OIP-0006, OIP-0013 and OIP-0029. The relation row
is in `relations` (target the risk index's intake profile, kind `feeds`), not in `external`, so
`registers/implements-edges.json` does not change. Its id starts with `EXT-` only because the crosswalk schema asks for
that prefix (open question 7).

Rebase: `registers/requirements.yaml` is regenerated, so every draft whose patch regenerates it (and the integration
series) no longer applies in a tree that holds this proposal until rebased; the spec hunk sits after §5.10, which
OIP-0001 and OIP-0009 also edit. The crosswalk patch edits the same `tests/test_validate.py` line as OIP-0006, OIP-0013
and OIP-0029 (identical text).

## Tests

- Positive fixtures (13): admission records measured-observed, validated, declared, model-derived, network-derived,
  persons-aggregated, unqualified-not-admissible, review-required-rights, prohibited-personal-data, missing-value;
  batches with records, declared, and corrections-only.
- Negative fixtures (38), one broken rule each, named after it: `admission-record.measured-unqualified-observed`,
  `.measured-failed-qualification-observed`, `.validated-without-recognised-validation`, `.model-derived-observed`,
  `.network-derived-observed`, `.network-derived-without-method-kind`, `.model-without-method-version`,
  `.declared-without-source-release`, `.derived-class`, `.persons-not-aggregated-admissible`,
  `.aggregation-without-persons`, `.rights-denied-not-prohibited`, `.p2-admissible`, `.gate-review-assessed-admissible`,
  `.no-policy-gate-admissible`, `.rights-state-without-source-release`, `.withdrawn-admissible`,
  `.disputed-without-notice`, `.missing-value-admissible`, `.time-untrusted-admissible`, `.admissible-with-reasons`,
  `.not-admissible-without-reason`, `.decision-scope-index`, `.ref-without-version`, `.digest-not-sha256`,
  `.uncertainty-zero-instead-of-not-estimated`, `.product-subject-unknown-kind`;
  `admission-batch.calibration-error-as-supersession`, `.duplicate-as-correction`, `.withdrawn-as-supersession`,
  `.disputed-as-correction`, `.superseded-without-superseding-record`, `.consumer-supersedes`, `.class-derived`,
  `.empty`, `.negative-count`, `.too-many-properties`.
- Cases (all automated, OBSP-GRID): CT-GRID-300 (schema, ADM-1), CT-GRID-301 (refs and copied fields, ADM-1, ADM-2),
  CT-GRID-302 (assessment, ADM-3 to ADM-6, ADM-10, function `qualify`), CT-GRID-303 (batches, ADM-7), CT-GRID-304
  (corrections, ADM-8, ADM-9, function `correct`). Every ADM requirement has direct coverage in
  `registers/requirements.yaml`.
- `sdk/python/tests/test_admission.py` (18 tests): the mapping, gate and correction tables; the persons floor; every
  positive fixture reproduces; each invariant passes on the OBSP-GRID set and fails on one fault.

## Open questions

1. `NETWORK_DERIVED`. The index's classes have no place for values derived from radio-network measurements. This
   proposal admits them as `MODELLED` with the method kind `NETWORK_DERIVED`, so nothing derived is called observed.
   Should the index add a class, and if it does, does the protocol map to it?
2. `DECLARED`. The index's four-way class has `DECLARED`, but the epistemic state enumeration of its
   `observation.committed` event, as read, does not. Until it does, a declared value has no committed batch class; the
   index team confirms the intended carrier.
3. Reference form. The protocol writes UNI@version with a digest. The index, as read, writes correction references with
   its own time of record instead of a version, and its committed and corrected events have no digest field. Which form
   does the index accept, and where does the digest travel?
4. Envelope. The change request asked for unit, reference time, method version and uncertainty in the envelope. The
   intake events read carry none of them; the crosswalk marks them `none`. Should the index add them, or read them from
   the referenced subject?
5. Recognised validation. `VALIDATED` needs a validation scheme the index recognises. Which schemes, and where is that
   list kept (a register of the index, or a protocol register)?
6. Versions. Several protocol objects (provenance, source release, qualification, time quality) carry no version field;
   ADM-2 sets version `1` until a notice supersedes them. Should those schemas gain a version instead?
7. The relation id. The crosswalk schema requires `EXT-` relation ids although the index is a consortium system, not an
   external standard. Should the schema accept `REL-` ids for crosswalks to consortium systems, and should the row be
   merged into `REL-INDEX`?
8. Edition. The crosswalk's "standard" is the index's intake event catalogue version 1 as read on 2026-11-21. The
   crosswalk schema only accepts `published`; the editors confirm the catalogue is published in the sense the schema
   intends, or the schema gains a status for a consortium profile.
9. Untrusted time. ADM-6 makes untrusted time a review, not a refusal. Should it refuse instead?
10. Products. A product subject maps to `source.landed`, as a source the index lands, not as an observation batch. The
    index team confirms that is how it wants protocol products.
11. Batches with no admissible record. The index's committed event needs at least one accepted value. A batch whose
    records are all held or refused is kept on the protocol side and not offered as committed; should that be a
    requirement?

This proposal makes no legal conclusion and decides no licence. Acceptance needs appointed editors and a last-call
window; until then it stays at DRAFT.
