PackagesCanonicalsLogsProblems
    Packages
    uk.nhsdigital.r4.test@2.8.7-prerelease
    https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense
description: null
package_name: uk.nhsdigital.r4.test
derivation: constraint
name: NHSDigitalMedicationDispense
type: MedicationDispense
elements:
  category:
    elements:
      coding:
        elements:
          system: {index: 19}
          code: {index: 20}
        required: [system, code]
  whenHandedOver: {mustSupport: true, index: 52}
  whenPrepared: {mustSupport: true, index: 51}
  medicationCodeableConcept: {type: CodeableConcept, mustSupport: true, choiceOf: medication, index: 23}
  type:
    binding: {strength: required, valueSet: 'https://fhir.nhs.uk/ValueSet/DM-medicationdispense-type'}
    mustSupport: true
    index: 40
    elements:
      coding:
        elements:
          system: {index: 41}
          code: {index: 42}
        required: [system, code]
  statusReason:
    mustSupport: true
    choices: [statusReasonCodeableConcept]
    index: 10
  statusReasonCodeableConcept: {type: CodeableConcept, mustSupport: true, choiceOf: statusReason, index: 11}
  extension:
    index: 0
    slicing:
      rules: open
      discriminator:
      - {path: url, type: value}
      min: 1
      slices:
        prescriptionStatus:
          match: {url: null}
          schema: {short: This is the overall status of the `prescription-order`, type: Extension, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-TaskBusinessStatus', index: 1}
          min: 1
          max: 1
        prescriptionNonDispensingReason:
          match: {url: null}
          schema: {short: This is the non dispensing reason for the overall prescription, type: Extension, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-PrescriptionNonDispensingReason', index: 2}
          min: 0
          max: 1
        repeatInformation:
          match: {url: null}
          schema: {short: Repeat Prescribing and Dispensing, type: Extension, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-RepeatInformation', index: 3}
          min: 0
          max: 1
        supplyHeaderIdentifier:
          match: {url: null}
          schema: {short: Identifier for the SupplyHeader, type: Extension, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-SupplyHeaderIdentifier', index: 4}
          min: 0
          max: 1
  status: {mustSupport: true, index: 8}
  statusReason[x]:
    elements:
      coding:
        index: 12
        elements:
          system: {index: 13}
          code: {index: 14}
        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: 15
                elements:
                  system:
                    pattern: {type: Uri, value: 'https://fhir.nhs.uk/CodeSystem/medicationdispense-status-reason'}
                    index: 16
            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: 17
                elements:
                  system:
                    pattern: {type: Uri, value: 'https://fhir.nhs.uk/CodeSystem/EPS-task-dispense-withdraw-reason'}
                    index: 18
    required: [coding]
  dosageInstruction: {type: Dosage, mustSupport: true, index: 54}
  daysSupply: {mustSupport: true, index: 50}
  identifier:
    mustSupport: true
    index: 5
    elements:
      system: {index: 6}
      value: {index: 7}
    required: [value, system]
  context:
    type: Reference
    refers: ['https://fhir.hl7.org.uk/StructureDefinition/UKCore-EpisodeOfCare', 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-Encounter']
    index: 28
  medicationReference:
    type: Reference
    mustSupport: true
    choiceOf: medication
    refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense-Medication']
    index: 24
  quantity:
    mustSupport: true
    index: 43
    extensions:
      runningTotal: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal', min: 0, max: 1, type: Extension, index: 45}
    elements:
      extension:
        index: 44
        slicing:
          rules: open
          discriminator:
          - {path: url, type: value}
          min: 0
          slices:
            runningTotal:
              match: {url: null}
              schema: {type: Extension, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal', index: 45}
              min: 0
              max: 1
      value: {index: 46}
      unit: {index: 47}
      system: {index: 48}
      code: {index: 49}
    required: [value, unit, system, code]
  location:
    type: Reference
    refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-Location']
    index: 34
    elements:
      identifier:
        elements:
          system: {index: 35}
          value: {index: 36}
        required: [value, system]
      display: {index: 37}
    required: [display]
  authorizingPrescription:
    type: Reference
    mustSupport: true
    refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationRequest-Minimal']
    index: 38
    elements:
      reference: {index: 39}
    required: [reference]
  receiver: {index: 53}
  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: Supplied NHS Number is outside the English and Welsh NHS Number range or length of the number is wrong., source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-Claim', 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(''^([456789]{1}[0-9]{9})$''))'}
    mustSupport: true
    refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-Patient-PDS']
    index: 25
    elements:
      identifier:
        elements:
          system:
            pattern: {type: Uri, value: 'https://fhir.nhs.uk/Id/nhs-number'}
            index: 26
          value: {index: 27}
        required: [value, system]
  performer:
    mustSupport: true
    index: 29
    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: 30
        elements:
          reference: {index: 31}
          identifier:
            elements:
              system: {index: 32}
              value: {index: 33}
            required: [value, system]
        required: [reference]
  medication:
    mustSupport: true
    choices: [medicationCodeableConcept, medicationReference]
    index: 22
package_version: 2.8.7-prerelease
extensions:
  prescriptionStatus: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-TaskBusinessStatus', min: 1, max: 1, short: This is the overall status of the `prescription-order`, type: Extension, mustSupport: true, index: 1}
  prescriptionNonDispensingReason: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-PrescriptionNonDispensingReason', min: 0, max: 1, short: This is the non dispensing reason for the overall prescription, type: Extension, mustSupport: true, index: 2}
  repeatInformation: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-RepeatInformation', min: 0, max: 1, short: Repeat Prescribing and Dispensing, type: Extension, mustSupport: true, index: 3}
  supplyHeaderIdentifier: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-SupplyHeaderIdentifier', min: 0, max: 1, short: Identifier for the SupplyHeader, type: Extension, mustSupport: true, index: 4}
class: profile
kind: resource
url: https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense
base: https://fhir.hl7.org.uk/StructureDefinition/UKCore-MedicationDispense
version: null
required: [authorizingPrescription, extension, quantity, subject, performer]