description: This profile defines the NHS England constraints and extensions on the International FHIR resource [MedicationDispense](https://hl7.org/fhir/R4/medicationdispense.html). package_name: uk.nhsdigital.r4.test derivation: constraint name: NHSDigitalMedicationDispense type: MedicationDispense elements: category: elements: coding: elements: system: {index: 18} code: {index: 19} required: [system, code] whenHandedOver: {mustSupport: true, index: 50} whenPrepared: {mustSupport: true, index: 49} medicationCodeableConcept: {type: CodeableConcept, mustSupport: true, choiceOf: medication, index: 22} type: binding: {strength: required, valueSet: 'https://fhir.nhs.uk/ValueSet/DM-medicationdispense-type'} mustSupport: true index: 39 elements: coding: elements: system: {index: 40} code: {index: 41} required: [system, code] statusReason: mustSupport: true choices: [statusReasonCodeableConcept] index: 9 statusReasonCodeableConcept: {type: CodeableConcept, mustSupport: true, choiceOf: statusReason, index: 10} extension: type: Extension short: This is the non dispensing reason for the overall prescription mustSupport: true url: https://fhir.nhs.uk/StructureDefinition/Extension-DM-PrescriptionNonDispensingReason index: 0 slicing: slices: prescriptionNonDispensingReason: match: {} schema: {type: Extension, short: This is the non dispensing reason for the overall prescription, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-PrescriptionNonDispensingReason', index: 0} max: 1 prescriptionStatus: match: {} schema: {type: Extension, isModifier: false, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-TaskBusinessStatus', index: 1} repeatInformation: match: {} schema: {type: Extension, short: Repeat Prescribing and Dispensing, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-RepeatInformation', index: 2} max: 1 supplyHeaderIdentifier: match: {} schema: {type: Extension, short: Identifier for the SupplyHeader, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-SupplyHeaderIdentifier', index: 3} max: 1 status: {mustSupport: true, index: 7} statusReason[x]: elements: coding: index: 11 elements: system: {index: 12} code: {index: 13} required: [system, code] slicing: rules: open discriminator: - {path: system, type: value} min: 1 slices: notDispensedStatusReason: match: {system: 'https://fhir.nhs.uk/CodeSystem/medicationdispense-status-reason'} schema: binding: {strength: required, valueSet: 'https://fhir.nhs.uk/ValueSet/DM-medicationdispense-status-reason'} mustSupport: true index: 14 elements: system: pattern: {type: Uri, value: 'https://fhir.nhs.uk/CodeSystem/medicationdispense-status-reason'} index: 15 amendmentStatusReason: match: {system: 'https://fhir.nhs.uk/CodeSystem/EPS-task-dispense-withdraw-reason'} schema: binding: {strength: required, valueSet: 'https://fhir.nhs.uk/ValueSet/DM-task-reason-code'} mustSupport: true index: 16 elements: system: pattern: {type: Uri, value: 'https://fhir.nhs.uk/CodeSystem/EPS-task-dispense-withdraw-reason'} index: 17 required: [coding] dosageInstruction: {type: Dosage, mustSupport: true, index: 52} daysSupply: {mustSupport: true, index: 48} identifier: mustSupport: true index: 4 elements: system: {index: 5} value: {index: 6} required: [value, system] context: type: Reference refers: ['https://fhir.hl7.org.uk/StructureDefinition/UKCore-EpisodeOfCare', 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-Encounter'] index: 27 medicationReference: type: Reference mustSupport: true choiceOf: medication refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense-Medication'] index: 23 quantity: mustSupport: true index: 42 extensions: runningTotal: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal', max: 1, type: Extension, index: 43} elements: extension: type: Extension url: https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal index: 43 slicing: slices: runningTotal: match: {} schema: {type: Extension, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal', index: 43} max: 1 value: {index: 44} unit: {index: 45} system: {index: 46} code: {index: 47} required: [value, unit, system, code] location: type: Reference refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-Location'] index: 33 elements: identifier: elements: system: {index: 34} value: {index: 35} required: [value, system] display: {index: 36} required: [display] authorizingPrescription: type: Reference mustSupport: true refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationRequest-Minimal'] index: 37 elements: reference: {index: 38} required: [reference] receiver: {index: 51} subject: type: Reference constraint: eps-2: {human: subject - An identifier reference or resource reference must be provided, severity: warning, expression: (reference.exists() or (identifier.exists()))} patient-nhs: {human: Length of the supplied NHS Number is wrong., severity: error, expression: 'identifier.where(system=''https://fhir.nhs.uk/Id/nhs-number'').exists().not() or (identifier.where(system=''https://fhir.nhs.uk/Id/nhs-number'').exists() and identifier.where(system=''https://fhir.nhs.uk/Id/nhs-number'').value.matches(''^([0-9]{10})$''))'} mustSupport: true refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-Patient-PDS'] index: 24 elements: identifier: elements: system: pattern: {type: Uri, value: 'https://fhir.nhs.uk/Id/nhs-number'} index: 25 value: {index: 26} required: [value, system] performer: mustSupport: true index: 28 elements: actor: type: Reference constraint: performer: {human: An identifier reference or resource reference must be provided, severity: error, expression: (reference.exists() or identifier.exists())} refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-PractitionerRole-SDS'] index: 29 elements: reference: {index: 30} identifier: elements: system: {index: 31} value: {index: 32} required: [value, system] required: [reference] medication: mustSupport: true choices: [medicationCodeableConcept, medicationReference] index: 21 package_version: 2.16.0-prerelease extensions: prescriptionNonDispensingReason: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-PrescriptionNonDispensingReason', max: 1, type: Extension, short: This is the non dispensing reason for the overall prescription, mustSupport: true, index: 0} prescriptionStatus: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-TaskBusinessStatus', type: Extension, isModifier: false, index: 1} repeatInformation: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-RepeatInformation', max: 1, type: Extension, short: Repeat Prescribing and Dispensing, mustSupport: true, index: 2} supplyHeaderIdentifier: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-SupplyHeaderIdentifier', max: 1, type: Extension, short: Identifier for the SupplyHeader, mustSupport: true, index: 3} class: profile kind: resource url: https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense base: https://fhir.hl7.org.uk/StructureDefinition/UKCore-MedicationDispense version: 1.0.2 required: [authorizingPrescription, quantity, subject, performer]