# OIP-0009: Exchange bindings: WIS 2.0 notifications, the STAC obsp extension, and OGC API Features, EDR and Records

| Field | Value |
|---|---|
| Status | DRAFT |
| Function | `exchange` (§5.10); no new function (the register keeps exactly twelve) |
| Requires | OIP-0001 (read APIs, EXCH-1 to EXCH-9). The bindings implement its requirements and contradict none; the patches still apply to the current tree on their own |
| Affects | §6 (new table "Exchange bindings" after the wire-bindings table); `registers/relations.yaml` (`EXT-STAC` gains `exchange`, `provenance` and its binding folder; new rows `EXT-WIS2`, `EXT-OGCAPI`); `registers/implements-edges.json` and `registers/requirements.yaml` regenerated; new bindings `bindings/wis2/`, `bindings/stac/`, `bindings/ogc-api/`; new OpenAPI document `schemas/openapi/obsp-exchange.openapi.yaml`; new cases CT-GRID-040 to CT-GRID-043, CT-CONSUMER-040 and CT-CONSUMER-041 |
| Protocol version | obsp/0.1 |
| Last call | 30 days (bindings of an existing function, no new object) unless the editors rule otherwise |

## Problem

OIP-0001 states what a read endpoint must do (EXCH-1 to EXCH-9) and names the standards it should use: OGC API
Features, EDR and Records, STAC for archives, and WMO WIS 2.0 as a product option. It names `bindings/ogc-api/` but does
not write it, and nothing says how a protocol record becomes a WIS2 notification or a STAC Item. Without the bindings two
operators publishing the same product produce documents a consumer cannot compare: the product's identity, digest,
provenance, licence and correction state travel in different places or not at all, and a consumer cannot check that the
data it fetched is the data that was announced.

## Change

### Normative text (§6, after the wire-bindings table)

A new table names the three exchange bindings, the standard and edition each profiles, its folder and what it carries,
followed by one requirement:

- A publication or read endpoint that names one of these bindings in a ProductManifest's `endpoints` MUST follow every
  requirement of that binding's profile.

Each binding follows `bindings/README.md`: `PROFILE.md` (scope, standard and edition, requirements, mapping, not mapped,
out of scope, open questions), `binding.yaml`, a machine-readable artefact in the standard's own syntax, at least two
positive and two negative examples, and a test that keeps the examples honest.

| Binding | Standard (edition) | Artefact | Requirements |
|---|---|---|---|
| `bindings/wis2/` | WMO-No. 1061 Manual on the WMO Information System, Volume II: WIS2 Notification Message, WIS2 Topic Hierarchy (edition 1.2 or 1.3, not checked) | `wnm-obsp.schema.json` (JSON Schema for the OBSP-profiled message), `mapping.yaml` | BND-WIS2-01 to BND-WIS2-12 |
| `bindings/stac/` | SpatioTemporal Asset Catalog 1.1.0 | `obsp-extension.schema.json` (the `obsp:` STAC extension), `mapping.yaml` | BND-STAC-01 to BND-STAC-10 |
| `bindings/ogc-api/` | OGC API - Features - Part 1: Core 1.0; OGC API - EDR 1.1; OGC API - Records - Part 1: Core 1.0 (editions not checked) | `schemas/openapi/obsp-exchange.openapi.yaml` (OpenAPI 3.1, checked by `tools/check_openapi.py`), `mapping.yaml` | BND-OGCAPI-01 to BND-OGCAPI-11 |

What the bindings decide:

1. **WIS 2.0.** An observation record, a product version (named in its provenance bundle) or a correction notice becomes
   a notification: `data_id` is the topic levels after `origin/a/wis2/`, the UNI and `@version`; `integrity` is the
   record's OBSP digest (method = algorithm, value = base64 of the digest bytes); one `canonical` link to the record and a
   link of relation `http://www.w3.org/ns/prov#has_provenance` with the provenance digest; `datetime` from the phenomenon
   or result time, never the publication time; the topic is `origin/a/wis2/<centre-id>/data/<core|recommended>/...` with
   levels from the WIS2 Topic Hierarchy register, and restricted products go to `recommended` with a `license` link. The
   WIGOS station identifier is written only from the sensor passport extension `wigos.station`. A withdrawn or recalled
   record is announced only through its correction notice. A consumer checks integrity before use.
2. **STAC.** A product version is an Item and a product a Collection, with the `obsp:` extension: `product_uni`,
   `version`, `digest`, `provenance` (href and digest, plus the provenance link), `origin` (OIP-0006 vocabulary),
   `quality`, `correction_state`, `superseded_by` (with a `successor-version` link), `upstream_term`, `receipt` (SCITT
   transparency receipt reference) and `ard_claim` (placeholder for an analysis-ready data claim: specification, version,
   `SELF_ASSESSMENT` basis and assessment reference; never a certification).
3. **OGC API.** One collection per product, one feature per observation record (with result and typed `resultState`,
   record digest, provenance link, product id and correction state), position, area and cube queries over the same
   features, and the catalogue as OGC API Records, one record per ProductManifest without loss of licence, upstream term,
   quality or correction state. Every operation is a GET; every error is a problem document.

### How the bindings relate to OIP-0001

| OIP-0001 | Profiled by |
|---|---|
| EXCH-2 (endpoints declared) | binding names `wis2-notification`, `stac`, `ogc-api-features`, `ogc-api-edr`, `ogc-api-records` used as the bindings' identifiers |
| EXCH-3 (read-only) | BND-OGCAPI-01 |
| EXCH-4 (product id and correction state; never dropped) | BND-OGCAPI-03, -04, -07; BND-STAC-03; BND-WIS2-11 |
| EXCH-5 (typed missing) | BND-OGCAPI-05, -08 |
| EXCH-6 (Records catalogue) | BND-OGCAPI-06 |
| EXCH-7 (Features, EDR, STAC, WIS 2.0) | the three bindings |
| EXCH-8 (problem details) | BND-OGCAPI-10 |
| EXCH-9 (consumer) | BND-OGCAPI-11, BND-STAC-10, BND-WIS2-12 |

No protocol object is added. The notification, Item, Collection, feature and record are projections of existing objects
(`observation-record`, `product-manifest`, `provenance`, `correction-notice`, `supply-chain-receipt`), defined by the
bindings, not new contracts. Fields that OIP-0001 adds to `product-manifest` (licence, upstream term, quality, correction
state, successor, version) are read where present; the examples use the values of OIP-0001's amended fixture, and the
tests read them from the fixture once OIP-0001 is applied.

## Compatibility

Additive. No schema of `schemas/json` changes; no existing record becomes invalid. The bindings are `proposed` until this
proposal is accepted, and they need OIP-0001 accepted first (they read its fields and profile its requirements). The
OpenAPI document is new and does not change the gateway API.

## Tests

| Requirement | Case | Kind | Evidence |
|---|---|---|---|
| §6 requirement; BND-WIS2-01 to -11 | CT-GRID-040 | automated (`binding-wis2-notification`: the notification, the topic and the announced record; the message is validated against `wnm-obsp.schema.json` and compared with the record) | notifications, records and digests; BND-WIS2-11 is not shown by a document |
| §6 requirement; BND-STAC-01 to -09 | CT-GRID-041 | automated (`binding-stac-description`: the Item or Collection and, for an Item, its provenance bundle; validated against `obsp-extension.schema.json` and compared with the bundle) | STAC documents, provenance and digests; the equality with the manifest is not checked |
| §6 requirement; BND-OGCAPI-01 to -05, -07 to -10 | CT-GRID-042 | manual (live endpoint: only read operations answer, /conformance, query equality) | requests, responses and digests |
| §6 requirement; BND-OGCAPI-01, -02, -04, -06, -07, -10 | CT-GRID-043 | manual (live endpoint: read-only operations, /conformance) | manifests and catalogue responses |
| BND-WIS2-03, -05, -11, -12 | CT-CONSUMER-040 | manual | consumer attestation |
| BND-STAC-04, -05, -07, -10; BND-OGCAPI-05, -07, -09, -11 | CT-CONSUMER-041 | manual | consumer attestation |

CT-GRID-040 and CT-GRID-041 are automated (`obsp.golden`, `sdk/python/src/obsp/inv_oip0009.py`); the other four stay manual until the live harness reaches exchange endpoints (OIP-0001 plans that for slice S6). Each binding
has its own positive and negative examples and a test that runs in `make test`: `tests/test_wis2_binding.py`,
`tests/test_stac_binding.py`, `tests/test_ogcapi_binding.py`. Each derives every positive example from repository
fixtures through its mapping and validates it against the artefact, and checks that every negative example breaks exactly
the requirement its file name states:

- WIS 2.0: `integrity-mismatch` (BND-WIS2-03), `missing-data-id` (BND-WIS2-02), `missing-provenance-link` (BND-WIS2-05),
  `wigos-identifier-invented` (BND-WIS2-09), `recommended-without-licence-link` (BND-WIS2-08).
- STAC: `extension-not-declared` (BND-STAC-01), `superseded-without-successor` (BND-STAC-03),
  `ard-claim-without-assessment` (BND-STAC-07), `quality-flag-unknown` (BND-STAC-06).
- OGC API: `missing-value-as-zero` (BND-OGCAPI-05), `feature-without-product-id` (BND-OGCAPI-04),
  `superseded-without-successor-link` (BND-OGCAPI-07), `record-without-licence` (BND-OGCAPI-06).

## Open questions

1. WIS2 Notification Message: which edition is in force (1.2 or 1.3), its core conformance class URI, the integrity
   method names and whether extra link members (`obsp:digest`) are allowed. Everything about WIS 2.0 in this proposal is
   `checked: not checked`.
2. WIS2 Topic Hierarchy: the levels used in the examples after `data/core` need a check against the register; how the
   WMO Unified Data Policy categories map to licences and upstream terms is a policy question for the editors.
3. WIGOS station identifier: keep the extension key `wigos.station` on the sensor passport, or add a typed field to the
   passport or the site description in a later proposal?
4. STAC: where the `obsp` extension schema is published (and so its identifier) is a hosting decision for the steward;
   until then its identifier is a URN, which STAC tools that fetch extension schemas cannot resolve.
5. `product-manifest` has no spatial or temporal extent; the bindings use the product's generation time and write no
   guessed extent. Should a later proposal add an extent?
6. `obsp:ard_claim` is a placeholder; the analysis-ready data specifications it may name and how an assessment is
   recorded need their own proposal.
7. OGC API: every edition, document number, requirement path and conformance class URI is `checked: not checked`, in
   particular whether OGC API - Records - Part 1: Core 1.0 is published (only published editions are targeted).
8. EDR CoverageJSON responses are not profiled because a coverage range has no typed missing state (EXCH-5).
9. CT-GRID-042, CT-GRID-043, CT-CONSUMER-040 and CT-CONSUMER-041 are manual; should the live harness (OIP-0001 slice S6) replace them with live cases?
10. Merge order: this proposal's `cases.patch` creates `conformance/examples/OBSP-GRID/attestations.yaml`, which
    OIP-0001's `cases-invariants.patch` also creates, and `registers.patch` regenerates `implements-edges.json`, which
    other drafts also regenerate. Whichever proposal is accepted second merges those two files (the attestation entries
    are appended; the edges are regenerated with `tools/build_edges.py`).

Acceptance needs appointed editors, OIP-0001 accepted first, and a last-call window. Until then this proposal stays at
DRAFT.
