{
  "resourceType": "StructureDefinition",
  "id": "GEM-ERP-PR-Task",
  "meta": {
    "versionId": "4",
    "lastUpdated": "2025-02-04T06:28:57.241+00:00"
  },
  "url": "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Task",
  "version": "1.5",
  "name": "GEM_ERP_PR_Task",
  "title": "Task for Management of ePrescription Workflow",
  "status": "draft",
  "date": "2025-01-01",
  "description": "This resource manages the ePrescription workflow",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Task",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Task",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Task.meta",
        "path": "Task.meta",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.meta.profile",
        "path": "Task.meta.profile",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "$this"
            }
          ],
          "description": "Slicing for meta profile",
          "ordered": false,
          "rules": "open"
        },
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Task.meta.profile:workflowProfile",
        "path": "Task.meta.profile",
        "sliceName": "workflowProfile",
        "min": 1,
        "max": "1",
        "fixedCanonical": "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Task|1.5",
        "mustSupport": true
      },
      {
        "id": "Task.extension",
        "path": "Task.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "description": "Extensions are always sliced by (at least) url",
          "rules": "closed"
        },
        "min": 1
      },
      {
        "id": "Task.extension:flowType",
        "path": "Task.extension",
        "sliceName": "flowType",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_PrescriptionType"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.extension:acceptDate",
        "path": "Task.extension",
        "sliceName": "acceptDate",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_AcceptDate"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.extension:expiryDate",
        "path": "Task.extension",
        "sliceName": "expiryDate",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_ExpiryDate"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.extension:lastMedicationDispense",
        "path": "Task.extension",
        "sliceName": "lastMedicationDispense",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_LastMedicationDispense"
            ]
          }
        ]
      },
      {
        "id": "Task.extension:eu-isRedeemableByProperties",
        "path": "Task.extension",
        "sliceName": "eu-isRedeemableByProperties",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_EU_IS_REDEEMABLE_BY_PROPERTIES"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.extension:eu-isRedeemableByPatientAuthorization",
        "path": "Task.extension",
        "sliceName": "eu-isRedeemableByPatientAuthorization",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_EX_EU_IS_REDEEMABLE_BY_PATIENT_AUTHORIZATION"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.identifier",
        "path": "Task.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "description": "The task ressource contains three identifier. The first one is the identifier for the ask representing one e-prescription. The other identifier are representing the patient as owner of the prescription. One is the \"Krankenversichertennummer\" which identify each patient by his health insurance company and the other is \"Institutionskennzeichen\".",
          "rules": "closed"
        },
        "min": 1
      },
      {
        "id": "Task.identifier:PrescriptionID",
        "path": "Task.identifier",
        "sliceName": "PrescriptionID",
        "short": "Prescription Identifier",
        "definition": "The prescription identifier is the main identifier for the task ressource and the whole prescription workflow. This identifier is genereted by the \"E-Rezept Fachdienst\" and should not be changed manually.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_PrescriptionId"
            ]
          }
        ]
      },
      {
        "id": "Task.identifier:AccessCode",
        "path": "Task.identifier",
        "sliceName": "AccessCode",
        "short": "AccessCode Identifier",
        "definition": "Generated by the \"E-Rezept Fachdienst\". This identifier is transported in every task request.",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Task.identifier:AccessCode.system",
        "path": "Task.identifier.system",
        "min": 1,
        "fixedUri": "https://gematik.de/fhir/erp/NamingSystem/GEM_ERP_NS_AccessCode"
      },
      {
        "id": "Task.identifier:AccessCode.value",
        "path": "Task.identifier.value",
        "min": 1
      },
      {
        "id": "Task.identifier:Secret",
        "path": "Task.identifier",
        "sliceName": "Secret",
        "short": "Secret",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Task.identifier:Secret.system",
        "path": "Task.identifier.system",
        "min": 1,
        "fixedUri": "https://gematik.de/fhir/erp/NamingSystem/GEM_ERP_NS_Secret"
      },
      {
        "id": "Task.identifier:Secret.value",
        "path": "Task.identifier.value",
        "min": 1
      },
      {
        "id": "Task.intent",
        "path": "Task.intent",
        "fixedCode": "order"
      },
      {
        "id": "Task.for",
        "path": "Task.for",
        "short": "Identifier of Patient (KVID or PKV-Identifier)"
      },
      {
        "id": "Task.for.identifier",
        "path": "Task.for.identifier",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://fhir.de/StructureDefinition/identifier-kvid-10"
            ]
          }
        ]
      },
      {
        "id": "Task.performerType.coding",
        "path": "Task.performerType.coding",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/erp/ValueSet/GEM_ERP_VS_OrganizationType"
        }
      },
      {
        "id": "Task.input",
        "path": "Task.input",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type.coding.code"
            }
          ],
          "rules": "closed"
        },
        "short": "Input Bundle",
        "definition": "Reference to ePrescription input and outcome during the process",
        "mustSupport": true
      },
      {
        "id": "Task.input:ePrescription",
        "path": "Task.input",
        "sliceName": "ePrescription",
        "short": "QES-Binary of the ePrescription",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.input:ePrescription.type.coding",
        "path": "Task.input.type.coding",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/erp/CodeSystem/GEM_ERP_VS_DocumentType"
        }
      },
      {
        "id": "Task.input:ePrescription.type.coding.system",
        "path": "Task.input.type.coding.system",
        "min": 1
      },
      {
        "id": "Task.input:ePrescription.type.coding.code",
        "path": "Task.input.type.coding.code",
        "min": 1,
        "fixedCode": "1"
      },
      {
        "id": "Task.input:ePrescription.value[x]",
        "path": "Task.input.value[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Binary"
            ]
          }
        ]
      },
      {
        "id": "Task.input:patientReceipt",
        "path": "Task.input",
        "sliceName": "patientReceipt",
        "short": "JSON Bundle of the ePrescription to be consumed by the E-Rezept-FdV",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.input:patientReceipt.type.coding",
        "path": "Task.input.type.coding",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/erp/CodeSystem/GEM_ERP_VS_DocumentType"
        }
      },
      {
        "id": "Task.input:patientReceipt.type.coding.system",
        "path": "Task.input.type.coding.system",
        "min": 1
      },
      {
        "id": "Task.input:patientReceipt.type.coding.code",
        "path": "Task.input.type.coding.code",
        "min": 1,
        "fixedCode": "2"
      },
      {
        "id": "Task.input:patientReceipt.value[x]",
        "path": "Task.input.value[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Bundle"
            ]
          }
        ]
      },
      {
        "id": "Task.output",
        "path": "Task.output",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type.coding.code"
            }
          ],
          "rules": "closed"
        },
        "short": "Output Bundle",
        "definition": "Reference to the Bundle which represent the receipt.",
        "mustSupport": true
      },
      {
        "id": "Task.output:receipt",
        "path": "Task.output",
        "sliceName": "receipt",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Task.output:receipt.type.coding",
        "path": "Task.output.type.coding",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/erp/CodeSystem/GEM_ERP_VS_DocumentType"
        }
      },
      {
        "id": "Task.output:receipt.type.coding.system",
        "path": "Task.output.type.coding.system",
        "min": 1
      },
      {
        "id": "Task.output:receipt.type.coding.code",
        "path": "Task.output.type.coding.code",
        "min": 1,
        "fixedCode": "3"
      },
      {
        "id": "Task.output:receipt.value[x]",
        "path": "Task.output.value[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://gematik.de/fhir/erp/StructureDefinition/GEM_ERP_PR_Bundle"
            ]
          }
        ]
      }
    ]
  }
}