{
  "resourceType": "StructureDefinition",
  "url": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Task-ForMedicationOrder",
  "name": "Task-ForMedicationOrder",
  "title": "API Framework Task-ForMedicationOrder",
  "status": "active",
  "experimental": false,
  "description": "Task profile dedicated to MED-001 General Medication Order",
  "fhirVersion": "3.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Task",
  "baseDefinition": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Task",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Task.identifier",
        "path": "Task.identifier",
        "mustSupport": true
      },
      {
        "id": "Task.partOf",
        "path": "Task.partOf",
        "definition": "Each specific medication request task can be part of a more general purpose task.",
        "requirements": "Each task can be part of",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Task-ForMedicationOrder"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Task.statusReason",
        "path": "Task.statusReason",
        "mustSupport": true
      },
      {
        "id": "Task.statusReason.text",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable",
            "valueBoolean": true
          }
        ],
        "path": "Task.statusReason.text",
        "mustSupport": true
      },
      {
        "id": "Task.focus",
        "path": "Task.focus",
        "requirements": "Task needs to reference a compiste request for medications, that acts as the \"general order\" resource",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/RequestGroup-ForMedicationOrder"
          }
        ]
      },
      {
        "id": "Task.for",
        "path": "Task.for",
        "requirements": "Medication order tasks must be related to a target Patient",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/Patient"
          }
        ]
      },
      {
        "id": "Task.input",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name",
            "valueString": "Parameter"
          }
        ],
        "path": "Task.input",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type.coding.code"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Task.input.type",
        "path": "Task.input.type",
        "binding": {
          "strength": "extensible",
          "valueSetUri": "http://hl7.org/fhir/ValueSet/all-types"
        }
      },
      {
        "id": "Task.input.type.coding",
        "path": "Task.input.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Task.input:medicationRequest",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name",
            "valueString": "Parameter"
          }
        ],
        "path": "Task.input",
        "sliceName": "medicationRequest",
        "min": 1
      },
      {
        "id": "Task.input:medicationRequest.type.coding",
        "path": "Task.input.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Task.input:medicationRequest.type.coding.code",
        "path": "Task.input.type.coding.code",
        "min": 1,
        "fixedCode": "MedicationRequest"
      },
      {
        "id": "Task.input:medicationRequest.value[x]:valueReference",
        "path": "Task.input.valueReference",
        "sliceName": "valueReference",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/MedicationRequest"
          }
        ]
      },
      {
        "id": "Task.output",
        "path": "Task.output",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type.coding.code"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Task.output.type",
        "path": "Task.output.type",
        "mustSupport": true,
        "binding": {
          "strength": "extensible",
          "valueSetUri": "http://hl7.org/fhir/ValueSet/all-types"
        }
      },
      {
        "id": "Task.output.type.coding",
        "path": "Task.output.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Task.output:dispense",
        "path": "Task.output",
        "sliceName": "dispense"
      },
      {
        "id": "Task.output:dispense.type.coding",
        "path": "Task.output.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Task.output:dispense.type.coding.code",
        "path": "Task.output.type.coding.code",
        "min": 1,
        "fixedCode": "MedicationDispense"
      },
      {
        "id": "Task.output:dispense.value[x]:valueReference",
        "path": "Task.output.valueReference",
        "sliceName": "valueReference",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/MedicationDispense"
          }
        ]
      },
      {
        "id": "Task.output:administration",
        "path": "Task.output",
        "sliceName": "administration"
      },
      {
        "id": "Task.output:administration.type.coding",
        "path": "Task.output.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Task.output:administration.type.coding.code",
        "path": "Task.output.type.coding.code",
        "min": 1,
        "fixedCode": "MedicationAdministration"
      },
      {
        "id": "Task.output:administration.value[x]:valueReference",
        "path": "Task.output.valueReference",
        "sliceName": "valueReference",
        "type": [
          {
            "code": "Reference",
            "targetProfile": "http://apiframework.dedalus.eu/fhir/StructureDefinition/MedicationAdministration"
          }
        ]
      }
    ]
  }
}