{
  "resourceType": "StructureDefinition",
  "id": "EPLabDispenseBundle-ddcfa417-3b25-4d29-94fc-ccc5c5a69c2d",
  "url": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseBundle",
  "version": "1.2.0",
  "name": "EPLabDispenseBundle",
  "status": "active",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "cda",
      "uri": "http://hl7.org/v3/cda",
      "name": "CDA (R2)"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Bundle",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Bundle",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Bundle",
        "path": "Bundle",
        "condition": [
          "val-SameDateLabDisp",
          "val-SameLaboLabDisp"
        ],
        "constraint": [
          {
            "key": "val-SameDateLabDisp",
            "severity": "error",
            "human": "The dates on the prescription shall be coherent",
            "expression": "Bundle.entry.resource.select(ofType(Task).authoredOn|ofType(Encounter).period.start|ofType(Encounter).period.end).distinct().count() = 1",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseBundle"
          },
          {
            "key": "val-SameLaboLabDisp",
            "severity": "error",
            "human": "Labo SHALL be the same",
            "expression": "Bundle.entry.resource.select(ofType(Task).owner.reference|ofType(Encounter).serviceProvider.reference).distinct().count()=1",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseBundle"
          }
        ]
      },
      {
        "id": "Bundle.id",
        "path": "Bundle.id",
        "definition": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.\r\nIs assigned by the server, do not provide a value."
      },
      {
        "id": "Bundle.meta",
        "path": "Bundle.meta",
        "min": 1
      },
      {
        "id": "Bundle.meta.id",
        "path": "Bundle.meta.id",
        "max": "0"
      },
      {
        "id": "Bundle.meta.versionId",
        "path": "Bundle.meta.versionId",
        "max": "0"
      },
      {
        "id": "Bundle.meta.lastUpdated",
        "path": "Bundle.meta.lastUpdated",
        "max": "0"
      },
      {
        "id": "Bundle.meta.source",
        "path": "Bundle.meta.source",
        "max": "0"
      },
      {
        "id": "Bundle.meta.profile",
        "path": "Bundle.meta.profile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseBundle"
      },
      {
        "id": "Bundle.meta.security",
        "path": "Bundle.meta.security",
        "max": "0"
      },
      {
        "id": "Bundle.meta.tag",
        "path": "Bundle.meta.tag",
        "max": "0"
      },
      {
        "id": "Bundle.implicitRules",
        "path": "Bundle.implicitRules",
        "max": "0"
      },
      {
        "id": "Bundle.language",
        "path": "Bundle.language",
        "max": "0"
      },
      {
        "id": "Bundle.identifier",
        "path": "Bundle.identifier",
        "max": "0"
      },
      {
        "id": "Bundle.type",
        "path": "Bundle.type",
        "definition": "Only transaction",
        "fixedCode": "transaction"
      },
      {
        "id": "Bundle.timestamp",
        "path": "Bundle.timestamp",
        "max": "0"
      },
      {
        "id": "Bundle.total",
        "path": "Bundle.total",
        "max": "0"
      },
      {
        "id": "Bundle.link",
        "path": "Bundle.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry",
        "path": "Bundle.entry",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "resource.meta.profile"
            }
          ],
          "rules": "closed"
        },
        "min": 3
      },
      {
        "id": "Bundle.entry:dispensation",
        "path": "Bundle.entry",
        "sliceName": "dispensation",
        "short": "The dispensation",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:dispensation.id",
        "path": "Bundle.entry.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.link",
        "path": "Bundle.entry.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "short": "UUID of the resource",
        "definition": "This is a UUID to identify the element inside the Bundle.\r\nIt SHALL start with urn:uuid: and then an UUID version 4 randomly generated. Its scope is only the Bundle, it is not linked outside from it and not saved.",
        "min": 1,
        "example": [
          {
            "label": "Valid example",
            "valueUri": "urn:uuid:d00069b7-1fc8-4397-bc7c-c9571319d890"
          }
        ],
        "condition": [
          "val-uuid"
        ],
        "constraint": [
          {
            "key": "val-uuid",
            "severity": "error",
            "human": "SHALL be a v4 UUID prefixed by urn:uuid:",
            "expression": "startsWith('urn:uuid:') and length()=45",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseBundle"
          }
        ]
      },
      {
        "id": "Bundle.entry:dispensation.resource",
        "path": "Bundle.entry.resource",
        "short": "The dispensation",
        "min": 1,
        "type": [
          {
            "code": "Encounter",
            "profile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispense"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:dispensation.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.request",
        "path": "Bundle.entry.request",
        "min": 1
      },
      {
        "id": "Bundle.entry:dispensation.request.id",
        "path": "Bundle.entry.request.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.request.method",
        "path": "Bundle.entry.request.method",
        "definition": "Only POST",
        "fixedCode": "POST"
      },
      {
        "id": "Bundle.entry:dispensation.request.url",
        "path": "Bundle.entry.request.url",
        "short": "Fixed value",
        "fixedUri": "Encounter"
      },
      {
        "id": "Bundle.entry:dispensation.request.ifNoneMatch",
        "path": "Bundle.entry.request.ifNoneMatch",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.request.ifModifiedSince",
        "path": "Bundle.entry.request.ifModifiedSince",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.request.ifMatch",
        "path": "Bundle.entry.request.ifMatch",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.request.ifNoneExist",
        "path": "Bundle.entry.request.ifNoneExist",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensation.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine",
        "path": "Bundle.entry",
        "sliceName": "dispensationLine",
        "short": "Dispensation lines",
        "min": 1,
        "max": "*"
      },
      {
        "id": "Bundle.entry:dispensationLine.id",
        "path": "Bundle.entry.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.link",
        "path": "Bundle.entry.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "short": "UUID of the resource",
        "definition": "This is a UUID to identify the element inside the Bundle.\r\nIt SHALL start with urn:uuid: and then an UUID version 4 randomly generated. Its scope is only the Bundle, it is not linked outside from it and not saved.",
        "comment": ".",
        "min": 1,
        "condition": [
          "val-uuid"
        ],
        "constraint": [
          {
            "key": "val-uuid",
            "severity": "error",
            "human": "SHALL be a v4 UUID prefixed by urn:uuid:",
            "expression": "startsWith('urn:uuid:') and length()=45",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseBundle"
          }
        ]
      },
      {
        "id": "Bundle.entry:dispensationLine.resource",
        "path": "Bundle.entry.resource",
        "short": "Dispensation line",
        "min": 1,
        "type": [
          {
            "code": "Task",
            "profile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseLine"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:dispensationLine.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.request",
        "path": "Bundle.entry.request",
        "min": 1
      },
      {
        "id": "Bundle.entry:dispensationLine.request.id",
        "path": "Bundle.entry.request.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.request.method",
        "path": "Bundle.entry.request.method",
        "definition": "Always POST",
        "fixedCode": "POST"
      },
      {
        "id": "Bundle.entry:dispensationLine.request.url",
        "path": "Bundle.entry.request.url",
        "short": "Fixed value",
        "fixedUri": "Task"
      },
      {
        "id": "Bundle.entry:dispensationLine.request.ifNoneMatch",
        "path": "Bundle.entry.request.ifNoneMatch",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.request.ifModifiedSince",
        "path": "Bundle.entry.request.ifModifiedSince",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.request.ifMatch",
        "path": "Bundle.entry.request.ifMatch",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.request.ifNoneExist",
        "path": "Bundle.entry.request.ifNoneExist",
        "max": "0"
      },
      {
        "id": "Bundle.entry:dispensationLine.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient",
        "path": "Bundle.entry",
        "sliceName": "patient",
        "short": "The patient",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Bundle.entry:patient.id",
        "path": "Bundle.entry.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.link",
        "path": "Bundle.entry.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "short": "UUID of the resource",
        "definition": "This is a UUID to identify the element inside the Bundle.\r\nIt SHALL start with urn:uuid: and then an UUID version 4 randomly generated. Its scope is only the Bundle, it is not linked outside from it and not saved.",
        "min": 1,
        "example": [
          {
            "label": "Valid example",
            "valueUri": "urn:uuid:d00069b7-1fc8-4397-bc7c-c9571319d890"
          }
        ],
        "condition": [
          "val-uuid"
        ],
        "constraint": [
          {
            "key": "val-uuid",
            "severity": "error",
            "human": "SHALL be a v4 UUID prefixed by urn:uuid:",
            "expression": "startsWith('urn:uuid:') and length()=45",
            "source": "https://www.esante.lu/fhir-spec/StructureDefinition/EPLabDispenseBundle"
          }
        ]
      },
      {
        "id": "Bundle.entry:patient.resource",
        "path": "Bundle.entry.resource",
        "short": "The patient",
        "min": 1,
        "type": [
          {
            "code": "Patient",
            "profile": [
              "https://www.esante.lu/fhir-spec/StructureDefinition/EPPatient"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:patient.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.request",
        "path": "Bundle.entry.request",
        "min": 1
      },
      {
        "id": "Bundle.entry:patient.request.id",
        "path": "Bundle.entry.request.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.request.method",
        "path": "Bundle.entry.request.method",
        "definition": "Constant",
        "fixedCode": "POST"
      },
      {
        "id": "Bundle.entry:patient.request.url",
        "path": "Bundle.entry.request.url",
        "short": "Constant",
        "fixedUri": "Patient"
      },
      {
        "id": "Bundle.entry:patient.request.ifNoneMatch",
        "path": "Bundle.entry.request.ifNoneMatch",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.request.ifModifiedSince",
        "path": "Bundle.entry.request.ifModifiedSince",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.request.ifMatch",
        "path": "Bundle.entry.request.ifMatch",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.request.ifNoneExist",
        "path": "Bundle.entry.request.ifNoneExist",
        "max": "0"
      },
      {
        "id": "Bundle.entry:patient.response",
        "path": "Bundle.entry.response",
        "max": "0"
      },
      {
        "id": "Bundle.signature",
        "path": "Bundle.signature",
        "max": "0"
      }
    ]
  }
}