<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="Interweave-Observation" />
  <url value="https://fhir.yhcr.nhs.uk/StructureDefinition/Interweave-Observation" />
  <version value="0.1.0" />
  <name value="InterweaveObservation" />
  <status value="active" />
  <date value="2024-02-19T09:37:00+00:00" />
  <publisher value="Interweave Publisher" />
  <contact>
    <name value="Interweave Publisher" />
    <telecom>
      <system value="url" />
      <value value="https://fhir.yhcr.nhs.uk/yhcr-publisher" />
    </telecom>
  </contact>
  <description value="Interweave Observation resource profile." />
  <fhirVersion value="3.0.2" />
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <mapping>
    <identity value="sct-concept" />
    <uri value="http://snomed.info/conceptdomain" />
    <name value="SNOMED CT Concept Domain Binding" />
  </mapping>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </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="sct-attr" />
    <uri value="http://snomed.org/attributebinding" />
    <name value="SNOMED CT Attribute Binding" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/w5" />
    <name value="W5 Mapping" />
  </mapping>
  <mapping>
    <identity value="sct-attr" />
    <uri value="http://snomed.info/sct" />
    <name value="SNOMED CT Attribute Binding" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Observation" />
  <baseDefinition value="https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Observation-1" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation">
      <path value="Observation" />
      <constraint>
        <key value="valint-1" />
        <severity value="error" />
        <human value="Cannot have both valueInteger and value[x]" />
        <expression value="valueInteger.exists() != value.exists()" />
      </constraint>
    </element>
    <element id="Observation.id">
      <path value="Observation.id" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta">
      <path value="Observation.meta" />
    </element>
    <element id="Observation.meta.versionId">
      <path value="Observation.meta.versionId" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.lastUpdated">
      <path value="Observation.meta.lastUpdated" />
      <short value="MANDATORY except in Contained Resources. When the resource version last changed." />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.profile">
      <path value="Observation.meta.profile" />
      <short value="Profiles this resource claims to conform to. Should list (i) this profile (ii) underlying CareConnect profile" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.security">
      <path value="Observation.meta.security" />
      <short value="DISCOURAGED - may not be honoured by Data Consumers" />
    </element>
    <element id="Observation.meta.tag">
      <path value="Observation.meta.tag" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="Observation.meta.tag:Source">
      <path value="Observation.meta.tag" />
      <sliceName value="Source" />
      <short value="MANDATORY except in Contained Resources. The Data Provider Id (and display text) of the system supplying the data" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.tag:Source.system">
      <path value="Observation.meta.tag.system" />
      <min value="1" />
      <fixedUri value="https://yhcr.nhs.uk/Source" />
    </element>
    <element id="Observation.meta.tag:Source.code">
      <path value="Observation.meta.tag.code" />
      <short value="The Data Provider Id of the system supplying the data" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.tag:Source.display">
      <path value="Observation.meta.tag.display" />
      <short value="Name of the system supplying the data" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.tag:Provenance">
      <path value="Observation.meta.tag" />
      <sliceName value="Provenance" />
      <short value="MANDATORY except in Contained Resources. The ODS Code (and display text) of the organisation responsible for the data" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.tag:Provenance.system">
      <path value="Observation.meta.tag.system" />
      <min value="1" />
      <fixedUri value="https://yhcr.nhs.uk/Provenance" />
    </element>
    <element id="Observation.meta.tag:Provenance.code">
      <path value="Observation.meta.tag.code" />
      <short value="The ODS Code of the organisation responsible for the data" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.meta.tag:Provenance.display">
      <path value="Observation.meta.tag.display" />
      <short value="Name of the organisation supplying the data" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.implicitRules">
      <path value="Observation.implicitRules" />
      <short value="DISCOURAGED - may not be honoured by Data Consumers" />
    </element>
    <element id="Observation.language">
      <path value="Observation.language" />
      <short value="English is assumed (not currently a multi-lingual implementation)" />
    </element>
    <element id="Observation.text">
      <path value="Observation.text" />
      <short value="DISCOURAGED - the preferred approach is to offer structured data fields which a Data Consumer can then render and present in a manner most suited to its users" />
    </element>
    <element id="Observation.extension">
      <path value="Observation.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
    </element>
    <element id="Observation.extension:valuePrecision">
      <path value="Observation.extension" />
      <sliceName value="valuePrecision" />
      <short value="Explicit precision of the number" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.yhcr.nhs.uk/StructureDefinition/Extension-Interweave-ValuePrecision" />
      </type>
    </element>
    <element id="Observation.extension:valueInteger">
      <path value="Observation.extension" />
      <sliceName value="valueInteger" />
      <short value="Inline with R4, we have pre-adopted the valueInteger field." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.yhcr.nhs.uk/StructureDefinition/Extension-Interweave-R4ValueInteger" />
      </type>
    </element>
    <element id="Observation.identifier">
      <path value="Observation.identifier" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.basedOn">
      <path value="Observation.basedOn" />
      <short value="DISCOURAGED - This field does not appear to provide information which would be beneficial in a shared care record. It also allows references to a raft of request/order resources which introduces a lot of complexity for a data consumer." />
    </element>
    <element id="Observation.status">
      <path value="Observation.status" />
      <short value="Only finalised observations should be shared. We do also allow for amendments and corrections to the final observation to take place. We therefore limit the list of statuses which can be used to the following - final | amended | corrected" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.category">
      <path value="Observation.category" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="coding.system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.category:observationCategory">
      <path value="Observation.category" />
      <sliceName value="observationCategory" />
      <min value="1" />
      <max value="1" />
      <binding>
        <strength value="required" />
      </binding>
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <mustSupport value="true" />
      <binding>
        <strength value="preferred" />
        <valueSetReference>
          <reference value="https://fhir.hl7.org.uk/STU3/ValueSet/CareConnect-ObservationType-1" />
        </valueSetReference>
      </binding>
    </element>
    <element id="Observation.code.coding.system">
      <path value="Observation.code.coding.system" />
      <min value="1" />
    </element>
    <element id="Observation.code.coding.code">
      <path value="Observation.code.coding.code" />
      <min value="1" />
    </element>
    <element id="Observation.code.coding.display">
      <path value="Observation.code.coding.display" />
      <min value="1" />
    </element>
    <element id="Observation.subject">
      <path value="Observation.subject" />
      <short value="The patient whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Patient-1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.subject.reference">
      <path value="Observation.subject.reference" />
      <short value="Reference to a resource (could be Contained)" />
      <min value="1" />
    </element>
    <element id="Observation.subject.identifier">
      <path value="Observation.subject.identifier" />
      <short value="If relevant could include an id" />
    </element>
    <element id="Observation.subject.display">
      <path value="Observation.subject.display" />
      <short value="Description of the referenced resource" />
      <min value="1" />
    </element>
    <element id="Observation.context">
      <path value="Observation.context" />
      <short value="The encounter during which this observation is made." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Encounter-1" />
      </type>
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <short value="This is the time/time period during which the observation was taken." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.issued">
      <path value="Observation.issued" />
      <max value="0" />
    </element>
    <element id="Observation.performer">
      <path value="Observation.performer" />
      <short value="Who is responsible for the observation." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Practitioner-1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.performer.reference">
      <path value="Observation.performer.reference" />
      <short value="Reference to a resource (could be Contained)" />
      <min value="1" />
    </element>
    <element id="Observation.performer.identifier">
      <path value="Observation.performer.identifier" />
      <short value="If relevant could include an id" />
    </element>
    <element id="Observation.performer.display">
      <path value="Observation.performer.display" />
      <short value="Description of the referenced resource" />
      <min value="1" />
    </element>
    <element id="Observation.value[x]">
      <path value="Observation.value[x]" />
      <type>
        <code value="Quantity" />
      </type>
      <type>
        <code value="CodeableConcept" />
      </type>
      <type>
        <code value="string" />
      </type>
      <type>
        <code value="boolean" />
      </type>
      <type>
        <code value="Range" />
      </type>
      <type>
        <code value="Ratio" />
      </type>
      <type>
        <code value="SampledData" />
      </type>
      <type>
        <code value="time" />
      </type>
      <type>
        <code value="dateTime" />
      </type>
      <type>
        <code value="Period" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.dataAbsentReason">
      <path value="Observation.dataAbsentReason" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
      </binding>
    </element>
    <element id="Observation.dataAbsentReason.coding.system">
      <path value="Observation.dataAbsentReason.coding.system" />
      <min value="1" />
    </element>
    <element id="Observation.dataAbsentReason.coding.code">
      <path value="Observation.dataAbsentReason.coding.code" />
      <min value="1" />
    </element>
    <element id="Observation.dataAbsentReason.coding.display">
      <path value="Observation.dataAbsentReason.coding.display" />
      <min value="1" />
    </element>
    <element id="Observation.interpretation">
      <path value="Observation.interpretation" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
      </binding>
    </element>
    <element id="Observation.comment">
      <path value="Observation.comment" />
      <short value="Comments about the result" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.bodySite">
      <path value="Observation.bodySite" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
      </binding>
    </element>
    <element id="Observation.method">
      <path value="Observation.method" />
      <binding>
        <strength value="preferred" />
      </binding>
    </element>
    <element id="Observation.method.coding.system">
      <path value="Observation.method.coding.system" />
      <min value="1" />
    </element>
    <element id="Observation.method.coding.code">
      <path value="Observation.method.coding.code" />
      <min value="1" />
    </element>
    <element id="Observation.method.coding.display">
      <path value="Observation.method.coding.display" />
      <min value="1" />
    </element>
    <element id="Observation.specimen">
      <path value="Observation.specimen" />
      <short value="Specimen used for this observation." />
    </element>
    <element id="Observation.specimen.reference">
      <path value="Observation.specimen.reference" />
      <short value="Reference to a resource (could be Contained)" />
      <min value="1" />
    </element>
    <element id="Observation.specimen.identifier">
      <path value="Observation.specimen.identifier" />
      <short value="If relevant could include an id" />
    </element>
    <element id="Observation.specimen.display">
      <path value="Observation.specimen.display" />
      <short value="If relevant, description of the referenced resource" />
    </element>
    <element id="Observation.device">
      <path value="Observation.device" />
      <short value="Measurement device." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Device" />
      </type>
    </element>
    <element id="Observation.device.reference">
      <path value="Observation.device.reference" />
      <short value="Reference to a resource (could be Contained)" />
      <min value="1" />
    </element>
    <element id="Observation.device.identifier">
      <path value="Observation.device.identifier" />
      <short value="If relevant could include an id" />
    </element>
    <element id="Observation.device.display">
      <path value="Observation.device.display" />
      <short value="If relevant, description of the referenced resource" />
    </element>
    <element id="Observation.referenceRange">
      <path value="Observation.referenceRange" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.related">
      <path value="Observation.related" />
      <short value="Resources related to this observation" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.related.type">
      <path value="Observation.related.type" />
      <min value="1" />
      <fixedCode value="derived-from" />
      <mustSupport value="true" />
    </element>
    <element id="Observation.related.target">
      <path value="Observation.related.target" />
      <short value="we limit the related field’s usage to only allow links to observation resources, from which the primary observation’s value was derived. E.g. An observation may have a value which is a score, and that score may have been derived from several other observations." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.hl7.org.uk/STU3/StructureDefinition/CareConnect-Observation-1" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Observation.component">
      <path value="Observation.component" />
      <constraint>
        <key value="valint-1" />
        <severity value="error" />
        <human value="Cannot have both valueInteger and value[x]" />
        <expression value="valueInteger.exists() != value.exists()" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Observation.component.extension">
      <path value="Observation.component.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
    </element>
    <element id="Observation.component.extension:valuePrecision">
      <path value="Observation.component.extension" />
      <sliceName value="valuePrecision" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.yhcr.nhs.uk/StructureDefinition/Extension-Interweave-ValuePrecision" />
      </type>
    </element>
    <element id="Observation.component.extension:valueInteger">
      <path value="Observation.component.extension" />
      <sliceName value="valueInteger" />
      <short value="Inline with R4, we have pre-adopted the valueInteger field." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.yhcr.nhs.uk/StructureDefinition/Extension-Interweave-R4ValueInteger" />
      </type>
    </element>
    <element id="Observation.component.code">
      <path value="Observation.component.code" />
      <mustSupport value="true" />
      <binding>
        <strength value="preferred" />
        <valueSetReference>
          <reference value="https://fhir.hl7.org.uk/STU3/ValueSet/CareConnect-ObservationType-1" />
        </valueSetReference>
      </binding>
    </element>
    <element id="Observation.component.code.coding.system">
      <path value="Observation.component.code.coding.system" />
      <min value="1" />
    </element>
    <element id="Observation.component.code.coding.code">
      <path value="Observation.component.code.coding.code" />
      <min value="1" />
    </element>
    <element id="Observation.component.code.coding.display">
      <path value="Observation.component.code.coding.display" />
      <min value="1" />
    </element>
    <element id="Observation.component.code.coding:snomedCT">
      <path value="Observation.component.code.coding" />
      <sliceName value="snomedCT" />
      <mustSupport value="true" />
      <binding>
        <strength value="preferred" />
      </binding>
    </element>
    <element id="Observation.component.value[x]">
      <path value="Observation.component.value[x]" />
      <type>
        <code value="Quantity" />
      </type>
      <type>
        <code value="CodeableConcept" />
      </type>
      <type>
        <code value="string" />
      </type>
      <type>
        <code value="Range" />
      </type>
      <type>
        <code value="Ratio" />
      </type>
      <type>
        <code value="SampledData" />
      </type>
      <type>
        <code value="time" />
      </type>
      <type>
        <code value="dateTime" />
      </type>
      <type>
        <code value="Period" />
      </type>
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>