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