Skip to content

Architecture / Decision records / ADR-HIS-073

ADR-HIS-073 Consent directives: immutable versions, a governed consent model, capture as Proposed, and conflicts kept for privacy review

Status Accepted
Decided 2026-11-26 by session RC-2-S02
Record Drafted 2026-11-26; approved 2026-11-30 by the Enterprise Architecture Board
Where the rule lives services/ess-runtime-decision/mod-ess-003/ (directive/Directives.java, directive/DirectiveRules.java, model/ConsentModels.java, db/mod_ess_003/V1__consent_directives.sql, consent/consent-model.v1.json); the cns-* rules of mod-ess-002/src/main/resources/policy/enterprise-access.v1.json

Context

FR-ESS-CNS-001 makes the consent directive first-class data in Domain 10. The directive:

  • is validated against a consent model;
  • is versioned on every change, and no version is ever deleted (BR-ESS-013);
  • expires and is withdrawn;
  • is published on each change, so the domains that enforce consent act on its current state (BR-ESS-012);
  • can be queried as at a past time;
  • follows the patient through a merge.

The contract consent.v1 (IF-ESS-005) and its contract points were fixed by RC-2-S01 (ADR-HIS-067). Session RC-2-S02 builds it in MOD-ESS-003, a module of the runtime decision unit. The later consent-aware decision (FR-ESS-CNS-002) and the slices RC-4 and RC-5 extend it. What the card and the specification left open:

  • Where the consent model comes from. CFG-ESS-010 is configuration of the jurisdiction profile, owned by the privacy officer and to be validated by legal advice (part 13). DEC-ESS-009 settles the five directive types and the legal-basis position. It does not set each type's purposes, scopes, recipients, legal-basis codes or maximum validity.
  • When a directive missing attributes is refused and when it is held as Proposed. Part 10 refuses a missing legal basis ("Select the legal basis."). PR-CNS-001-4 holds a reference "captured at registration without required attributes" as Proposed. The contract says "where policy allows".
  • How a version can be immutable while the prior version "becomes Superseded" (PR-CNS-001-1), and how the as-at query (AC-04) reads the versions.
  • What counts as a conflict "the precedence rule cannot order" (PR-CNS-001-2).
  • Who may do what: the policy rules of ess.ConsentDirective.

Decision

  1. Every change is a new version row; nothing is updated in place.
  2. Each of these writes a version of mod_ess_003.directive_version, which the schema refuses to update or delete: record, new version, activation at the validity start, expiry, withdrawal, entered-in-error, supersession by another directive, reassignment on merge, and restoration on unmerge.
  3. Each version stores the answer as given, with author, channel, recorded time, effective time and source (part 6.2).
  4. The directive row holds only the patient the directive is held under now and its current version, which is also the ETag.
  5. When a new version of the same directive replaces an Active one, the replaced version is noted once in version_superseded. The version row itself is unchanged. The history and a read by version answer the replaced version as superseded, with supersededBy. A read asAt answers the status that was in force at that time.
  6. A directive superseded by another directive (PR-CNS-001-1) gets its own new version with status superseded.

  7. The consent model is governed configuration; the starter content is not approved.

  8. A model version arrives as ConfigurationChanged of item type ess.consent-model, item key enterprise. It is read with readConfigurationVersion and checked against the event's hash. It applies from its effective time, and a rollback reactivates the version it names.
  9. The five types of DEC-ESS-009 with placeholder purposes, scopes, recipients and legal bases are in consent-model.v1.json. A non-production deployment may install them with his.consent.seed-enabled. Production never uses them, and they decide only while no governed version is in force. This follows the pattern of the starter policy (ADR-HIS-065 point 3).
  10. Without a model, no directive can be validated, so recording answers 503 (unavailable). It is never a guess, and the capturing domain records "consent capture pending" (PR-REF-002-2).
  11. Each version records the model version it was validated against.

  12. A capture is held as Proposed; a direct record must be complete.

  13. These are captures: a directive submitted with a context (the encounter and source record of a capturing domain, such as the D01-ADM registration), and the completion of a Proposed directive. A missing attribute the type requires, and a representative without recorded authority, are listed in outstandingAttributes. The directive is Proposed and never used to permit.
  14. A directive recorded without a capture context must be complete. Each missing attribute is refused with the part 10 message.
  15. A value the type does not allow is always refused, on either path: purpose, scope, recipient, legal basis or validity.
  16. A complete directive whose validity start is still to come is Proposed with no outstanding attributes (Q-RC2-5). The job makes it Active at that time.
  17. A new version of an Active directive applies when it is recorded. One with a later validity start is refused, with the direction to record a new directive for the later start. That new directive then supersedes the old one when it becomes Active (PR-CNS-001-1). Neither an Active directive nor its replacement is ever left out of force in between.

  18. Precedence and conflicts.

  19. The precedence rule orders directives of the same patient, type, purposes and recipients, compared as sets: the later one becoming Active supersedes the earlier one (PR-CNS-001-1).
  20. A conflict is two Active directives of the same patient and type with opposite decisions that are not of the same key, and whose purposes, recipients (none means anyone), scope (each part both name) and validity periods all overlap. A merge also flags two directives of the same key with opposite decisions: they come from two identities, so neither is the later act of one patient.
  21. What happens on a conflict:
    • both directives are kept, and both carry conflict (the most restrictive applies, in FR-ESS-CNS-002);
    • ConsentChanged with conflict-flagged is published for each;
    • a task ess.consent-conflict-review in queue ess.privacy-review is sent after commit, with the conflict's identifier as its Idempotency-Key;
    • its priority and due time are settings of the consent model (conflictReview).
  22. The conflict is resolved, and audited, when either directive stops being Active.

  23. Patient identity and merge.

  24. The patient is resolved through readPerson of patient-identity.v1 (contracts/adm), and a retired identifier resolves to its survivor. An unknown patient is refused with "Patient could not be identified."; Domain 1 unavailable is 503.
  25. reassign(mergeRef, retired, survivor) holds every directive of the retired identity under the survivor as a new version with reassignedFrom, and flags the conflicts. restore(mergeRef) undoes exactly what that merge moved. Both are idempotent and publish reassigned and restored.
  26. The subscription to PatientMerged and PatientUnmerged waits for their contract (slice RC-3, contract point 8).

  27. Policy. The specification names the conditions of FR-ESS-CNS-001 part 3 and D10-ESS 9.2 and 9.3 but not how they are decided. The conditions below were proposed by the session, following common hospital practice, and adopted as built by the repository owner on 2026-11-27 ("adopt what is already built in the branch"; questions Q5 and Q6 of issue #47). The owner of D10-ESS and the privacy officer may change them as policy content, through the configuration lifecycle of enterprise-access.

  28. The resource type is ess.ConsentDirective, patient-scoped. The actions are ess.cns.directive.create, .revise, .withdraw, .mark-entered-in-error, .read and .list. No emergency override applies to it.
  29. Authorized for the patient. A person acts on a patient's directives only where the patient holds a No. RM at the facility the person acts for (X-Facility). For every request by a person, MOD-ESS-003 reads the patient from Domain 1 (readPerson, facilityIdentifiers) and sends the facilities as patientFacilities. The rules require the request's facility to be one of them, and the role must be in force at that facility. The privacy officer is the one exception: an enterprise role for privacy oversight. The rule cns-directive-privacy-read has no step-up flag; the second factor comes from the role being privileged, which MOD-ESS-001 puts in force only at assurance aal2.
  30. Authorized for the consent type, by role (ACT-ESS-012):

    Role Consent types it records, versions and withdraws Purposes
    patient-access-and-flow (registration clerk) general consent, external sharing, communication preference: what is captured at registration HOPERAT
    him-staff (HIM officer) all five, as the release-of-information and privacy desk HOPERAT
    physician general consent, external sharing, sensitive restriction, secondary use: what is discussed in care TREAT, HOPERAT
    nurse-and-midwife general consent, sensitive restriction, communication preference TREAT, HOPERAT
  31. Reads are purpose-limited. The four recording roles read every type for a patient they are authorized for, with TREAT, ETREAT or HOPERAT. The privacy officer reads any patient's directives with HOPERAT, and marks entered in error with HOPERAT and step-up.

  32. A registered service identity acts with the action code as its scope. It reads with TREAT, ETREAT or HOPERAT, and creates, versions and withdraws with HOPERAT or TREAT. That covers the capturing domains and the patient channel of Domain 7. A service is not limited to some patients: the calling domain is the enforcement point for its own user's relationship to the patient, and every read is audited with its purpose. Payment (HPAYMT) is refused to every caller, because care, claims and statutory reporting rest on legal obligation, not on consent (DEC-ESS-009).
  33. A request without a purpose of use is never permitted (part 13). A read without X-Purpose-Of-Use answers 400; a write without it is denied by the policy.
  34. Every read and write is audited (ess.cns.directive-read, ess.cns.directive).
  35. Directives are enterprise-scoped (architecture 7.5). X-Facility is the provenance facility and the facility the person's authorization is decided for.
  36. An unknown patient is refused with the message of part 10 before the policy decision, because the facility check needs the patient.

Consequences

  • The history of a directive is complete and reconstructable. A decision of FR-ESS-CNS-002 can name the exact version it relied on (DE-ESS-005 consent_directive) and read it with version.
  • Nothing in production validates against the unapproved starter model. Until the privacy officer approves a governed version, recording in production answers 503 and the capturing domains hold "consent capture pending".
  • The ess-governance unit must register the item type ess.consent-model and grant this unit ess.cfg.version.read (follow-up).
  • Every status change bumps the ETag: activation, expiry, a merge. A user who saw an earlier version gets 412 and reloads, so no one acts on a state that has changed.
  • Every directive request by a person reads the patient from Domain 1, so a person's consent requests answer 503 while Domain 1 is unavailable. Service reads, which carry enforcement, do not depend on it.
  • A withdrawal with a future effective time is kept as pending (mod_ess_003.scheduled_withdrawal), and the directive stays Active, in current reads and for other domains, until that time (DEC-ESS-009 point 6, FR-ESS-CNS-002 step 5). The job then writes the Withdrawn version with the provenance of the person who withdrew, effective at the requested time, and publishes ConsentChanged, as it does for activation and expiry. A later request replaces a pending one, an immediate withdrawal cancels it, and a directive no longer Active by then is not withdrawn.
  • Listing by a retired identifier answers nothing after a merge: the directives are held under the survivor. readConsentDirective by identifier answers them under the survivor.
  • The starter policy content enterprise-access version 1 gains the cns-* rules and the resource type before it goes through the configuration lifecycle. Its test pack gains TP-36 to TP-49.

Alternatives considered

  • Updating the status of the prior version in place: simpler reads, but it breaks BR-ESS-013 (versions immutable), and the as-at query would lose the status that was in force.
  • Keeping the consent model in code: it would let unapproved content validate directives in production, against part 13 and CFG-ESS-010.
  • Holding every incomplete directive as Proposed: part 10 refuses a missing legal basis, and an incomplete record made at the panel would be silently kept as a reference.
  • Superseding at once on a new version with a later start: this leaves a gap in which no directive is in force. For a deny directive that widens access.
  • Opening a conflict task from inside the transaction: a failure of the task service would refuse the patient's consent. The task is sent after commit and retried.