PackagesCanonicalsLogsProblems
    Packages
    uk.nhsdigital.medicines.r4@2.3.0
    https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense
description: null
package_name: uk.nhsdigital.medicines.r4
derivation: constraint
name: NHSDigitalMedicationDispense
type: MedicationDispense
elements:
  category:
    elements:
      coding:
        elements:
          system: {index: 9}
          code: {index: 10}
        required: [system, code]
  whenHandedOver: {mustSupport: true, index: 44}
  medicationCodeableConcept: {type: CodeableConcept, mustSupport: true, choiceOf: medication, index: 13}
  type:
    binding: {strength: required, valueSet: 'https://fhir.nhs.uk/ValueSet/DM-medicationdispense-type'}
    mustSupport: true
    index: 33
    elements:
      coding:
        elements:
          system: {index: 34}
          code: {index: 35}
        required: [system, code]
  statusReason:
    choices: []
    index: 8
  extension:
    index: 0
    slicing:
      rules: open
      discriminator:
      - {path: url, type: value}
      min: 1
      slices:
        prescriptionStatus:
          match: {url: null}
          schema: {type: Extension, mustSupport: true, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-TaskBusinessStatus', index: 1}
          min: 1
          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: 2}
          min: 0
          max: 1
  status: {mustSupport: true, index: 6}
  dosageInstruction:
    mustSupport: true
    index: 46
    elements:
      id: {index: 47}
      text: {index: 48}
    required: [text]
  daysSupply: {mustSupport: true, index: 43}
  identifier:
    mustSupport: true
    index: 3
    elements:
      system: {index: 4}
      value: {index: 5}
    required: [value, system]
  context:
    type: Reference
    refers: ['http://hl7.org/fhir/StructureDefinition/EpisodeOfCare', 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-Encounter']
    index: 18
  medicationReference:
    type: Reference
    mustSupport: true
    choiceOf: medication
    refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense-Medication']
    index: 14
  quantity:
    mustSupport: true
    index: 36
    extensions:
      runningTotal: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-RunningTotal', min: 0, max: 1, type: Extension, index: 38}
    elements:
      extension:
        index: 37
        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: 38}
              min: 0
              max: 1
      value: {index: 39}
      unit: {index: 40}
      system: {index: 41}
      code: {index: 42}
    required: [value, unit, system, code]
  location:
    type: Reference
    refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-Location']
    index: 25
    elements:
      identifier:
        elements:
          system: {index: 26}
          value: {index: 27}
        required: [value, system]
      display: {index: 28}
    required: [display]
  authorizingPrescription:
    type: Reference
    mustSupport: true
    refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationRequest']
    index: 29
    extensions:
      groupIdentifier: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-GroupIdentifier', min: 1, max: 1, type: Extension, index: 31}
    elements:
      extension:
        index: 30
        slicing:
          rules: open
          discriminator:
          - {path: url, type: value}
          min: 1
          slices:
            groupIdentifier:
              match: {url: null}
              schema: {type: Extension, url: 'https://fhir.nhs.uk/StructureDefinition/Extension-DM-GroupIdentifier', index: 31}
              min: 1
              max: 1
      identifier: {index: 32}
    required: [extension, identifier]
  receiver: {index: 45}
  subject:
    type: Reference
    constraint:
      eps-2: {human: subject - An identifier reference plus a display name or resource reference must be provided, source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: warning, expression: (reference.exists() or (identifier.exists() and display.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']
    index: 15
    elements:
      identifier:
        elements:
          system:
            pattern: {type: Uri, value: 'https://fhir.nhs.uk/Id/nhs-number'}
            index: 16
          value: {index: 17}
        required: [value, system]
  performer:
    mustSupport: true
    index: 19
    elements:
      actor:
        type: Reference
        constraint:
          usercode-reference: {human: PractitionerRole.practitioner - An identifier reference plus a display name or resource reference must be provided, source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: error, expression: (reference.exists() or (identifier.exists() and display.exists()))}
          usercode-nmc: {human: NMC must be of the format NNANNNNA, source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: error, expression: 'identifier.exists().not() or identifier.where(system=''https://fhir.hl7.org.uk/Id/nmc-number'').exists().not() or (identifier.where(system=''https://fhir.hl7.org.uk/Id/nmc-number'').exists()  and identifier.where(system=''https://fhir.hl7.org.uk/Id/nmc-number'').value.matches(''^[0-9]{2}[A-Z]{1}[0-9]{4}[A-Z]{1}$''))'}
          usercodee-gmp: {human: GMP must be of the format GNNNNNNN and not be a spurious code (starts with G6 or G7), source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: error, expression: 'identifier.exists().not() or identifier.where(system=''https://fhir.hl7.org.uk/Id/gmp-number'').exists().not() or (identifier.where(system=''https://fhir.hl7.org.uk/Id/gmp-number'').exists()  and identifier.where(system=''https://fhir.hl7.org.uk/Id/gmp-number'').value.matches(''^[G]{1}[01234589]{1}[0-9]{6}$''))'}
          usercode-gmc: {human: GMC must be of the format CNNNNNNN, source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: error, expression: 'identifier.exists().not() or identifier.where(system=''https://fhir.hl7.org.uk/Id/gmc-number'').exists().not() or (identifier.where(system=''https://fhir.hl7.org.uk/Id/gmc-number'').exists()  and identifier.where(system=''https://fhir.hl7.org.uk/Id/gmc-number'').value.matches(''^[C]{1}[0-9]{7}$''))'}
          usercode-gphc: {human: GPHC must be of the format NNNNNNN, source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: error, expression: 'identifier.exists().not() or identifier.where(system=''https://fhir.hl7.org.uk/Id/gphc-number'').exists().not() or (identifier.where(system=''https://fhir.hl7.org.uk/Id/gphc-number'').exists()  and identifier.where(system=''https://fhir.hl7.org.uk/Id/gphc-number'').value.matches(''^[0-9]{7}$''))'}
          usercode-hcpc: {human: HCPC must be of the format AANNNNNN, source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: error, expression: 'identifier.exists().not() or identifier.where(system=''https://fhir.hl7.org.uk/Id/hcpc-number'').exists().not() or (identifier.where(system=''https://fhir.hl7.org.uk/Id/hcpc-number'').exists()  and identifier.where(system=''https://fhir.hl7.org.uk/Id/hcpc-number'').value.matches(''^[A-Z]{2}[0-9]{6}$''))'}
          usercode-din: {human: DIN format must be NNNNNN, source: 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-MedicationDispense', severity: error, expression: 'identifier.exists().not() or identifier.where(system=''https://fhir.hl7.org.uk/Id/din-number'').exists().not() or (identifier.where(system=''https://fhir.hl7.org.uk/Id/din-number'').exists()  and identifier.where(system=''https://fhir.hl7.org.uk/Id/din-number'').value.matches(''^[0-9]{6}$''))'}
        refers: ['https://fhir.nhs.uk/StructureDefinition/NHSDigital-Organization', 'https://fhir.nhs.uk/StructureDefinition/NHSDigital-Practitioner']
        index: 20
        elements:
          identifier:
            index: 21
            elements:
              system: {index: 22}
              value: {index: 23}
            required: [value, system]
          display: {index: 24}
        required: [identifier, display]
  medication:
    mustSupport: true
    choices: [medicationCodeableConcept, medicationReference]
    index: 12
package_version: 2.3.0
extensions:
  prescriptionStatus: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-TaskBusinessStatus', min: 1, max: 1, type: Extension, mustSupport: true, index: 1}
  repeatInformation: {url: 'https://fhir.nhs.uk/StructureDefinition/Extension-EPS-RepeatInformation', min: 0, max: 1, short: Repeat Prescribing and Dispensing, type: Extension, 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: null
required: [authorizingPrescription, extension, subject]