{
  "resourceType": "StructureDefinition",
  "id": "9f99014e-d48b-4065-9277-61986660879d",
  "meta": {
    "lastUpdated": "2021-04-20T09:26:30.169+00:00"
  },
  "url": "https://fhir.cambio.se/StructureDefinition/TaskReferral/v1",
  "name": "TaskReferral",
  "status": "draft",
  "date": "2021-04-20T09:26:18.680138+00:00",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "workflow",
      "uri": "http://hl7.org/fhir/workflow",
      "name": "Workflow Pattern"
    },
    {
      "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": "Task",
  "baseDefinition": "https://fhir.cambio.se/StructureDefinition/TaskReferralCore/v1",
  "derivation": "constraint",
  "snapshot": {},
  "differential": {
    "element": [
      {
        "id": "Task.meta",
        "path": "Task.meta",
        "min": 1
      },
      {
        "id": "Task.meta.profile",
        "path": "Task.meta.profile",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Task.identifier",
        "path": "Task.identifier",
        "definition": "The business identifier for this task",
        "comment": "External ID.\r\nIs globally unique (also between different installations).",
        "max": "1"
      },
      {
        "id": "Task.identifier.system",
        "path": "Task.identifier.system",
        "min": 1
      },
      {
        "id": "Task.identifier.value",
        "path": "Task.identifier.value",
        "min": 1
      },
      {
        "id": "Task.instantiatesCanonical",
        "path": "Task.instantiatesCanonical",
        "max": "0"
      },
      {
        "id": "Task.instantiatesUri",
        "path": "Task.instantiatesUri",
        "max": "0"
      },
      {
        "id": "Task.basedOn",
        "path": "Task.basedOn",
        "max": "0"
      },
      {
        "id": "Task.groupIdentifier",
        "path": "Task.groupIdentifier",
        "comment": "Several referrals sharing the same commitment can be connected together. You could send one answer to answer two referrals.",
        "max": "0"
      },
      {
        "id": "Task.partOf",
        "path": "Task.partOf",
        "max": "0"
      },
      {
        "id": "Task.status",
        "path": "Task.status",
        "short": "Draft | Requested | Accepted | Rejected | Cancelled | In progress | Completed | Entered in error",
        "definition": "Supported statuses are Draft, Requested, Accepted, Rejected, Cancelled, In progress, Completed, Entered in error\r\nStatuses that are not supported are Ready, Received, On hold & Failed",
        "comment": "For GET scenarios, Not assessed and Assessment in progress are mapped to Requested. \r\nFor POST scenarios, Requested is mapped to Not Assessed."
      },
      {
        "id": "Task.statusReason",
        "path": "Task.statusReason",
        "comment": "Keep these for now, maybe not use in implementation.\r\nMaybe use for accepted and rejected? May include e.g. assessment.\r\nRejected info is more of an answer.\r\nCould we express sub-statuses for In-progress here? Check if available in CCP.",
        "max": "0"
      },
      {
        "id": "Task.businessStatus",
        "path": "Task.businessStatus",
        "comment": "Keep these for now, maybe not use in implementation.\r\nAre there task.statuses that we would like to hide from patient, in that case business.status may be used and mapped to those statuses that should be shown."
      },
      {
        "id": "Task.businessStatus.coding",
        "path": "Task.businessStatus.coding",
        "min": 1,
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "https://fhir.cambio.se/ValueSet/ReferralBusinessStatus/v1"
        }
      },
      {
        "id": "Task.intent",
        "path": "Task.intent",
        "short": "order",
        "comment": "How should we sync this with ServiceRequest.intent?",
        "fixedCode": "order"
      },
      {
        "id": "Task.priority",
        "path": "Task.priority",
        "short": "routine | urgent | asap",
        "definition": "Indicates how quickly the Task should be addressed with respect to other requests.\r\nDo not support stat.",
        "comment": "Priorities in COSMIC: acute, priority and normal?\r\nattribute to specify if it is acute or not\r\nseparate one to specify priority\r\nStandardiserat Vårdförlopp SVF - e.g. patient needs to be treated according to standardized processs - might need to cover this some place else. \r\nMapping:\r\nNeither priority or acute - routine\r\npriority- urgent\r\nacute - asap"
      },
      {
        "id": "Task.code",
        "path": "Task.code",
        "max": "0"
      },
      {
        "id": "Task.code.coding.code",
        "path": "Task.code.coding.code",
        "fixedCode": "Fulfill"
      },
      {
        "id": "Task.focus",
        "path": "Task.focus",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.cambio.se/StructureDefinition/ServiceRequestReferral/v1"
            ]
          }
        ]
      },
      {
        "id": "Task.for",
        "path": "Task.for",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "Task.encounter",
        "path": "Task.encounter",
        "max": "0"
      },
      {
        "id": "Task.executionPeriod",
        "path": "Task.executionPeriod",
        "max": "0"
      },
      {
        "id": "Task.authoredOn",
        "path": "Task.authoredOn",
        "comment": "authoredOn isused in serviceRequest for referral creation date",
        "max": "0"
      },
      {
        "id": "Task.lastModified",
        "path": "Task.lastModified",
        "comment": "last updated time of referral record. Might be mapped to CCP created time."
      },
      {
        "id": "Task.requester",
        "path": "Task.requester",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Organization",
              "http://hl7.org/fhir/StructureDefinition/Patient",
              "http://hl7.org/fhir/StructureDefinition/Practitioner",
              "https://fhir.cambio.se/StructureDefinition/PractitionerRoleLiteSe/v1"
            ]
          }
        ]
      },
      {
        "id": "Task.performerType",
        "path": "Task.performerType",
        "comment": "Use performerType in the service request for receiving role",
        "max": "0"
      },
      {
        "id": "Task.owner",
        "path": "Task.owner",
        "comment": "Use PractionerRole to map the receiving unit and receiving practitioner.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.org/fhir/StructureDefinition/Practitioner",
              "http://hl7.org/fhir/StructureDefinition/Organization",
              "https://fhir.cambio.se/StructureDefinition/PractitionerRoleLiteSe/v1"
            ]
          }
        ]
      },
      {
        "id": "Task.location",
        "path": "Task.location",
        "max": "0"
      },
      {
        "id": "Task.reasonCode",
        "path": "Task.reasonCode",
        "comment": "This should only be included if there is no focus or if it differs from the reason indicated on the focus.\r\n\r\nDeleted since we do have a focus for the task that is to fulfill the request. No other reason.",
        "max": "0"
      },
      {
        "id": "Task.reasonReference",
        "path": "Task.reasonReference",
        "max": "0"
      },
      {
        "id": "Task.insurance",
        "path": "Task.insurance",
        "max": "0"
      },
      {
        "id": "Task.note",
        "path": "Task.note",
        "comment": "Removed since we will use the output element for structured information instead.",
        "max": "0"
      },
      {
        "id": "Task.relevantHistory",
        "path": "Task.relevantHistory",
        "max": "0"
      },
      {
        "id": "Task.restriction",
        "path": "Task.restriction",
        "comment": "Not supported in COSMIC?",
        "max": "0"
      },
      {
        "id": "Task.input",
        "path": "Task.input",
        "comment": "Will not be used as the input to the referral is included in the ServiceRequest resource.",
        "max": "0"
      },
      {
        "id": "Task.output",
        "path": "Task.output",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type.coding.code"
            }
          ],
          "rules": "open"
        },
        "comment": "Is sliced to represent the different kinds of output. Suggestion is to discriminate the slices on referral output types."
      },
      {
        "id": "Task.output.type",
        "path": "Task.output.type",
        "definition": "Will be used to identify the type of referral output, e.g. Final Answer. Each referenced Composition resource will also be identified with the same value set.",
        "fixedCodeableConcept": {
          "text": "FIN"
        }
      },
      {
        "id": "Task.output.type.coding",
        "path": "Task.output.type.coding",
        "max": "1"
      },
      {
        "id": "Task.output.type.coding.code",
        "path": "Task.output.type.coding.code",
        "min": 1
      },
      {
        "id": "Task.output.value[x]",
        "path": "Task.output.value[x]",
        "short": "Referral output",
        "definition": "The value of the Output will be represented in a Composition resource.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.cambio.se/StructureDefinition/CompositionReferralClinicalInformation/v1"
            ],
            "aggregation": [
              "bundled"
            ]
          }
        ]
      },
      {
        "id": "Task.output:finalAnswer",
        "path": "Task.output",
        "sliceName": "finalAnswer",
        "definition": "This slice should be used for final answers. Each task can include either zero or one final answers. \r\nOther types of clinical information (partial answer, complementary answer, rejection answer and referral record data) should instead be included in the general output element, as they can be included zero to many times.",
        "max": "1"
      },
      {
        "id": "Task.output:finalAnswer.type",
        "path": "Task.output.type",
        "definition": "Should always be set to FIN (final answer).",
        "fixedCodeableConcept": {
          "text": "FIN"
        },
        "binding": {
          "strength": "required",
          "description": "Type of the Composition",
          "valueSet": "https://cambio.codes/referral-documentation-type/v1"
        }
      },
      {
        "id": "Task.output:finalAnswer.type.coding",
        "path": "Task.output.type.coding",
        "max": "1",
        "binding": {
          "strength": "required",
          "description": "Type of the Composition",
          "valueSet": "https://cambio.codes/referral-documentation-type/v1"
        }
      },
      {
        "id": "Task.output:finalAnswer.type.coding.code",
        "path": "Task.output.type.coding.code",
        "definition": "Should always be set to FIN (final answer).",
        "min": 1,
        "fixedCode": "FIN",
        "binding": {
          "strength": "required",
          "description": "Type of the Composition",
          "valueSet": "https://cambio.codes/referral-documentation-type/v1"
        }
      },
      {
        "id": "Task.output:finalAnswer.value[x]",
        "path": "Task.output.value[x]",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.cambio.se/StructureDefinition/CompositionReferralClinicalInformation/v1"
            ],
            "aggregation": [
              "bundled"
            ]
          }
        ]
      }
    ]
  }
}