{
  "resourceType": "StructureDefinition",
  "id": "profile-bundle-medicationdispense",
  "url": "https://fhir.synapxe.sg/StructureDefinition/profile-bundle-medicationdispense",
  "name": "Bundle",
  "title": "Medication Dispense Bundle Profile",
  "status": "active",
  "publisher": "Synapxe",
  "description": "A Bundle of MedicationDispense resources will be used to store one or more medication products to be or has been dispensed for a named person/patient. This includes a description of the medication product (supply) provided and the instructions for administering the medication. The medication dispense is the result of a pharmacy system responding to a medication order.",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "nehr-putDispensedMedications",
      "name": "NEHR XML putDispensedMedications",
      "comment": "Paths are relative to the putDispensedMedications element of the NEHR XML message"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Bundle",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Bundle",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Bundle.meta",
        "path": "Bundle.meta",
        "type": [
          {
            "code": "Meta",
            "profile": [
              "https://fhir.synapxe.sg/StructureDefinition/profile-meta"
            ]
          }
        ],
        "mapping": [
          {
            "identity": "nehr-putDispensedMedications",
            "map": "controlHeader/msgID | controlHeader/msgSequenceID | controlHeader/msgDateTime"
          }
        ]
      },
      {
        "id": "Bundle.meta.source",
        "path": "Bundle.meta.source",
        "mapping": [
          {
            "identity": "nehr-putDispensedMedications",
            "map": "controlHeader/srcApplication"
          }
        ]
      },
      {
        "id": "Bundle.meta.tag.code",
        "path": "Bundle.meta.tag.code",
        "mapping": [
          {
            "identity": "nehr-putDispensedMedications",
            "map": "controlHeader/srcInstitution"
          }
        ]
      },
      {
        "id": "Bundle.identifier.system",
        "path": "Bundle.identifier.system",
        "patternUri": "https://fhir.synapxe.sg/NamingSystem/record-id"
      },
      {
        "id": "Bundle.type",
        "path": "Bundle.type",
        "patternCode": "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": "profile",
              "path": "resource"
            }
          ],
          "rules": "open"
        },
        "min": 1,
        "mapping": [
          {
            "identity": "nehr-putDispensedMedications",
            "map": "medicationDispense/medicationItem"
          }
        ]
      },
      {
        "id": "Bundle.entry.id",
        "path": "Bundle.entry.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry.extension",
        "path": "Bundle.entry.extension",
        "max": "0"
      },
      {
        "id": "Bundle.entry.modifierExtension",
        "path": "Bundle.entry.modifierExtension",
        "max": "0"
      },
      {
        "id": "Bundle.entry.link",
        "path": "Bundle.entry.link",
        "max": "0"
      },
      {
        "id": "Bundle.entry.fullUrl",
        "path": "Bundle.entry.fullUrl",
        "min": 1
      },
      {
        "id": "Bundle.entry.search",
        "path": "Bundle.entry.search",
        "max": "0"
      },
      {
        "id": "Bundle.entry.request.id",
        "path": "Bundle.entry.request.id",
        "max": "0"
      },
      {
        "id": "Bundle.entry.request.extension",
        "path": "Bundle.entry.request.extension",
        "max": "0"
      },
      {
        "id": "Bundle.entry.request.modifierExtension",
        "path": "Bundle.entry.request.modifierExtension",
        "max": "0"
      },
      {
        "id": "Bundle.entry:medicationdispense",
        "path": "Bundle.entry",
        "sliceName": "medicationdispense",
        "min": 1
      },
      {
        "id": "Bundle.entry:medicationdispense.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "Resource",
            "profile": [
              "https://fhir.synapxe.sg/StructureDefinition/profile-medicationdispense"
            ]
          }
        ]
      },
      {
        "id": "Bundle.entry:patient",
        "path": "Bundle.entry",
        "sliceName": "patient",
        "max": "1"
      },
      {
        "id": "Bundle.entry:patient.resource",
        "path": "Bundle.entry.resource",
        "min": 1,
        "type": [
          {
            "code": "Resource",
            "profile": [
              "https://fhir.synapxe.sg/StructureDefinition/profile-patient"
            ]
          }
        ]
      },
      {
        "id": "Bundle.signature",
        "path": "Bundle.signature",
        "max": "0"
      },
      {
        "id": "Bundle.issues",
        "path": "Bundle.issues",
        "max": "0"
      }
    ]
  }
}