{
  "resourceType": "StructureDefinition",
  "id": "epa-medication",
  "url": "https://gematik.de/fhir/epa-medication/StructureDefinition/epa-medication",
  "version": "1.0.0",
  "name": "EPAMedication",
  "title": "EPA Medication",
  "status": "active",
  "experimental": false,
  "date": "2023-12-06",
  "publisher": "gematik GmbH",
  "description": "Defines the medication resource for the Medication Service in the ePA system.",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "script10.6",
      "uri": "http://ncpdp.org/SCRIPT10_6",
      "name": "Mapping to NCPDP SCRIPT 10.6"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    },
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Medication",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Medication",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Medication",
        "path": "Medication",
        "constraint": [
          {
            "key": "epa-med-1",
            "severity": "error",
            "human": "Medikamenten-Code, -Bezeichnung oder Inhaltsstoffe müssen angegeben werden.",
            "expression": "code.exists() or ingredient.exists()",
            "source": "https://gematik.de/fhir/epa-medication/StructureDefinition/epa-medication"
          }
        ]
      },
      {
        "id": "Medication.extension",
        "path": "Medication.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Medication.extension:RxPrescriptionProcessIdentifier",
        "path": "Medication.extension",
        "sliceName": "RxPrescriptionProcessIdentifier",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/epa-medication/StructureDefinition/rx-prescription-process-identifier-extension"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Medication.identifier",
        "path": "Medication.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open",
          "ordered": false
        },
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.identifier:ePAMedicationUniqueIdentifier",
        "path": "Medication.identifier",
        "sliceName": "ePAMedicationUniqueIdentifier",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "https://gematik.de/fhir/epa-medication/StructureDefinition/epa-medication-unique-identifier"
            ]
          }
        ]
      },
      {
        "id": "Medication.code",
        "path": "Medication.code",
        "short": "Medication in coded form or as free text if necessary",
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding",
        "path": "Medication.code.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:PZN",
        "path": "Medication.code.coding",
        "sliceName": "PZN",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/ifa/pzn"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:PZN.system",
        "path": "Medication.code.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:PZN.code",
        "path": "Medication.code.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:PZN.display",
        "path": "Medication.code.coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ATC-DE",
        "path": "Medication.code.coding",
        "sliceName": "ATC-DE",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/bfarm/atc"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ATC-DE.system",
        "path": "Medication.code.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ATC-DE.code",
        "path": "Medication.code.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ATC-DE.display",
        "path": "Medication.code.coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ASK",
        "path": "Medication.code.coding",
        "sliceName": "ASK",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/ask"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ASK.system",
        "path": "Medication.code.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ASK.code",
        "path": "Medication.code.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:ASK.display",
        "path": "Medication.code.coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:WG14",
        "path": "Medication.code.coding",
        "sliceName": "WG14",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/abdata/wg14"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:WG14.system",
        "path": "Medication.code.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:WG14.code",
        "path": "Medication.code.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:WG14.display",
        "path": "Medication.code.coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:verordnungskategorieCode",
        "path": "Medication.code.coding",
        "sliceName": "verordnungskategorieCode",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:verordnungskategorieCode.system",
        "path": "Medication.code.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.code.coding:verordnungskategorieCode.code",
        "path": "Medication.code.coding.code",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa-medication/ValueSet/kbv-medication-type-vs"
        }
      },
      {
        "id": "Medication.code.coding:verordnungskategorieCode.display",
        "path": "Medication.code.coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.code.text",
        "path": "Medication.code.text",
        "mustSupport": true
      },
      {
        "id": "Medication.status",
        "path": "Medication.status",
        "short": "Status der Medikamenteninformation",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.manufacturer",
        "path": "Medication.manufacturer",
        "short": "Hersteller des Medikaments",
        "comment": "Hier kann der tatsächliche Hersteller des Medikaments benannt werden, vornehmlich im Fall von Wirkstoffmischungen (Rezepturen), beispielsweise die Krankenhausapotheke. Zu beachten ist, dass die zulassende Organisation, wie sie z.B. in den Daten zur PZN benannt ist, nicht als Hersteller gilt.",
        "mustSupport": true
      },
      {
        "id": "Medication.manufacturer.display",
        "path": "Medication.manufacturer.display",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.form",
        "path": "Medication.form",
        "short": "Abgabeform",
        "mustSupport": true
      },
      {
        "id": "Medication.form.coding",
        "path": "Medication.form.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.form.coding:EDQM",
        "path": "Medication.form.coding",
        "sliceName": "EDQM",
        "min": 0,
        "max": "1",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "http://hl7.org/fhir/uv/ips/ValueSet/medicine-doseform"
        }
      },
      {
        "id": "Medication.form.coding:EDQM.system",
        "path": "Medication.form.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.form.coding:EDQM.code",
        "path": "Medication.form.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.form.coding:EDQM.display",
        "path": "Medication.form.coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.form.coding:KBVDarreichungsform",
        "path": "Medication.form.coding",
        "sliceName": "KBVDarreichungsform",
        "min": 0,
        "max": "1",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa-medication/ValueSet/kbv-medication-darreichungsform-vs"
        }
      },
      {
        "id": "Medication.form.coding:KBVDarreichungsform.system",
        "path": "Medication.form.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.form.coding:KBVDarreichungsform.code",
        "path": "Medication.form.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.form.coding:KBVDarreichungsform.display",
        "path": "Medication.form.coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.amount",
        "path": "Medication.amount",
        "mustSupport": true
      },
      {
        "id": "Medication.amount.numerator",
        "path": "Medication.amount.numerator",
        "min": 1,
        "patternQuantity": {
          "system": "http://unitsofmeasure.org"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.amount.numerator.value",
        "path": "Medication.amount.numerator.value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.amount.numerator.unit",
        "path": "Medication.amount.numerator.unit",
        "mustSupport": true
      },
      {
        "id": "Medication.amount.numerator.system",
        "path": "Medication.amount.numerator.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.amount.numerator.code",
        "path": "Medication.amount.numerator.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.amount.denominator",
        "path": "Medication.amount.denominator",
        "patternQuantity": {
          "system": "http://unitsofmeasure.org"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.amount.denominator.value",
        "path": "Medication.amount.denominator.value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.amount.denominator.unit",
        "path": "Medication.amount.denominator.unit",
        "mustSupport": true
      },
      {
        "id": "Medication.amount.denominator.system",
        "path": "Medication.amount.denominator.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.amount.denominator.code",
        "path": "Medication.amount.denominator.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient",
        "path": "Medication.ingredient",
        "short": "Informationen zu Bestandteilen (Rezeptur)",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]",
        "path": "Medication.ingredient.item[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept",
        "path": "Medication.ingredient.item[x]",
        "sliceName": "itemCodeableConcept",
        "short": "Bestandteil in codierter Form oder ggf. als Freitext",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding",
        "path": "Medication.ingredient.item[x].coding",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ASK",
        "path": "Medication.ingredient.item[x].coding",
        "sliceName": "ASK",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/ask"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ASK.system",
        "path": "Medication.ingredient.item[x].coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ASK.code",
        "path": "Medication.ingredient.item[x].coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ASK.display",
        "path": "Medication.ingredient.item[x].coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ATC-DE",
        "path": "Medication.ingredient.item[x].coding",
        "sliceName": "ATC-DE",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/bfarm/atc"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ATC-DE.system",
        "path": "Medication.ingredient.item[x].coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ATC-DE.code",
        "path": "Medication.ingredient.item[x].coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:ATC-DE.display",
        "path": "Medication.ingredient.item[x].coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:PZN",
        "path": "Medication.ingredient.item[x].coding",
        "sliceName": "PZN",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/ifa/pzn"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:PZN.system",
        "path": "Medication.ingredient.item[x].coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:PZN.code",
        "path": "Medication.ingredient.item[x].coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:PZN.display",
        "path": "Medication.ingredient.item[x].coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:WG14",
        "path": "Medication.ingredient.item[x].coding",
        "sliceName": "WG14",
        "min": 0,
        "max": "1",
        "patternCoding": {
          "system": "http://fhir.de/CodeSystem/abdata/wg14"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:WG14.system",
        "path": "Medication.ingredient.item[x].coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:WG14.code",
        "path": "Medication.ingredient.item[x].coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.coding:WG14.display",
        "path": "Medication.ingredient.item[x].coding.display",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemCodeableConcept.text",
        "path": "Medication.ingredient.item[x].text",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemReference",
        "path": "Medication.ingredient.item[x]",
        "sliceName": "itemReference",
        "short": "Bestandteil (Referenz auf ein anderes Medikament)",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Substance",
              "http://hl7.org/fhir/StructureDefinition/Medication"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.item[x]:itemReference.reference",
        "path": "Medication.ingredient.item[x].reference",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.isActive",
        "path": "Medication.ingredient.isActive",
        "short": "handelt es sich um einen aktiven Bestandteil?",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength",
        "path": "Medication.ingredient.strength",
        "short": "Stärke",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.numerator",
        "path": "Medication.ingredient.strength.numerator",
        "min": 1,
        "patternQuantity": {
          "system": "http://unitsofmeasure.org"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.numerator.value",
        "path": "Medication.ingredient.strength.numerator.value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.numerator.unit",
        "path": "Medication.ingredient.strength.numerator.unit",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.numerator.system",
        "path": "Medication.ingredient.strength.numerator.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.numerator.code",
        "path": "Medication.ingredient.strength.numerator.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.denominator",
        "path": "Medication.ingredient.strength.denominator",
        "patternQuantity": {
          "system": "http://unitsofmeasure.org"
        },
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.denominator.value",
        "path": "Medication.ingredient.strength.denominator.value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.denominator.unit",
        "path": "Medication.ingredient.strength.denominator.unit",
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.denominator.system",
        "path": "Medication.ingredient.strength.denominator.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.ingredient.strength.denominator.code",
        "path": "Medication.ingredient.strength.denominator.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Medication.batch",
        "path": "Medication.batch",
        "short": "Angaben zur Charge",
        "mustSupport": true
      },
      {
        "id": "Medication.batch.lotNumber",
        "path": "Medication.batch.lotNumber",
        "short": "Chargennummer",
        "mustSupport": true
      }
    ]
  }
}