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: 16} code: {index: 17} required: [system, code] whenHandedOver: {mustSupport: true, index: 48} whenPrepared: {mustSupport: false, index: 47} medicationCodeableConcept: {type: CodeableConcept, mustSupport: true, choiceOf: medication, index: 20} type: binding: {strength: required, valueSet: 'https://fhir.nhs.uk/ValueSet/DM-medicationdispense-type'} mustSupport: true index: 37 elements: coding: elements: system: {index: 38} code: {index: 39} required: [system, code] statusReason: mustSupport: true choices: [statusReasonCodeableConcept] index: 8 statusReasonCodeableConcept: {type: CodeableConcept, mustSupport: true, choiceOf: statusReason, index: 9} 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 status: {mustSupport: true, index: 6} statusReason[x]: elements: coding: index: 10 elements: system: {index: 11} code: {index: 12} display: {index: 13} required: [display, 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 required: [coding] dosageInstruction: {type: Dosage, mustSupport: true, index: 50} daysSupply: {mustSupport: false, index: 46} identifier: mustSupport: true index: 3 elements: system: {index: 4} value: {index: 5} required: [value, system] context: type: Reference refers: ['https://fhir.hl7.org.uk/StructureDefinition/UKCore-EpisodeOfCare', 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-Encounter'] index: 25 medicationReference: type: Reference mustSupport: true choiceOf: medication refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense-Medication'] index: 21 quantity: mustSupport: true index: 40 extensions: runningTotal: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal', max: 1, type: Extension, index: 41} elements: extension: type: Extension url: https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal index: 41 slicing: slices: runningTotal: match: {} schema: {type: Extension, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal', index: 41} max: 1 value: {index: 42} unit: {index: 43} system: {index: 44} code: {index: 45} required: [value, unit, system, code] location: type: Reference refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-Location'] index: 31 elements: identifier: elements: system: {index: 32} value: {index: 33} required: [value, system] display: {index: 34} required: [display] authorizingPrescription: type: Reference mustSupport: true refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationRequest-Minimal'] index: 35 elements: reference: {index: 36} required: [reference] receiver: {index: 49} 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: 22 elements: identifier: elements: system: pattern: {type: Uri, value: 'https://fhir.nhs.uk/Id/nhs-number'} index: 23 value: {index: 24} required: [value, system] performer: mustSupport: true index: 26 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: 27 elements: reference: {index: 28} identifier: elements: system: {index: 29} value: {index: 30} required: [value, system] required: [reference] medication: mustSupport: true choices: [medicationCodeableConcept, medicationReference] index: 19 package_version: 2.18.3-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} class: profile kind: resource url: https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense base: https://fhir.hl7.org.uk/StructureDefinition/UKCore-MedicationDispense version: 1.1.0 required: [authorizingPrescription, quantity, subject, performer]