{
  "resourceType": "StructureDefinition",
  "id": "epa-medication-prescription-link-task",
  "url": "https://gematik.de/fhir/epa-medication/StructureDefinition/epa-medication-prescription-link-task",
  "version": "1.1.1",
  "name": "EPAMedicationPrescriptionLinkTask",
  "title": "EPA MedicationPrescription Link Task",
  "status": "active",
  "experimental": false,
  "date": "2024-08-14",
  "publisher": "gematik GmbH",
  "description": "This profile defines a specialized structure for FHIR Task resources aimed at establishing a link between medication information and associated medication prescriptions. It facilitates the efficient organization and tracking of medication processes within Medication Service of the ePA system.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Task",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Task",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Task.status",
        "path": "Task.status",
        "short": "Status of Medication Prescription Link Task",
        "mustSupport": true
      },
      {
        "id": "Task.intent",
        "path": "Task.intent",
        "short": "order",
        "definition": "The 'order' code should be used here.",
        "patternCode": "order",
        "mustSupport": true
      },
      {
        "id": "Task.authoredOn",
        "path": "Task.authoredOn",
        "mustSupport": true
      },
      {
        "id": "Task.requester",
        "path": "Task.requester",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization",
              "http://hl7.org/fhir/StructureDefinition/Practitioner",
              "http://hl7.org/fhir/StructureDefinition/PractitionerRole"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.input",
        "path": "Task.input",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "type"
            }
          ],
          "rules": "open"
        },
        "short": "...",
        "min": 2,
        "max": "2",
        "mustSupport": true
      },
      {
        "id": "Task.input:prescription",
        "path": "Task.input",
        "sliceName": "prescription",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.input:prescription.type",
        "path": "Task.input.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "PRESCIPTION",
              "system": "https://gematik.de/fhir/terminology/CodeSystem/epa-medication-task-label-cs"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "Task.input:prescription.value[x]",
        "path": "Task.input.value[x]",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "https://gematik.de/fhir/epa-medication/StructureDefinition/rx-prescription-process-identifier"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.input:statement",
        "path": "Task.input",
        "sliceName": "statement",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.input:statement.type",
        "path": "Task.input.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "code": "MEDICATIONSTATEMENT",
              "system": "https://gematik.de/fhir/terminology/CodeSystem/epa-medication-task-label-cs"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "Task.input:statement.value[x]",
        "path": "Task.input.value[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/MedicationStatement"
            ]
          }
        ],
        "mustSupport": true
      }
    ]
  }
}