<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="DataStandardsWales-PSOM-CarePlan" />
  <url value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-PSOM-CarePlan" />
  <name value="DataStandardsWalesPSOMCarePlan" />
  <title value="Data Standards Wales PSOM CarePlan" />
  <status value="active" />
  <publisher value="NHS Wales" />
  <contact>
    <name value="Data Standards" />
    <telecom>
      <system value="email" />
      <value value="data.standards@wales.nhs.uk" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="The clinical circumstance for PROMs collection. The CarePlan is used to group Collection Events and provide context to the pathway." />
  <purpose value="The CarePlan functions as linking pin of all DSCN metadata relevant for a clinical circumstance." />
  <copyright value="© 2023 NHS Wales." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="PROMs-Metadata-2024004" />
    <name value="NHS Wales DSCN Metadata Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="CarePlan" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/CarePlan" />
  <derivation value="constraint" />
  <differential>
    <element id="CarePlan">
      <path value="CarePlan" />
      <short value="Clinical Circumstance" />
    </element>
    <element id="CarePlan.extension">
      <path value="CarePlan.extension" />
      <min value="1" />
    </element>
    <element id="CarePlan.extension:pathwayLaterality">
      <path value="CarePlan.extension" />
      <sliceName value="pathwayLaterality" />
      <short value="Laterality of the PSOM pathway" />
      <definition value="The laterality is used to capture the anatomical side associated with the healthcare referral / pathway record." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-PSOM-PathwayLaterality" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="CarePlan.identifier">
      <path value="CarePlan.identifier" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="CarePlan.identifier:referralIdentifier">
      <path value="CarePlan.identifier" />
      <sliceName value="referralIdentifier" />
      <type>
        <code value="Identifier" />
        <profile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-PSOM-ReferralIdentifier" />
      </type>
    </element>
    <element id="CarePlan.status">
      <path value="CarePlan.status" />
      <comment value="In interactions between the Health Board and the PROMs provider, the CarePlan uses the following statuses:&#xA;&#xA;* Requesting PROMs collection = _active_&#xD;&#xA;* Providing PROMs collection = _active_  &#xA;* Cancelling PROMs collection = _revoked_" />
    </element>
    <element id="CarePlan.intent">
      <path value="CarePlan.intent" />
      <comment value="In interactions between the Health Board and the PROMs provider, the CarePlan intent is fixed as:&#xA;&#xA;* Requesting PROMs collection = _order_ &#xD;&#xA;* Providing PROMs collection = _order_&#xA;* Cancelling PROMs collection = _order_" />
    </element>
    <element id="CarePlan.category">
      <path value="CarePlan.category" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="2" />
    </element>
    <element id="CarePlan.category:treatmentSpecialty">
      <path value="CarePlan.category" />
      <sliceName value="treatmentSpecialty" />
      <short value="Treatment Specialty Code" />
      <definition value="The code for the pathway specialty at the time the PROMs form is generated." />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <description value="Identifies the pathway specialty" />
        <valueSet value="http://hl7.org/fhir/ValueSet/c80-practice-codes" />
      </binding>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MEDPX001X" />
        <comment value="Treatment Specialty Code" />
      </mapping>
    </element>
    <element id="CarePlan.category:pathwayType">
      <path value="CarePlan.category" />
      <sliceName value="pathwayType" />
      <short value="PROMs Pathway Type" />
      <definition value="The type of pathway that the PROM is associated to, e.g. lung cancer, heart failure, cataract, etc." />
      <comment value="For local pathways use `.coding.code` _OTH_ and fill the Local PROMs Pathway Type in `.text`." />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <description value="Identifies the type of pathway" />
        <valueSet value="https://fhir.nhs.wales/ValueSet/DataStandardsWales-PSOM-PathwayType" />
      </binding>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPRPX005X" />
        <comment value="PROMs Pathway Type" />
      </mapping>
    </element>
    <element id="CarePlan.category:pathwayType.text">
      <path value="CarePlan.category.text" />
      <short value="Local PROMs Pathway Type" />
      <definition value="A locally-defined code to identify the PROMs pathway. This type is only required for local pathways." />
      <comment value="For local pathways `.coding.code` SHALL be filled with _OTH_." />
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPRPX009X" />
        <comment value="Local PROMs Pathway Type" />
      </mapping>
    </element>
    <element id="CarePlan.subject">
      <path value="CarePlan.subject" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Patient" />
      </type>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX001X" />
        <comment value="NHS Number (implicit, main mapping is on Patient.identifier:nhsNumber)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX001A" />
        <comment value="NHS Number Status Indicator (implicit, main mapping is on Patient.identifier:nhsNumber.extension:nhsNumberVerificationStatus)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX002A" />
        <comment value="Local Person Identifier Origination (implicit, main mapping is on Patient.identifier:[HealthBoard]PasIdentifier.type)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX002X" />
        <comment value="Local Person Identifier (implicit, main mapping is on Patient.identifier:[HealthBoard]PasIdentifier.value)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX003X" />
        <comment value="Given Name (implicit, main mapping is on Patient.name.given)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX004X" />
        <comment value="Family Name (implicit, main mapping is on Patient.name.family)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX005X" />
        <comment value="Date of Birth (implicit, main mapping is on Patient.birthDate)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX006X" />
        <comment value="Gender Identity (implicit, main mapping is on Patient.gender)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MPDPX007X" />
        <comment value="Postcode (implicit, main mapping is on Patient.address.postalCode)" />
      </mapping>
    </element>
    <element id="CarePlan.author">
      <path value="CarePlan.author" />
      <short value="Reference to Senior Responsible Professional and Originating Organisation" />
      <definition value="Reference to Senior Responsible Professional and Originating Organisation" />
      <comment value="Each occurrence of a Senior Responsible Professional is represented by two FHIR resources: a PractitionerRole resource (instance of DataStandardsWales-PractitionerRole) and a Practitioner resource (DataStandardsWales-Practitioner). The Originating Organisation is related to the Senior Responsible Professional and is represented by the Organization resorce (instance of DataStandardsWales-Organization). The Practitioner and Organization resource are both referenced from the PractitionerRole instance through the elements `.practitioner` and `.organization` respectively. Sending systems should fill the reference to the PractitionerRole instance here. Receiving systems can then retrieve the reference to the Practitioner and the Organization resource from that PractitionerRole instance.&#xD;&#xA;&#xD;&#xA;While the `.author` element is a good fit for holding the Senior Responsible Professional information, a more elaborate approach could be to use a dedicated CareTeam resource referenced through the `.careTeam` element. However, to reduce implementation workload, we have decided to continue using the `.author` element for this information in the current version." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-PractitionerRole" />
      </type>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MEDPX002A" />
        <comment value="Senior Responsible Professional Name (implicit, main mapping is on Practitioner.name)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MEDPX002B" />
        <comment value="Senior Responsible Professional Identifier Code System (implicit, main mapping is on Practitioner.identifier.system)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MEDPX002C" />
        <comment value="Senior Responsible Professional Identifier (implicit, main mapping is on Practitioner.identifier.value)" />
      </mapping>
      <mapping>
        <identity value="PROMs-Metadata-2024004" />
        <map value="MDDPX002X" />
        <comment value="Originating Organisation Code (implicit, main mapping is on Organization.identifier)" />
      </mapping>
    </element>
    <element id="CarePlan.activity">
      <path value="CarePlan.activity" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="reference.resolve()" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="CarePlan.activity.outcomeReference">
      <path value="CarePlan.activity.outcomeReference" />
      <comment value="The outcome of activities may trigger or lead to re-evaluation of the PROMs collection schedule. For now references to Encounter and Procedure are added because these resources most likely contain information relevant for PROMs collection." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Encounter" />
        <targetProfile value="https://fhir.hl7.org.uk/StructureDefinition/UKCore-Procedure" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Resource" />
      </type>
    </element>
    <element id="CarePlan.activity.reference">
      <path value="CarePlan.activity.reference" />
      <comment value="Proposed activities may trigger or lead to re-evaluation of the PROMs collection schedule. For now references to Appointment and ServiceRequest are added because these resources most likely contain information relevant for PROMs collection.&#xD;&#xA;&#xD;&#xA;Each reference to an Appointment or a ServiceRequest represents a planned activity that functions as a trigger for the PROMs provider to re-evaluate the PROMs collection schedule and adjust if necessary." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Appointment" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-ServiceRequest" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/CommunicationRequest" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/DeviceRequest" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/NutritionOrder" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/VisionPrescription" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/RequestGroup" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/MedicationRequest" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Task" />
      </type>
    </element>
    <element id="CarePlan.activity:completeQuestionnaire">
      <path value="CarePlan.activity" />
      <sliceName value="completeQuestionnaire" />
    </element>
    <element id="CarePlan.activity:completeQuestionnaire.outcomeCodeableConcept">
      <path value="CarePlan.activity.outcomeCodeableConcept" />
      <max value="0" />
    </element>
    <element id="CarePlan.activity:completeQuestionnaire.outcomeReference">
      <path value="CarePlan.activity.outcomeReference" />
      <max value="0" />
    </element>
    <element id="CarePlan.activity:completeQuestionnaire.progress">
      <path value="CarePlan.activity.progress" />
      <max value="0" />
    </element>
    <element id="CarePlan.activity:completeQuestionnaire.reference">
      <path value="CarePlan.activity.reference" />
      <short value="PSOM Task reference" />
      <definition value="Each reference to a Task represents a PROMs Tool within a Collection Event. A Collection Event is a trigger to request a patient to fill in a specific PROMs Tool and to receive the scores and answers filled in by the patient." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-PSOM-Task" />
      </type>
    </element>
    <element id="CarePlan.activity:completeQuestionnaire.detail">
      <path value="CarePlan.activity.detail" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>