<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="lt-observation" />
  <url value="http://esveikata.lt/Profile/Observation" />
  <version value="1.0.0" />
  <name value="LtObservation" />
  <status value="active" />
  <date value="2023-02-09" />
  <description value="Lithuanian national fhir profile for an Observation (Analitė)." />
  <fhirVersion value="5.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Observation" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation.code">
      <path value="Observation.code" />
      <constraint>
        <key value="lt-bundle-1" />
        <severity value="error" />
        <human value="Observation name must be defined." />
        <expression value="coding.display.hasValue() or text.hasValue()" />
      </constraint>
    </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" />
      <short value="Analitės kodas" />
      <min value="1" />
    </element>
    <element id="Observation.code.coding.display">
      <path value="Observation.code.coding.display" />
      <short value="Analitės pavadinimas" />
    </element>
    <element id="Observation.code.text">
      <path value="Observation.code.text" />
      <short value="Analitės pavadinimas" />
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.value[x]">
      <path value="Observation.value[x]" />
      <short value="Analitės tyrimo rezultatas / matavimo vienetas" />
      <min value="1" />
      <constraint>
        <key value="lt-bundle-2" />
        <severity value="error" />
        <human value="Observation value Quantity must contain unit and value." />
        <expression value="($this is Quantity).not() or ($this.unit.hasValue() and $this.unit.hasValue())" />
      </constraint>
      <constraint>
        <key value="lt-bundle-3" />
        <severity value="error" />
        <human value="Observation value CodeableConcept must contain a text representation of the concept." />
        <expression value="($this is CodeableConcept).not() or ($this.text.hasValue() or $this.coding.display.hasValue())" />
      </constraint>
      <constraint>
        <key value="lt-bundle-4" />
        <severity value="error" />
        <human value="Observation value Range must contain unit and value for a low or high range value." />
        <expression value="($this is Range).not() or ($this.low.unit.hasValue() and $this.low.unit.hasValue()) or ($this.high.unit.hasValue() and $this.high.unit.hasValue())" />
      </constraint>
      <constraint>
        <key value="lt-bundle-5" />
        <severity value="error" />
        <human value="Observation value Ratio must contain unit and value for numerator and denomitator values." />
        <expression value="($this is Ratio).not() or ($this.numerator.unit.hasValue() and $this.numerator.value.hasValue() and $this.denominator.unit.hasValue() and $this.denominator.value.hasValue())" />
      </constraint>
      <constraint>
        <key value="lt-bundle-6" />
        <severity value="error" />
        <human value="Observation value SampledData must contain unit and value for origin field." />
        <expression value="($this is SampledData).not() or ($this.origin.unit.hasValue() and $this.origin.value.hasValue())" />
      </constraint>
    </element>
    <element id="Observation.note">
      <path value="Observation.note" />
      <short value="Pastaba analitei" />
    </element>
    <element id="Observation.method">
      <path value="Observation.method" />
      <short value="Analizės metodas" />
      <min value="1" />
    </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.referenceRange">
      <path value="Observation.referenceRange" />
      <short value="Analitės referencinis dydis" />
      <min value="1" />
    </element>
  </differential>
</StructureDefinition>