<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-observation-results" />
  <url value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-observation-results" />
  <version value="1.0.1" />
  <name value="ObservationProfileLaboratory" />
  <title value="Observation Profile (Laboratory Results)" />
  <status value="draft" />
  <date value="2024-12-27" />
  <publisher value="HL7 Canada - FHIR Implementation Work Group" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="https://infocentral.infoway-inforoute.ca/en/collaboration/wg/fhir-implementations" />
    </telecom>
  </contact>
  <description value="Proposed constraints on the Observation Resource to represent results produced by laboratory tests or panels/studies" />
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166" />
      <code value="CA" />
    </coding>
  </jurisdiction>
  <fhirVersion value="4.0.1" />
  <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>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Observation" />
  <baseDefinition value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-observation" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation">
      <path value="Observation" />
      <short value="Observation Profile" />
      <definition value="The Observation Profile is based upon the core FHIR Observation Resource" />
      <constraint>
        <key value="ca-baseline-results-1" />
        <severity value="warning" />
        <human value="SHOULD use SNOMED CT for coded Results" />
        <expression value="(component.value | value).ofType(Quantity).all(system = 'http://unitsofmeasure.org')" />
      </constraint>
    </element>
    <element id="Observation.status">
      <path value="Observation.status" />
      <comment value="Statuses are fundamental to understanding lab domain results. This element is considered mandatory and is a modifier element in the base specification. This profile is seeking community and implementer feedback on whether the MustSupport flag that has been reintroduced in this profile elicits further challenges to systems." />
    </element>
    <element id="Observation.category">
      <path value="Observation.category" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Observation.category:laboratory">
      <path value="Observation.category" />
      <sliceName value="laboratory" />
      <short value="FHIR standard classification of type of observation" />
      <comment value="This profile is scoped to an event (results) which includes constraints for that event. Profiles such as the OLIS Lab Observation Profile may be scoped more broadly to include modelling for more than just a single results step in the workflow. Both forms of modelling are appropriate, however implementers should be aware of the impact of scope on the setting of constraints (like this slice) and acknowledge that if their own profile is different in scope than the CA Baseline profile, it is not expected that they meet all the constraints outlined in this profile and it may be appropriate to review the generic observation profile instead." />
      <min value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <patternCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/observation-category" />
          <code value="laboratory" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <comment value="The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the LOINC or PCLOCD code system for interoperability purposes but are not required to do so to be considered conformant. *All* code-value and, if present, component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation." />
      <binding>
        <strength value="preferred" />
        <description value="LOINC codes identifying names of simple observations." />
        <valueSet value="http://hl7.org/fhir/ValueSet/observation-codes" />
      </binding>
    </element>
    <element id="Observation.subject">
      <path value="Observation.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Group" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Device" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Location" />
      </type>
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <type>
        <code value="dateTime" />
      </type>
      <type>
        <code value="Period" />
      </type>
      <constraint>
        <key value="ca-baseline-datetime" />
        <severity value="error" />
        <human value="Datetime SHALL be at least to day" />
        <expression value="($this as dateTime).toString().length() &gt;= 8" />
      </constraint>
    </element>
    <element id="Observation.issued">
      <path value="Observation.issued" />
      <comment value="Implementors should consider adding a must support flag in the case that the relevant systems are not able to support effective, but are able to support issued." />
    </element>
    <element id="Observation.performer">
      <path value="Observation.performer" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitioner" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitionerrole" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-organization" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient" />
      </type>
    </element>
    <element id="Observation.value[x]">
      <path value="Observation.value[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Observation.value[x]:valueCodeableConcept">
      <path value="Observation.value[x]" />
      <sliceName value="valueCodeableConcept" />
      <comment value="A coded value **SHOULD**  be selected from [SNOMED CT](http://www.snomed.org)." />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="Observation.value[x]:valueCodeableConcept.coding">
      <path value="Observation.value[x].coding" />
    </element>
    <element id="Observation.value[x]:valueCodeableConcept.coding.system">
      <path value="Observation.value[x].coding.system" />
      <short value="FHIR standard classification of type of observation code system" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.value[x]:valueCodeableConcept.coding.code">
      <path value="Observation.value[x].coding.code" />
      <short value="A code defining laboratory result" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.value[x]:valueQuantity">
      <path value="Observation.value[x]" />
      <sliceName value="valueQuantity" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
    <element id="Observation.value[x]:valueQuantity.value">
      <path value="Observation.value[x].value" />
      <min value="1" />
    </element>
    <element id="Observation.value[x]:valueQuantity.system">
      <path value="Observation.value[x].system" />
    </element>
    <element id="Observation.dataAbsentReason">
      <path value="Observation.dataAbsentReason" />
      <comment value="This element is recommended for support and was initially flagged as must support but was later determined to be too strong for some types of lab result profiles that want to derive from the CA Baseline but do not need a dataAbsentReason concept" />
    </element>
    <element id="Observation.interpretation">
      <path value="Observation.interpretation" />
      <comment value="This element is recommended for support and was initially flagged as must support but was later determined to be too strong for some types of lab result profiles (e.g., antibody results, blood typing results, etc.) that want to derive from the CA Baseline but do not have an interpretation concept (e.g., norm/abnormal, high/low)." />
    </element>
    <element id="Observation.referenceRange">
      <path value="Observation.referenceRange" />
      <comment value="This element is recommended for support and was initially flagged as must support but was later determined to be too strong for some types of lab result profiles (e.g., labs with non-numeric results) that want to derive from the CA Baseline but do not have a need for a numeric reference range concept." />
    </element>
    <element id="Observation.hasMember">
      <path value="Observation.hasMember" />
      <comment value="This element was initially flagged as must support but was later determined to be too strong for some types of lab result profile that want to derive from the CA Baseline but do not have a use hasMember to link results. Examples of these include but are not limited to non-panel results and panel result implementations that use alternative methods like ServiceRequest or DiagnosticReport to link panel results together." />
    </element>
    <element id="Observation.component">
      <path value="Observation.component" />
      <comment value="Some elements underneath this backbone element are considered must support. This does not incur the expectation to support these elements for any implementers that do not need to support the parent concept of observation.component. This may need to be evaluated in the future as implementations seek to derive directly from the CA Baseline profiles" />
    </element>
    <element id="Observation.component.code">
      <path value="Observation.component.code" />
      <comment value="The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the LOINC code system for interoperability purposes but are not required to do so to be considered conformant. *All* code-value and, if present, component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation." />
      <binding>
        <strength value="preferred" />
        <description value="LOINC codes identifying names of simple observations." />
        <valueSet value="http://hl7.org/fhir/ValueSet/observation-codes" />
      </binding>
    </element>
    <element id="Observation.component.value[x]">
      <path value="Observation.component.value[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Observation.component.value[x]:valueCodeableConcept">
      <path value="Observation.component.value[x]" />
      <sliceName value="valueCodeableConcept" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="Observation.component.value[x]:valueCodeableConcept.coding">
      <path value="Observation.component.value[x].coding" />
      <short value="FHIR standard classification of type of observation code system" />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Observation.component.value[x]:valueCodeableConcept.coding.system">
      <path value="Observation.component.value[x].coding.system" />
      <short value="FHIR standard classification of type of observation code system" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.component.value[x]:valueCodeableConcept.coding.code">
      <path value="Observation.component.value[x].coding.code" />
      <short value="A code defining laboratory result" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.component.value[x]:valueQuantity">
      <path value="Observation.component.value[x]" />
      <sliceName value="valueQuantity" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
    <element id="Observation.component.value[x]:valueQuantity.value">
      <path value="Observation.component.value[x].value" />
      <min value="1" />
    </element>
    <element id="Observation.component.value[x]:valueQuantity.system">
      <path value="Observation.component.value[x].system" />
    </element>
    <element id="Observation.component.dataAbsentReason">
      <path value="Observation.component.dataAbsentReason" />
    </element>
  </differential>
</StructureDefinition>