# OIP-0014: Data governance: usage policies, privacy classes, consent, retention, sensitivity and CARE

| Field | Value |
|---|---|
| Status | DRAFT |
| Function | none added (the register keeps exactly twelve); cross-cutting, under §8 (security model), used by `describe`, `exchange`, `correct`, `federate` and `exit` |
| Affects | §4.2 (one row), §8 (Privacy row), new §8.1 (GOV-1 to GOV-10); new schemas `policy`, `policy-decision`, `consent-record`, `retention-rule`, `disclosure-accounting`; reference evaluator `sdk/python/src/obsp/policy.py`; vectors `conformance/vectors/policy/`; eight invariants; cases CT-PROVIDER-060, CT-PROVIDER-061, CT-CONSUMER-060 to CT-CONSUMER-062, CT-GRID-070 to CT-GRID-074 |
| Protocol version | obsp/0.1 |
| Relates to | OIP-0008 (a later revision may sign `policy` and `policy-decision` with its envelope); §5.7 FederationBinding (gap G-FED-1) names data classes and retention, which this proposal gives a contract |
| Last call | 90 days (new capability that every exchanging participant implements) unless the editors rule otherwise |

## Problem

The specification asks for governed products (§5.10: "licence, the most restrictive upstream term"), for a policy per
personal data class (§8 Privacy) and for federation by data class and retention (§5.7), but it defines none of these.
Today a consumer cannot tell from a product what it may do with it, for which purpose, where and for whom; a provider
cannot state that a stream holds personal data, on which declared basis, and when it is disposed of; nobody can see how
many records a release withheld and why; and indigenous data has no place to name the authority the community holds.
Each implementation invents its own terms, so two grids cannot exchange data and keep its conditions.

## Change

### Normative text (new §8.1 "Data governance"; the exact text is in `patches/spec.patch`)

A usage policy is a W3C ODRL 2.2 policy under the profile `obsp-odrl` (`urn:obsp:odrl-profile:obsp-odrl:1`).

| Id | Requirement (summary) | Error codes |
|---|---|---|
| GOV-1 | Every exchanged product and every described source has a policy whose `target` names it; only profile terms; a receiver refuses other terms; temporal windows open before they close | |
| GOV-2 | The policy states the licence the assigner declares, as an SPDX identifier or expression (`NOASSERTION` allowed) or a reference by URI and digest; the protocol never chooses, ranks or recommends a licence | |
| GOV-3 | Deny by default; a prohibition overrides a permission; no action implies another; PERMIT or DENY with every applicable reason code and, with a PERMIT, the permission's duties; deterministic; decisions SHOULD be recorded as PolicyDecision; the vectors SHOULD pass | `OBS-GOV-0001` to `0003`, `0009` |
| GOV-4 | Privacy class `P0` (no personal data), `P1` (indirect: aggregation floor k ≥ 2 and a coarse location rule) or `P2` (personal); a release outside `OWNER` below k is denied | `OBS-GOV-0004` |
| GOV-5 | `P2` states the declared lawful basis, data categories and export term; not exported unless `EXPORT_WITH_CONSENT` and a valid consent covers the request; `NOT_EXPORTED` is the default | `OBS-GOV-0005`, `0006` |
| GOV-6 | Consent record: purposes, scope, data categories, granted, expires, pseudonymous subject; withdrawal recorded, never erased, propagated as a correction notice (§5.9) referenced from the record; requests relying on it are then denied | `OBS-GOV-0006` |
| GOV-7 | `P1` and `P2` policies reference retention rules: duration, trigger, disposal method, proof; disposal at decommissioning is proved by the DecommissionRecord (§5.12) | |
| GOV-8 | Sensitivity flags `security-sensitive-resolution`, `critical-infrastructure`, `export-controlled` with the recipient classes that receive full records and the handling for the others; no silent drops: every release has a DisclosureAccounting in which released plus withheld equals the total, by reason | `OBS-GOV-0007` |
| GOV-9 | CARE class for data about or from indigenous peoples: the community authority the community names, optional Local Contexts label identifiers; every permission beyond `use` notifies that authority, and such an action is denied without its approval | `OBS-GOV-0008` |
| GOV-10 | A decision is a machine evaluation of declared terms; it is never presented as a statement that a use is lawful or unlawful | |

Also: §4.2 gains one row for the five objects; the §8 Privacy row points to §8.1.

### The `obsp-odrl` profile

| Profile term | ODRL 2.2 term | Note |
|---|---|---|
| actions `use`, `distribute`, `derive` | `odrl:use`, `odrl:distribute`, `odrl:derive` | the profile drops ODRL's `includedIn` inference: a permission permits only the action it names |
| actions `train`, `publish` | profile terms | training a model on the asset; making it available to the public |
| duties `attribute`, `share-alike`, `notify`, `delete-after` | `odrl:attribute`, `cc:ShareAlike`, `odrl:inform`, `odrl:delete` refined by `odrl:elapsedTime` | |
| constraints `purpose`, `spatial`, `dateTime` | `odrl:purpose`, `odrl:spatial`, `odrl:dateTime` | purposes as prefixed terms (DPV where one fits); regions as ISO 3166-1 alpha-2 or ISO 3166-2 codes, a subdivision being inside its country |
| constraints `aggregationMinimum`, `recipientClass` | profile terms | recipient classes `OWNER`, `FEDERATION_PEER`, `PUBLIC_AUTHORITY`, `RESEARCH`, `HUMANITARIAN`, `COMMERCIAL`, `PUBLIC` |
| operators | `isAnyOf`, `isNoneOf` for lists; `gteq`, `gt`, `lteq`, `lt` for times; `gteq` for the aggregation minimum | |

The mapping column was written from the ODRL 2.2 vocabulary as remembered, `checked: not checked` against the
Recommendation text.

### Contracts

| Schema | Holds | Rules the schema enforces |
|---|---|---|
| `policy` | `@context` (ODRL JSON-LD context), `@type` (`Set`, `Offer`, `Agreement`), `uid`, `profile`, `target` (`PRODUCT`, `SOURCE`, `DATASET`, `OBSERVATION_STREAM`), `assigner`, optional `assignee`, `licence`, `privacyClass`, `privacy`, `sensitivity`, `care`, `retentionRuleRefs`, `permission` (at least one), `prohibition`, `validFrom`, `validUntil` | profile terms only, operators per operand; licence exactly one of `spdx` or `ref`; P0 has no privacy terms; P1 needs k ≥ 2, coarse location and retention; P2 needs lawful basis, data categories, export term, consentRequired and retention; a consent basis or an export with consent forces consentRequired; COARSEN states the coarsening; CARE names the authority |
| `policy-decision` | the policy by UNI and digest, the request, `decision`, `reasons` (`OBS-GOV-NNNN`, requirement), `duties`, `transforms`, `scope` `DECLARED_TERMS`, `evaluatedBy`, `evaluatedAt` | a DENY carries no duties or transforms; at least one reason; the scope cannot claim lawfulness |
| `consent-record` | `consentUni`, pseudonymous `subjectRef`, `controller`, `purposes`, `scope` (targets, recipient classes, regions), `dataClasses`, `grantedAt`, `expiresAt`, `status`, `withdrawal` (time and correction notice reference), `evidenceRef` | WITHDRAWN needs the withdrawal with its notice; ACTIVE and EXPIRED carry none; no name or contact field |
| `retention-rule` | `ruleUni`, `appliesTo` (policy, data categories, subject), `duration` (ISO 8601), `trigger`, `disposal` (method, proof form, and once done `completed` with the proof reference) | trigger DECOMMISSIONED needs the subject and the decommission record as proof |
| `disclosure-accounting` | product and version, policy reference, period, `totalRecords`, `releasedRecords`, `withheld` and `coarsened` counts by reason | `withheld` always present (empty when none); counts at least 1 per row; reasons from a closed list |

The reference evaluator (`sdk/python/src/obsp/policy.py`, no dependency) implements GOV-3 to GOV-9 in a fixed order:
request check, policy window, prohibitions, privacy class, consent, sensitivity, CARE, permissions. A sensitivity flag
on `FLAGGED_RECORDS` gives a transform (withhold or coarsen those records and count them, GOV-8); on `WHOLE_ASSET` with
WITHHOLD it denies.

## Compatibility

Additive. Five new schemas, new example documents, new cases; no existing schema changes, so existing documents stay
valid. Correction notices for a consent withdrawal use the existing `correction-notice` contract (record kind
`consent-record`, transition to `WITHDRAWN`, reason `RIGHTS_CHANGE`). No function is added.

## Tests

| Requirement | Case | Kind and check |
|---|---|---|
| GOV-1, GOV-2, GOV-4 | CT-PROVIDER-060 | invariants `policy-window-ordered`, `personal-data-not-exported` over the provider's source policy |
| GOV-7 | CT-PROVIDER-061, CT-GRID-071 | `policy-retention-resolves` (every referenced rule present, unchanged, for that policy); `retention-disposal-proof` (completed disposal names the decommission record by UNI and digest, for the rule's subject) |
| GOV-1, GOV-8 | CT-CONSUMER-060, CT-GRID-072 | `product-has-policy`; `disclosure-accounting-balances` (released plus withheld equals total, one row per reason, policy present by digest) |
| GOV-6 | CT-CONSUMER-061, CT-GRID-074 | `consent-withdrawal-propagates` (the notice exists, matches its digest, corrects that consent record and withdraws it) |
| GOV-3, GOV-4, GOV-5, GOV-9, GOV-10 | CT-CONSUMER-062 | `policy-decision-reproduces`: each recorded decision is re-evaluated against the policy it names; decision, reason codes, duties and transforms must match |
| GOV-1, GOV-4, GOV-5 | CT-GRID-070 | `product-has-policy`, `personal-data-not-exported`, `policy-window-ordered` |
| GOV-9 | CT-GRID-073 | `care-notify-authority` |
| GOV-3 to GOV-9 | vectors | 35 vectors in seven files; `sdk/python/tests/test_policy.py` runs them |

Positive fixtures: 12 (four policies: product P1, personal data P2, CARE, licence by reference; two decisions; two
consent records; two retention rules; two accountings). Negative fixtures: 43, one broken rule each, named after it:
`policy.unknown-action`, `.unknown-left-operand`, `.purpose-operator-eq`, `.aggregation-operator-lt`,
`.region-not-iso3166`, `.wrong-profile`, `.no-permission`, `.licence-missing`, `.licence-spdx-and-ref`,
`.p0-with-privacy-block`, `.p1-without-aggregation-floor`, `.p1-floor-below-two`, `.p1-without-coarse-location`,
`.p1-without-retention`, `.p2-without-lawful-basis`, `.p2-consent-basis-not-required`, `.p2-without-export-term`,
`.unknown-sensitivity-flag`, `.coarsen-without-method`, `.care-without-community-authority`,
`.attribute-duty-without-text`, `.delete-after-without-duration`; `policy-decision.legal-determination-scope`,
`.deny-with-duties`, `.no-reason`, `.unknown-decision`, `.reason-code-outside-family`;
`consent-record.withdrawn-without-withdrawal`, `.active-with-withdrawal`, `.withdrawal-without-correction-notice`,
`.missing-expiry`, `.subject-name-inline`, `.no-purpose`; `retention-rule.duration-not-iso8601`,
`.decommissioned-with-attestation-proof`, `.decommissioned-without-subject`, `.unknown-disposal-method`,
`.missing-proof`, `.completed-proof-wrong-kind`; `disclosure-accounting.withheld-row-zero-count`, `.unknown-reason`,
`.withheld-list-missing`, `.negative-total`. Unit tests: 29 in `sdk/python/tests/test_policy.py` (vectors, the vector
documents against their schemas, determinism, unknown constraint never permits, prohibition precedence, each invariant
passing on the examples and failing on one fault).

## Standards cited

| Standard | Edition and clause | Used for | Checked |
|---|---|---|---|
| W3C ODRL Information Model 2.2 and ODRL Vocabulary and Expression 2.2 | W3C Recommendation, 2018-02-15; policy, rule, constraint, duty, profile | the policy structure and the profile mechanism | not checked |
| W3C Data Privacy Vocabulary (DPV) | Community Group specification, version 2 | purpose, legal basis and personal data category terms | not checked |
| SPDX License List and SPDX specification | License List identifiers and the license expression syntax (SPDX 2.3, Annex D) | licence identifiers and expressions | not checked |
| CARE Principles for Indigenous Data Governance | 2019 publication; Collective benefit, Authority to control, Responsibility, Ethics | the CARE class and the authority of the community | not checked |
| Local Contexts labels and notices | label identifiers as published by the issuing project | optional label identifiers in the CARE class | not checked |
| ISO 3166-1 and ISO 3166-2 | country and subdivision codes | spatial constraints and consent regions | not checked |
| ISO 8601 | durations | retention durations and delete-after duties | not checked |

Relation rows to add to `registers/relations.yaml` on acceptance (left out of the patches so that
`registers/implements-edges.json` stays in step with the other drafts; regenerate it with `python3 tools/build_edges.py`
after adding them):

```yaml
  - { id: EXT-ODRL, standard: 'W3C ODRL Information Model 2.2 and Vocabulary 2.2', kind: aligns-with, functions: [describe, exchange], schemas: [policy, policy-decision] }
  - { id: EXT-DPV, standard: 'W3C Data Privacy Vocabulary (DPV)', kind: aligns-with, schemas: [policy, consent-record, policy-decision] }
  - { id: EXT-SPDX-LICENSES, standard: 'SPDX License List and license expressions', kind: aligns-with, schemas: [policy] }
  - { id: EXT-CARE, standard: 'CARE Principles for Indigenous Data Governance', kind: aligns-with, functions: [federate], schemas: [policy] }
  - { id: EXT-ISO3166, standard: 'ISO 3166-1 and ISO 3166-2 (country and subdivision codes)', kind: aligns-with, schemas: [policy, consent-record, policy-decision] }
```

## Open questions

1. Case functions. CT-CONSUMER-060 and CT-CONSUMER-062 list `correct`, and CT-GRID-070 and CT-GRID-072 list
   `federate`, rather than `exchange`: listing `exchange` changes the case lists of REQ-5.10-1 in
   `registers/requirements.yaml`, which other drafts' patches also change, so those patches would stop applying. The
   editors may move them to `exchange` when the drafts are accepted in order.
2. Action independence. The profile refuses ODRL's `includedIn` inference (a permission for `use` does not permit
   `distribute`). Is this the right default, or should the profile follow ODRL and list exclusions instead?
3. Coarse location. The schema requires a method and a resolution but sets no ceiling. Should the protocol set one
   per method (for example an H3 resolution or a number of decimal places), or leave it to the policy author?
4. Recipient classes. Is the closed list of seven classes right, and should `COMMERCIAL` be split?
5. Disposal attestation. `retention-rule` names the proof form `DISPOSAL_ATTESTATION` and the record kind
   `disposal-attestation`, for which no schema exists yet. Define one here, or in a later proposal?
6. Signing. Should `policy`, `policy-decision`, `consent-record` and `disclosure-accounting` carry the OIP-0008
   envelope once it is accepted (register class `receipt`)?
7. Spatial constraints use ISO 3166 codes only. Are polygons or H3 cells needed for regions below a subdivision?
8. Lawful basis and purposes are pattern-checked prefixed terms, not a closed DPV list, and the protocol does not
   assess them. Should a register of accepted DPV terms be kept?
9. Not checked against the sources: every row of "Standards cited", including the ODRL term names in the profile
   mapping, the DPV term names used in examples (`dpv:Consent`, `dpv:ResearchAndDevelopment`, `dpv:ServiceProvision`,
   `dpv-pd:Location`, `dpv-pd:HealthRecord`) and the SPDX expression clause.

This proposal makes no legal conclusion. It defines how declared terms are written, carried and evaluated; whether a
declared lawful basis, licence or authority holds is for the parties and competent bodies.

Acceptance needs appointed editors and a last-call window. Until then this proposal stays at DRAFT.
