MOD ISE 004 EVT
Domain specifications / D02-ISE / 5. Detailed Functional Requirements / 5.4 Module Specification: Event Backbone and Offline Edge
5.4 Module Specification: Event Backbone and Offline Edge¶
5.4.1 Module Overview¶
Module ID: MOD-ISE-004
Purpose: Provide durable asynchronous distribution of domain events with defined delivery guarantees, the supporting outbox/inbox pattern, authorized notifications to external consumers and the synchronization mechanism for offline-tolerant bedside clients.
Business Capabilities: - CAP-ISE-006 Durable event backbone - CAP-ISE-007 Offline edge synchronization
Primary Actors: - Domain Service Team (ACT-ISE-008) - Workload (ACT-ISE-010) - Integration Operations Analyst (ACT-ISE-003) - Bedside Mobile Client (ACT-ISE-013)
Dependencies: - MOD-ISE-001 (durable storage), MOD-ISE-006 (credentials, encryption), MOD-ISE-002 (external delivery) - Domain 10 (ESS) authorization; Domain 3 (CLI) and Domain 4 (ANC) services as owners of offline-capable workflows
5.4.2 Functional Areas¶
Functional Area ID: FA-ISE-009 Event backbone and delivery guarantees
Description: Durable topics, the standard event envelope, schema validation, ordering, retry, dead-letter, replay and reconciliation.
Scope: - Included: the backbone, envelope standard, schema registry, producer and consumer libraries or patterns for outbox/inbox. - Excluded: definition of the domain events themselves, which belong to the source domains.
Functional Area ID: FA-ISE-010 External notification and offline edge synchronization
Description: Authorized push notification to external consumers and the cache-and-sync mechanism for bedside clients.
Scope: - Included: subscription registration, delivery and revocation; encrypted cache, expiry, revocation, sync protocol, commit-state signalling. - Excluded: the clinical decision of which actions are safe offline, and conflict resolution rules, which belong to the owning clinical domains.
5.4.3 Detailed Requirements¶
Requirement FR-ISE-EVT-001: Durable, Broker-Independent Event Backbone¶
| Attribute | Description |
|---|---|
| Requirement ID | FR-ISE-EVT-001 |
| Requirement Name | Durable, broker-independent event backbone |
| Requirement Type | Functional |
| Module | Event Backbone and Offline Edge |
| Functional Area | FA-ISE-009 Event backbone and delivery guarantees |
| Priority | Must |
| Criticality | Critical |
| Requirement Status | Draft |
| Source | INF-001, INF-004; NFR-003; PRS section 8.2; contributes to RCM-003 (primary Domain 5) |
| Related Business Rule | BR-ISE-009 |
| Related Workflow | WF-ISE-003, WF-ISE-006 |
1. Requirement Statement
The system shall provide a durable asynchronous event backbone for domain events that is independent of any single broker product, and shall ensure that outages of secondary consumers such as billing, analytics and registries do not block critical bedside transactions.
2. Business Rationale
Asynchronous distribution decouples clinical writes from downstream processing. Independence from a broker product preserves the organization's ability to replace it.
3. Actors and Permissions
| Actor | Permission | Conditions |
|---|---|---|
| Workload (producer) | Publish to topics it owns | Authenticated; schema registered |
| Workload (consumer) | Subscribe to topics it is authorized for | Authorization from Domain 10; data classification respected |
| Platform Engineer / SRE | Create / Update topics, retention and capacity | Reviewed change |
| Integration Operations Analyst | Read lag and dead-letter; controlled replay |
4. Preconditions - The topic and its event schema are registered with an owning domain.
5. Trigger - A domain service commits a state change and writes an outbox record.
6. Functional Behaviour
- The backbone shall store published events durably across independent failure domains for Tier 1 topics before confirming publication.
- Producers shall publish through a transactional outbox so that business state and the outgoing event are committed together; a relay publishes the event.
- The producing transaction shall complete without waiting for any consumer.
- The backbone shall retain events for the topic's configured retention period and shall allow each consumer to resume from its own position after an outage.
- The backbone shall be accessed through a platform-defined abstraction so that the broker can be replaced without changing domain event semantics or losing retained events.
- The backbone shall isolate consumers so that a slow or failed consumer does not delay others.
- The backbone shall measure end-to-end propagation latency for critical ADT, order and result events and consumer lag for all subscriptions.
7. Input Requirements
| Input Field | Data Type | Mandatory | Validation | Description |
|---|---|---|---|---|
| Topic | Reference | Yes | Registered; producer is owner | Destination |
| Event envelope | Structured | Yes | FR-ISE-EVT-002 | Standard metadata |
| Payload or payload reference | Per schema | Yes | Schema validation | Business content |
8. Processing Rules
| Rule ID | Processing Rule | Expected Result |
|---|---|---|
| PR-EVT-001-1 | Consumer unavailable | Events retained; producer unaffected; lag alert |
| PR-EVT-001-2 | Publication by a non-owner | Refused |
| PR-EVT-001-3 | Backbone unavailable to the relay | Events remain in the outbox and are published on recovery in commit order |
9. Output Requirements
| Output | Format | Recipient | Description |
|---|---|---|---|
| Delivered event | Envelope plus payload | Authorized consumers | At-least-once |
| Lag and latency metrics | Metric | MOD-ISE-008 | Per topic and subscription |
10. Validation and Error Handling
| Scenario | Validation | System Response | User Message / Action |
|---|---|---|---|
| Retention about to expire with an unconsumed backlog | Lag versus retention | High-severity alert before loss | Extend retention or restore consumer |
| Storage pressure | Capacity threshold | Alert; lower-tier topics throttled first | Capacity action |
11. State and Lifecycle Behaviour
Topics are Proposed, Active, Deprecated or Retired. Retired topics retain events until retention expires.
12. Audit Requirements
Topic creation, ownership, retention and access changes are audited. Access to topics classified Sensitive is recorded per subscription.
13. Security and Privacy Requirements
Producers and consumers authenticate as workloads; topic access is least-privilege; events are encrypted in transit and at rest. Payload references are preferred over embedding sensitive content where the consumer can fetch through an authorized API.
14. Acceptance Criteria
- AC-01: Given a broker replacement exercise, when the broker is replaced, then domain event semantics are unchanged and retained events are not lost (INF-001).
- AC-02: Given failure injection on billing, analytics and registry consumers, when bedside transactions are performed, then they complete normally (INF-004).
- AC-03: Given critical ADT, order and result events within the enterprise network, when latency is measured, then p95 end-to-end propagation is under 5 seconds or the approved revised target (NFR-003, proposed baseline).
- AC-04: Given a consumer outage, when the consumer returns, then it receives every event published during the outage.
15. Dependencies and Integration
- Upstream dependencies: producing domain services (outbox).
- Downstream dependencies: all consuming domains; Domain 8 (ANL) ingestion; Domain 5 (FIN) charge capture.
- Required events or APIs: IF-ISE-002.
16. Open Questions / Assumptions
- The event platform implementation is an open PRS decision (PRS section 28.1; DEC-ISE-003). Retention periods are not given in the sources; broker topics keep 7 days and the domain event archive 2 years, per the enterprise retention baseline (CFG-ISE-009).
Requirement FR-ISE-EVT-002: Event Contract, Ordering, Dead-Letter and Replay¶
| Attribute | Description |
|---|---|
| Requirement ID | FR-ISE-EVT-002 |
| Requirement Name | Event contract, ordering, dead-letter and replay |
| Requirement Type | Functional |
| Module | Event Backbone and Offline Edge |
| Functional Area | FA-ISE-009 Event backbone and delivery guarantees |
| Priority | Must |
| Criticality | Critical |
| Requirement Status | Draft |
| Source | INF-002, INF-003; PRS section 8.2; contributes to SAFE-004 and DAT-004 |
| Related Business Rule | BR-ISE-005, BR-ISE-006, BR-ISE-008 |
| Related Workflow | WF-ISE-003 |
1. Requirement Statement
The system shall require every domain event to be versioned, timestamped, uniquely identified, schema-validated and idempotently consumable, shall preserve ordering where business correctness requires it, and shall provide retry, dead-letter, replay and reconciliation for event consumption.
2. Business Rationale
Consumers can only be made safe against duplicates, reordering and schema change if every event carries the same minimum metadata and the backbone enforces it.
3. Actors and Permissions
| Actor | Permission | Conditions |
|---|---|---|
| Domain Service Team | Create / Update event schemas for own events | Compatibility check must pass |
| Integration Operations Analyst | Replay from dead-letter or from a retained position | Controls of FR-ISE-INT-005 apply |
| Workload (consumer) | Acknowledge / reject events |
4. Preconditions - Schema registered in the catalogue (FR-ISE-GWY-002).
5. Trigger - Event publication; consumption failure; operator replay.
6. Functional Behaviour
- The backbone shall reject events whose envelope lacks: event identifier, event type, schema version, aggregate identifier, facility context, occurred-at time, recorded-at time, producer, correlation identifier and causation identifier.
- The backbone shall validate the payload against the registered schema version at publication.
- Schema evolution shall be checked for compatibility; consumers of an older compatible version shall continue to work.
- Events sharing an ordering key (for example the same patient or order) shall be delivered to a consumer in publication order.
- Consumers shall record an inbox or deduplication marker keyed on the event identifier before applying side effects; the platform shall provide the supporting pattern.
- A consumer failure shall be retried with bounded attempts; on exhaustion the event shall move to a per-subscription dead-letter queue without blocking unrelated ordering keys.
- Replay from dead-letter or from a retained position shall be operator-controlled and subject to the replay-sensitive controls.
- The backbone shall provide per-subscription counts of published, delivered, acknowledged and dead-lettered events for reconciliation. The counts can be grouped by event type, facility and day. Domain 5 uses these counts for its subscriptions to charge-bearing events to reconcile them with the charges it posted for the same day.
7. Input Requirements
| Input Field | Data Type | Mandatory | Validation | Description |
|---|---|---|---|---|
| event_id | Unique identifier | Yes | Globally unique | Deduplication key |
| event_type, schema_version | String | Yes | Registered | Contract identity |
| aggregate_id | String | Yes | Present | Ordering and correlation |
| facility context | Reference | Yes | Known facility | Tenant/facility |
| occurred_at, recorded_at | UTC timestamp | Yes | Valid; recorded_at not earlier than platform tolerance allows | Event and record time |
| producer | Reference | Yes | Equals authenticated workload | Source |
| correlation_id, causation_id | String | Yes | Present | Trace |
| actor / purpose context | Structured | Where applicable | Per schema | Accountability |
| payload or payload reference | Per schema | Yes | Schema validation | Content |
8. Processing Rules
| Rule ID | Processing Rule | Expected Result |
|---|---|---|
| PR-EVT-002-1 | Envelope or schema validation fails at publication | Publication rejected; producer outbox item flagged |
| PR-EVT-002-2 | Redelivery of an event already marked in the consumer inbox | Acknowledged; no side effect |
| PR-EVT-002-3 | Event arrives out of order for its key | Held or rejected for retry so that order is restored; controlled outcome recorded |
| PR-EVT-002-4 | Incompatible schema change | Registration refused; new event type or major version required |
9. Output Requirements
| Output | Format | Recipient | Description |
|---|---|---|---|
| Validated event | Standard envelope | Consumers | |
| Dead-letter record | Structured | Integration operations; owning consumer team | Event, reason, attempts |
| Subscription reconciliation counts | Report and API | Consumer owner; Domain 5 billing reconciliation | Published versus acknowledged, by subscription, event type, facility and day |
10. Validation and Error Handling
| Scenario | Validation | System Response | User Message / Action |
|---|---|---|---|
| Producer identity differs from envelope producer | Identity check | Rejected; security event | Investigate |
| Poison event repeatedly failing | Attempt limit | Dead-lettered; later events for other keys proceed | Owner corrects consumer and replays |
11. State and Lifecycle Behaviour
Event schemas are Draft, Active, Deprecated or Retired. Events are immutable once published; corrections are new events.
12. Audit Requirements
Schema registrations, replays and dead-letter closures are audited with actor, reason and scope.
13. Security and Privacy Requirements
The envelope carries no clinical content beyond identifiers. Actor and purpose context support downstream audit by the consuming domain.
14. Acceptance Criteria
- AC-01: Given replay, duplicate delivery and schema evolution tests, when executed, then they pass (INF-002).
- AC-02: Given out-of-order delivery and consumer outage tests, when executed, then outcomes are controlled: no misordered application and no loss (INF-003).
- AC-03: Given an event missing its event identifier or schema version, when published, then it is rejected.
- AC-04: Given a consumer that fails on one event, when retries are exhausted, then the event is dead-lettered and events for other ordering keys continue.
15. Dependencies and Integration
- Upstream dependencies: FR-ISE-GWY-002 catalogue; producing domains.
- Downstream dependencies: all consuming domains.
- Required events or APIs: IF-ISE-002; EVT-ISE-002, EVT-ISE-018.
16. Open Questions / Assumptions
- The envelope field list follows REF-003 section 5.2, which states it as "should"; this document makes it mandatory as the working position (ASM-ISE-004).
Requirement FR-ISE-EVT-003: Authorized Notifications to External Consumers¶
| Attribute | Description |
|---|---|
| Requirement ID | FR-ISE-EVT-003 |
| Requirement Name | Authorized notifications to external consumers |
| Requirement Type | Functional |
| Module | Event Backbone and Offline Edge |
| Functional Area | FA-ISE-010 External notification and offline edge synchronization |
| Priority | Should |
| Criticality | Medium |
| Requirement Status | Draft |
| Source | INF-005 |
| Related Business Rule | BR-ISE-001, BR-ISE-005 |
| Related Workflow | WF-ISE-001 |
1. Requirement Statement
The system should support FHIR Subscriptions or an equivalent authorized notification mechanism through which registered external consumers are notified of changes they are entitled to receive, with delivery retry and revocation.
2. Business Rationale
External consumers need timely notice of changes without polling, under the same authorization and consent controls as pull access.
3. Actors and Permissions
| Actor | Permission | Conditions |
|---|---|---|
| External Partner System / Third-Party Application | Create / Delete own subscriptions | Registered client; scopes cover the subscription topic |
| Integration Engineer | Read / Suspend / Delete subscriptions | |
| Security and privacy office | Approve subscription topics available externally |
4. Preconditions - The client is registered and Active; the subscription topic is approved for external use.
5. Trigger - A domain event matching an active subscription.
6. Functional Behaviour
- The platform shall let an authorized client register a subscription with topic, filter criteria and delivery endpoint.
- The platform shall authorize each subscription at creation and re-check authorization and consent at each delivery.
- Notifications shall be delivered over authenticated, encrypted channels through the partner gateway.
- Failed deliveries shall be retried with backoff; after exhaustion the subscription shall be marked in error and the client informed through its registered contact.
- Revocation of the client's authorization or of the subscription shall stop delivery.
- Notification content shall be minimized to what the subscription's scope permits; fuller content is fetched through the authorized API.
7. Input Requirements
| Input Field | Data Type | Mandatory | Validation | Description |
|---|---|---|---|---|
| Subscription topic and criteria | Structured | Yes | Topic approved; criteria within scope | What to notify |
| Delivery endpoint | Address | Yes | Registered endpoint of the client | Where to notify |
| Client credential | Opaque | Yes | Valid | Authorization |
8. Processing Rules
| Rule ID | Processing Rule | Expected Result |
|---|---|---|
| PR-EVT-003-1 | Authorization or consent no longer valid at delivery time | Notification not sent; subscription suspended |
| PR-EVT-003-2 | Delivery attempts exhausted | Subscription set to error; no silent drop |
9. Output Requirements
| Output | Format | Recipient | Description |
|---|---|---|---|
| Notification | Per subscription mechanism | External consumer | Minimal content |
| Subscription status | Structured | Client; integration operations | Active, Error, Suspended, Revoked |
10. Validation and Error Handling
| Scenario | Validation | System Response | User Message / Action |
|---|---|---|---|
| Endpoint not registered for the client | Registry check | Subscription refused | Register endpoint |
| Criteria exceed granted scope | Scope check | Subscription refused | Narrow criteria |
11. State and Lifecycle Behaviour
Subscriptions are Requested, Active, Error, Suspended or Revoked.
12. Audit Requirements
Subscription creation, each delivery (client, topic, patient reference where applicable, outcome) and revocation are recorded.
13. Security and Privacy Requirements
As for FR-ISE-GWY-003; redaction decisions apply to notification content.
14. Acceptance Criteria
- AC-01: Given an authorized client, when a matching change occurs, then a notification is delivered.
- AC-02: Given a failing endpoint, when delivery fails, then it is retried and the subscription enters error after the configured attempts.
- AC-03: Given a revoked authorization, when a matching change occurs, then no notification is sent (INF-005).
15. Dependencies and Integration
- Upstream dependencies: FR-ISE-EVT-001; Domain 10 authorization and consent.
- Downstream dependencies: external consumers.
- Required events or APIs: IF-ISE-010.
16. Open Questions / Assumptions
- Whether FHIR Subscriptions or an equivalent mechanism is used depends on the FHIR profile decision (DEC-ISE-004).
Requirement FR-ISE-EVT-004: Offline Edge Cache and Synchronization¶
| Attribute | Description |
|---|---|
| Requirement ID | FR-ISE-EVT-004 |
| Requirement Name | Offline edge cache and synchronization |
| Requirement Type | Functional |
| Module | Event Backbone and Offline Edge |
| Functional Area | FA-ISE-010 External notification and offline edge synchronization |
| Priority | Must (INF-007, INF-008); Should for the cache capability itself (INF-006) |
| Criticality | Critical |
| Requirement Status | Draft |
| Source | INF-006, INF-007, INF-008; PRS section 28 (offline bedside caution); contributes to MED-008 (primary Domain 3) |
| Related Business Rule | BR-ISE-005, BR-ISE-010 |
| Related Workflow | WF-ISE-009 |
1. Requirement Statement
Where offline bedside workflows are enabled, the system shall cache only the minimum necessary roster, scheduled context and scoped credentials in encrypted local storage that expires and is remotely revocable, shall permit locally only the actions on the approved offline action list, shall reconcile them centrally with defined conflict handling, and shall never present a transaction as centrally committed until synchronization and server acknowledgement are complete.
2. Business Rationale
Wireless dead zones should not stop bedside verification, but offline operation is a high-risk design area: stale data, duplicate administration and false confidence in an unsaved record are patient-safety hazards.
3. Actors and Permissions
| Actor | Permission | Conditions |
|---|---|---|
| Bedside Mobile Client (clinical user) | Create offline actions of permitted types | Enrolled device; unexpired, unrevoked cache; user authenticated before going offline |
| Network and Endpoint Administrator | Enrol / Revoke / Wipe devices | Device-loss policy |
| Clinical governance committee | Approve offline action list and stale-data limits | |
| Owning domain user | Resolve conflicts | In the owning domain's worklist |
4. Preconditions - Offline scope, stale-data limits, token expiry, device-loss handling, conflict resolution and emergency exceptions are defined and approved before enabling offline medication or transfusion workflows (PRS section 28).
5. Trigger - Loss of connectivity on an enrolled client; restoration of connectivity.
6. Functional Behaviour
- The client shall cache only the roster, scheduled context and scoped credentials needed for the user's assigned patients and shift, in encrypted local storage.
- The cache shall carry a generation time and an expiry; expired content shall not be usable for offline validation.
- The platform shall be able to revoke a device's cache and credentials remotely where connectivity permits and shall wipe the cache under the device-loss policy.
- The client shall allow offline only the action types on the approved list and shall refuse others with direction to the downtime procedure.
- Each offline action shall be recorded with a client-generated unique identifier, user, device, device time, last synchronized clock offset and cache version.
- The client shall display three distinct states for every such action: locally recorded, pending sync and centrally committed.
- On reconnection the synchronization service shall submit actions in recorded order to the owning domain service using the client identifier as idempotency key.
- The owning domain service shall decide commit, duplicate or conflict; conflicts shall not be auto-applied and shall be visible to the user and on the owning domain's reconciliation worklist.
- Offline audit entries shall be transferred with the actions so that no audit record is lost.
- The platform shall report, per period, offline actions recorded, committed, conflicted and exceptioned.
7. Input Requirements
| Input Field | Data Type | Mandatory | Validation | Description |
|---|---|---|---|---|
| Client action identifier | Unique identifier | Yes | Unique per device | Idempotency key |
| Action type | Code | Yes | On approved offline list | Permitted action |
| User and device identity | References | Yes | Device enrolled; credential in scope and unexpired | Accountability |
| Device time and clock offset | Timestamp / duration | Yes | Present | Time attribution |
| Cache version and generation time | String / timestamp | Yes | Not expired at time of action | Staleness evidence |
| Action payload | Per owning domain contract | Yes | Local validation rules supplied by owning domain | Business content |
8. Processing Rules
| Rule ID | Processing Rule | Expected Result |
|---|---|---|
| PR-EVT-004-1 | Action attempted with an expired cache | Refused locally |
| PR-EVT-004-2 | Same client action identifier submitted twice | Second treated as duplicate; no second effect |
| PR-EVT-004-3 | Owning domain returns conflict | State Conflict; not applied; worklist item created |
| PR-EVT-004-4 | No server acknowledgement received | State remains Pending Sync |
9. Output Requirements
| Output | Format | Recipient | Description |
|---|---|---|---|
| Synchronization result per action | Structured | Client; owning domain | Committed, duplicate or conflict |
| Offline reconciliation report | Report | Clinical governance; Domain 8 | Recorded, committed, conflicted, exceptioned |
| Commit-state indicator | UI state | Clinical user | Three distinct states |
10. Validation and Error Handling
| Scenario | Validation | System Response | User Message / Action |
|---|---|---|---|
| Device reported lost | Device status | Credentials revoked; cache wiped on next contact or by local policy | Administrator action recorded |
| Device clock implausible | Offset check at sync | Actions flagged for time review by owning domain | Not silently corrected |
| Sync interrupted | Acknowledgement tracking | Unacknowledged actions stay pending and are resubmitted | No duplicate effect |
11. State and Lifecycle Behaviour
Offline action states: Locally Recorded, Pending Sync, Centrally Committed, Conflict, Exceptioned (section 4.3). The cache is Valid, Expired or Revoked.
12. Audit Requirements
Cache issue, expiry, revocation and wipe; every offline action with user, device, times and cache version; every synchronization result and conflict resolution.
13. Security and Privacy Requirements
The cache is Sensitive and encrypted with device-bound keys; it holds the minimum necessary data; credentials are scoped and short-lived. Mobile workflows are supported only where device security, patient identification, offline behaviour and clinical usability are validated (PRS section 11.3).
14. Acceptance Criteria
- AC-01: Given a Wi-Fi outage simulation, when permitted actions are recorded offline and synchronized, then there is no unsafe duplicate administration and no lost audit (INF-007).
- AC-02: Given an offline action, when it has not been acknowledged by the server, then the UI shows it as locally recorded or pending sync and never as committed (INF-008).
- AC-03: Given a cache past its expiry, when an offline action is attempted, then it is refused; and given a lost device, when the policy is applied, then the cache is wiped (INF-006).
- AC-04: Given a period of offline use, when the reconciliation report is produced, then 100% of offline actions are reconciled or explicitly exceptioned (PRS section 27, proposed scorecard target).
15. Dependencies and Integration
- Upstream dependencies: Domain 10 (scoped credentials); device enrolment (MOD-ISE-007).
- Downstream dependencies: Domain 3 (CLI) eMAR and bedside workflows; Domain 4 (ANC) specimen collection and blood product verification where enabled.
- Required events or APIs: IF-ISE-008; EVT-ISE-014.
16. Open Questions / Assumptions
- Which medication and specimen workflows may operate offline is an open PRS decision (PRS section 28.1; DEC-ISE-006). Cache expiry is not given in the sources (CFG-ISE-010).
← 5.3 Module Specification: Integration Engine and Standards Exchange | Contents | Identifier index | 5.5 Module Specification: Infrastructure-as-Code, CI/CD and Release →