{
  "resourceType": "StructureDefinition",
  "url": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-MedicationDispense-1",
  "version": "1.1.0",
  "name": "CareConnect-GPC-MedicationDispense-1",
  "status": "draft",
  "date": "2023-08-04",
  "publisher": "NHS England",
  "description": "Indicates that a medication product is to be or has been dispensed for a named person/patient.",
  "copyright": "Copyright © 2023 NHS England",
  "fhirVersion": "3.0.2",
  "kind": "resource",
  "abstract": false,
  "type": "MedicationDispense",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/MedicationDispense",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "MedicationDispense.identifier",
        "path": "MedicationDispense.identifier",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.identifier.system",
        "path": "MedicationDispense.identifier.system",
        "min": 1
      },
      {
        "id": "MedicationDispense.identifier.value",
        "path": "MedicationDispense.identifier.value",
        "min": 1
      },
      {
        "id": "MedicationDispense.identifier.assigner",
        "path": "MedicationDispense.identifier.assigner",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Organization-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.status",
        "path": "MedicationDispense.status",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.category.coding.system",
        "path": "MedicationDispense.category.coding.system",
        "min": 1
      },
      {
        "id": "MedicationDispense.category.coding.code",
        "path": "MedicationDispense.category.coding.code",
        "min": 1
      },
      {
        "id": "MedicationDispense.medication[x]",
        "path": "MedicationDispense.medication[x]",
        "type": [
          {
            "code": "CodeableConcept"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Medication-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.subject",
        "path": "MedicationDispense.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/Group"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Patient-1"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.subject.identifier.system",
        "path": "MedicationDispense.subject.identifier.system",
        "min": 1,
        "fixedUri": "https://fhir.nhs.uk/Id/nhs-number"
      },
      {
        "id": "MedicationDispense.subject.identifier.value",
        "path": "MedicationDispense.subject.identifier.value",
        "min": 1
      },
      {
        "id": "MedicationDispense.context",
        "path": "MedicationDispense.context",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/EpisodeOfCare"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Encounter-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.performer",
        "path": "MedicationDispense.performer",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.performer.actor",
        "path": "MedicationDispense.performer.actor",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/Device"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-RelatedPerson-1"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Organization-1"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Patient-1"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Practitioner-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.authorizingPrescription",
        "path": "MedicationDispense.authorizingPrescription",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-MedicationRequest-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.type",
        "path": "MedicationDispense.type",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.type.coding.system",
        "path": "MedicationDispense.type.coding.system",
        "min": 1
      },
      {
        "id": "MedicationDispense.type.coding.code",
        "path": "MedicationDispense.type.coding.code",
        "min": 1
      },
      {
        "id": "MedicationDispense.quantity",
        "path": "MedicationDispense.quantity",
        "min": 1
      },
      {
        "id": "MedicationDispense.quantity.value",
        "path": "MedicationDispense.quantity.value",
        "min": 1
      },
      {
        "id": "MedicationDispense.quantity.unit",
        "path": "MedicationDispense.quantity.unit",
        "min": 1
      },
      {
        "id": "MedicationDispense.quantity.system",
        "path": "MedicationDispense.quantity.system",
        "min": 1
      },
      {
        "id": "MedicationDispense.quantity.code",
        "path": "MedicationDispense.quantity.code",
        "min": 1
      },
      {
        "id": "MedicationDispense.daysSupply",
        "path": "MedicationDispense.daysSupply",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.whenPrepared",
        "path": "MedicationDispense.whenPrepared",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.whenHandedOver",
        "path": "MedicationDispense.whenHandedOver",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.destination",
        "path": "MedicationDispense.destination",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Location-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.receiver",
        "path": "MedicationDispense.receiver",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Patient-1"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Practitioner-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.note.author[x]",
        "path": "MedicationDispense.note.author[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://hl7.org/fhir/StructureDefinition/RelatedPerson"
          },
          {
            "code": "string"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Practitioner-1"
          },
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Patient-1"
          }
        ]
      },
      {
        "id": "MedicationDispense.dosageInstruction",
        "path": "MedicationDispense.dosageInstruction",
        "mustSupport": true
      },
      {
        "id": "MedicationDispense.substitution.responsibleParty",
        "path": "MedicationDispense.substitution.responsibleParty",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "https://fhir.nhs.uk/STU3/StructureDefinition/CareConnect-GPC-Practitioner-1"
          }
        ]
      }
    ]
  }
}