{
  "resourceType": "StructureDefinition",
  "version": "1.0.0-draft",
  "status": "draft",
  "experimental": false,
  "date": "2026-05-14",
  "publisher": "Longitudinal Record Access (LRA)",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "derivation": "constraint",
  "id": "lra-notification-request-bundle",
  "url": "http://phsa.ca/fhir/StructureDefinition/lra-notification-request-bundle",
  "name": "LRANotificationRequestBundle",
  "title": "LRA Notification Request Bundle",
  "description": "Message Bundle used to submit a notification request from Health Gateway to LRA.",
  "type": "Bundle",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Bundle",
  "differential": {
    "element": [
      {
        "id": "Bundle",
        "path": "Bundle",
        "constraint": [
          {
            "key": "lra-notif-bdl-1",
            "severity": "error",
            "human": "A notification request Bundle SHALL contain exactly one MessageHeader, one CommunicationRequest, one DocumentReference, and one Patient.",
            "expression": "entry.resource.ofType(MessageHeader).count() = 1 and entry.resource.ofType(CommunicationRequest).count() = 1 and entry.resource.ofType(DocumentReference).count() = 1 and entry.resource.ofType(Patient).count() = 1"
          }
        ]
      },
      {
        "id": "Bundle.identifier",
        "path": "Bundle.identifier",
        "short": "Message-level unique identifier for correlation and tracking",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.identifier.system",
        "path": "Bundle.identifier.system",
        "min": 1,
        "max": "1",
        "fixedUri": "https://healthgateway.gov.bc.ca/identifiers/message-bundle",
        "mustSupport": true
      },
      {
        "id": "Bundle.identifier.value",
        "path": "Bundle.identifier.value",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.type",
        "path": "Bundle.type",
        "min": 1,
        "max": "1",
        "fixedCode": "message",
        "mustSupport": true
      },
      {
        "id": "Bundle.timestamp",
        "path": "Bundle.timestamp",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry",
        "path": "Bundle.entry",
        "min": 4,
        "max": "*",
        "mustSupport": true,
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "resource"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "Bundle.entry:messageHeader",
        "path": "Bundle.entry",
        "sliceName": "messageHeader",
        "short": "Notification MessageHeader",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:messageHeader.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:messageHeader.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "MessageHeader",
            "profile": [
              "http://phsa.ca/fhir/StructureDefinition/lra-notification-messageheader"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:communicationRequest",
        "path": "Bundle.entry",
        "sliceName": "communicationRequest",
        "short": "Notification CommunicationRequest",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:communicationRequest.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:communicationRequest.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CommunicationRequest",
            "profile": [
              "http://phsa.ca/fhir/StructureDefinition/lra-notification-communicationrequest"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:documentReference",
        "path": "Bundle.entry",
        "sliceName": "documentReference",
        "short": "Notification DocumentReference",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:documentReference.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:documentReference.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "DocumentReference",
            "profile": [
              "http://phsa.ca/fhir/StructureDefinition/lra-notification-documentreference"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:patient",
        "path": "Bundle.entry",
        "sliceName": "patient",
        "short": "Notification Patient",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:patient.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Bundle.entry:patient.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Patient",
            "profile": [
              "http://phsa.ca/fhir/StructureDefinition/lra-notification-patient"
            ]
          }
        ],
        "mustSupport": true
      }
    ]
  }
}