PackagesCanonicalsLogsProblems
    Packages
    nostalgic-ie.fhir.core@0.2.0
    https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription
{
  "description": "An Irish electronic prescription as exchanged: one patient (IECorePatientEPrescription), one or more prescription items (IECoreMedicationRequestEPrescription) sharing a group identifier, the prescriber, the prescriber's facility, the medicinal products, and the allergy statement (IECoreListAllergiesAtPrescribing). Prescription-level legal and safety rules (HIQA EP 1.4.2, 1.6.1, 2.10.1, 3.1) are enforced here because they span resources.",
  "_filename": "StructureDefinition-ie-core-bundle-eprescription.json",
  "package_name": "nostalgic-ie.fhir.core",
  "date": null,
  "derivation": "constraint",
  "publisher": null,
  "fhirVersion": "4.0.1",
  "name": "IECoreBundleEPrescription",
  "abstract": false,
  "type": "Bundle",
  "experimental": null,
  "resourceType": "StructureDefinition",
  "title": "IE Core Bundle (ePrescription)",
  "package_version": "0.2.0",
  "status": "draft",
  "id": "7ea35d75-f836-4b4b-87a6-9be98412477b",
  "kind": "resource",
  "url": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription",
  "version": "0.2.0",
  "differential": {
    "element": [ {
      "id": "Bundle",
      "path": "Bundle",
      "constraint": [ {
        "key": "ie-bnd-rx-1",
        "human": "A multi-item prescription SHALL share one group identifier (system and value) across all its items (HIQA EP 3.1)",
        "source": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription",
        "severity": "error",
        "expression": "entry.resource.ofType(MedicationRequest).count() <= 1 or (entry.resource.ofType(MedicationRequest).all(groupIdentifier.exists()) and entry.resource.ofType(MedicationRequest).select(groupIdentifier.system + '|' + groupIdentifier.value).distinct().count() = 1)"
      }, {
        "key": "ie-bnd-rx-2",
        "human": "Every prescription item SHALL reference the allergy statement (a List coded LOINC 48765-2) in supportingInformation (HIQA EP 1.6.1 / 1.6.2)",
        "source": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription",
        "severity": "error",
        "expression": "entry.resource.ofType(MedicationRequest).all(supportingInformation.where(resolve() is List and resolve().code.coding.where(system = 'http://loinc.org' and code = '48765-2').exists()).exists())"
      }, {
        "key": "ie-bnd-rx-3",
        "human": "If the patient is under 12 years old at the date of prescribing, or the date of birth is not a full date, every prescription item SHALL record the patient's age (HIQA EP 1.4.2; a legal requirement)",
        "source": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription",
        "severity": "error",
        "expression": "entry.resource.ofType(MedicationRequest).all(extension('https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-patient-age-at-prescribing').exists() or ((%resource.entry.resource.ofType(Patient).first().birthDate.toString().length() = 10) and ((%resource.entry.resource.ofType(Patient).first().birthDate + 12 years).toString() <= authoredOn.toString().substring(0,10))))"
      }, {
        "key": "ie-bnd-rx-4",
        "human": "The prescriber (the requester, its practitioner, or its organisation) SHALL have a telephone number (HIQA EP 2.10 / 2.10.1, Mandatory)",
        "source": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription",
        "severity": "error",
        "expression": "entry.resource.ofType(MedicationRequest).all(requester.resolve().telecom.where(system = 'phone').exists() or requester.resolve().ofType(PractitionerRole).practitioner.resolve().telecom.where(system = 'phone').exists() or requester.resolve().ofType(PractitionerRole).organization.resolve().telecom.where(system = 'phone').exists())"
      }, {
        "key": "ie-bnd-rx-5",
        "human": "Every prescription item, the allergy statement and every allergy SHALL be about the one Patient in the Bundle (patient safety: the allergy statement must be the patient's own)",
        "source": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription",
        "severity": "error",
        "expression": "(entry.resource.ofType(MedicationRequest).subject.reference | entry.resource.ofType(List).subject.reference | entry.resource.ofType(AllergyIntolerance).patient.reference).all(($this = %resource.entry.where(resource is Patient).fullUrl) or ($this = ('Patient/' + %resource.entry.resource.ofType(Patient).id)))"
      }, {
        "key": "ie-bnd-rx-6",
        "human": "Every allergy listed in the allergy statement SHALL be included in the Bundle (HIQA EP 1.6.2)",
        "source": "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-bundle-eprescription",
        "severity": "error",
        "expression": "entry.resource.ofType(List).entry.item.reference.all(($this in %resource.entry.fullUrl) or ($this.replace('AllergyIntolerance/', '') in %resource.entry.resource.ofType(AllergyIntolerance).id))"
      } ]
    }, {
      "id": "Bundle.identifier",
      "min": 1,
      "path": "Bundle.identifier",
      "comment": "Bundle identifier; typically the NePS electronic prescription (group) identifier (HIQA EP 3.1).",
      "mustSupport": true
    }, {
      "id": "Bundle.type",
      "path": "Bundle.type",
      "patternCode": "collection"
    }, {
      "id": "Bundle.timestamp",
      "min": 1,
      "path": "Bundle.timestamp",
      "mustSupport": true
    }, {
      "id": "Bundle.entry",
      "min": 3,
      "path": "Bundle.entry",
      "slicing": {
        "rules": "open",
        "discriminator": [ {
          "path": "resource",
          "type": "type"
        } ]
      },
      "mustSupport": true
    }, {
      "id": "Bundle.entry.fullUrl",
      "min": 1,
      "path": "Bundle.entry.fullUrl"
    }, {
      "id": "Bundle.entry.resource",
      "min": 1,
      "path": "Bundle.entry.resource"
    }, {
      "id": "Bundle.entry:patient",
      "max": "1",
      "min": 1,
      "path": "Bundle.entry",
      "sliceName": "patient",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:patient.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "Patient",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-patient-eprescription" ]
      } ]
    }, {
      "id": "Bundle.entry:prescriptionItem",
      "max": "*",
      "min": 1,
      "path": "Bundle.entry",
      "sliceName": "prescriptionItem",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:prescriptionItem.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "MedicationRequest",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-medicationrequest-eprescription" ]
      } ]
    }, {
      "id": "Bundle.entry:allergyStatement",
      "max": "1",
      "min": 1,
      "path": "Bundle.entry",
      "comment": "HIQA EP 1.6.1 / 1.6.2: exactly one allergy statement per prescription, either listing the allergies or giving the reason none are recorded.",
      "sliceName": "allergyStatement",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:allergyStatement.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "List",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-list-allergies-at-prescribing" ]
      } ]
    }, {
      "id": "Bundle.entry:allergy",
      "max": "*",
      "min": 0,
      "path": "Bundle.entry",
      "sliceName": "allergy",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:allergy.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "AllergyIntolerance",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-allergyintolerance" ]
      } ]
    }, {
      "id": "Bundle.entry:practitioner",
      "max": "*",
      "min": 0,
      "path": "Bundle.entry",
      "sliceName": "practitioner",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:practitioner.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "Practitioner",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-practitioner" ]
      } ]
    }, {
      "id": "Bundle.entry:practitionerRole",
      "max": "*",
      "min": 0,
      "path": "Bundle.entry",
      "sliceName": "practitionerRole",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:practitionerRole.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "PractitionerRole",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-practitionerrole" ]
      } ]
    }, {
      "id": "Bundle.entry:organization",
      "max": "*",
      "min": 0,
      "path": "Bundle.entry",
      "sliceName": "organization",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:organization.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "Organization",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-organization" ]
      } ]
    }, {
      "id": "Bundle.entry:medication",
      "max": "*",
      "min": 0,
      "path": "Bundle.entry",
      "sliceName": "medication",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:medication.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "Medication",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-medication-eprescription" ]
      } ]
    }, {
      "id": "Bundle.entry:signature",
      "max": "*",
      "min": 0,
      "path": "Bundle.entry",
      "sliceName": "signature",
      "mustSupport": true
    }, {
      "id": "Bundle.entry:signature.resource",
      "path": "Bundle.entry.resource",
      "type": [ {
        "code": "Provenance",
        "profile": [ "https://hl7-ie.github.io/ie-core/fhir/ie/core/StructureDefinition/ie-core-provenance-eprescription-signature" ]
      } ]
    } ]
  },
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Bundle"
}