Module coordination

Source
Expand description

Care Coordination Repository (CCR) Management.

This module manages care coordination records, focusing on asynchronous clinical communication and task management between clinicians, patients, and other authorised participants.

§Architecture

Like the clinical repository, the coordination repository uses:

  • Type-state pattern for compile-time safety (Uninitialised/Initialised)
  • UUID-based sharded storage for scalability
  • Git-based versioning for all operations
  • Immutable append-only records for audit and legal compliance

§Storage Layout

Coordination records are stored in a sharded structure:

coordination/
  <s1>/
    <s2>/
      <id>/
        COORDINATION_STATUS.yaml    # Links to clinical record
        communications/             # Messaging threads
          <communication_id>/
            ledger.yaml            # Thread metadata and participants
            thread.md              # Thread messages in markdown
        .git/                      # Git repository for versioning

where s1 and s2 are the first four hex characters of the coordination UUID.

Conceptually:

  • a communication is a thread and a ledger file
  • a thread is a list of messages stored in thread.md
  • the ledger contains metadata such as participants, status, policies, and visibility settings.

§Pure Data Operations

This module contains only data operations—no API concerns such as authentication, HTTP/gRPC servers, or service interfaces. API-level logic belongs in api-grpc, api-rest, or api-shared.

Structs§

Communication
Complete thread data (messages + ledger).
CoordinationService
Service for managing coordination repository operations.
CoordinationStatusUpdate
Update to apply to coordination status.
Initialised
Marker type: coordination record exists.
LedgerUpdate
Update to apply to a thread ledger.
MessageContent
Content of a message to be added to a thread.
Uninitialised
Marker type: coordination record does not yet exist.