<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="PulmonaryMeasurement" />
  <url value="https://simplifier.net/pulmonary-measurement/PulmonaryMeasurement" />
  <version value="0.2" />
  <name value="PulmonaryMeasurement" />
  <status value="draft" />
  <date value="2025-05-09" />
  <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">
      <path value="Observation" />
      <short value="Pulmonary measurement" />
      <definition value="Observation ressource for capturing results of a pulmonary measurement" />
    </element>
    <element id="Observation.id">
      <path value="Observation.id" />
      <patternId value="PulmonaryMeasurement" />
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <patternCodeableConcept>
        <coding>
          <system value="http://loinc.org" />
          <code value="94070-8" />
          <display value="Spirometry" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.code.coding">
      <path value="Observation.code.coding" />
      <max value="0" />
    </element>
    <element id="Observation.code.text">
      <path value="Observation.code.text" />
      <max value="0" />
    </element>
    <element id="Observation.subject">
      <path value="Observation.subject" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
      </type>
    </element>
    <element id="Observation.encounter">
      <path value="Observation.encounter" />
      <short value="Healthcare encounter related to the observation" />
      <definition value="The healthcare encounter during which the observation was made." />
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <short value="The time of the observation" />
      <definition value="The time or time period the observation was made." />
      <min value="1" />
      <type>
        <code value="dateTime" />
      </type>
      <type>
        <code value="Period" />
      </type>
    </element>
    <element id="Observation.performer">
      <path value="Observation.performer" />
      <short value="Who performed the measurement" />
      <definition value="Who was responsible for performing the measurement." />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/CareTeam" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson" />
      </type>
    </element>
    <element id="Observation.device">
      <path value="Observation.device" />
      <short value="A reference to the device used for the measurement" />
      <definition value="A reference to the used device that generates the measurement values." />
      <min value="1" />
    </element>
    <element id="Observation.component">
      <path value="Observation.component" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="code.coding.code" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <definition value="Component results of the pulmonary measurement, such as FEV1, FVC, FEF25." />
    </element>
    <element id="Observation.component:BodyHeight">
      <path value="Observation.component" />
      <sliceName value="BodyHeight" />
      <code>
        <system value="http://loinc.org" />
        <code value="3137-7" />
        <display value="Body Height" />
      </code>
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.component:BodyHeight.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="1" />
      <type>
        <code value="Quantity" />
      </type>
      <patternQuantity>
        <unit value="cm" />
        <system value="http://unitsofmeasure.org" />
        <code value="cm" />
      </patternQuantity>
    </element>
    <element id="Observation.component:BodyWeight">
      <path value="Observation.component" />
      <sliceName value="BodyWeight" />
      <code>
        <system value="http://loinc.org" />
        <code value="29463-7" />
        <display value="Body Weight" />
      </code>
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.component:BodyWeight.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="1" />
      <type>
        <code value="Quantity" />
      </type>
    </element>
    <element id="Observation.component:Gender">
      <path value="Observation.component" />
      <sliceName value="Gender" />
      <code>
        <system value="http://loinc.org" />
        <code value="46098-0" />
        <display value="Biological gender" />
      </code>
      <short value="Gender" />
      <definition value="Biological gender" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.component:Gender.value[x]">
      <path value="Observation.component.value[x]" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="Observation.component:RespRate">
      <path value="Observation.component" />
      <sliceName value="RespRate" />
      <short value="Respiratory rate" />
      <definition value="The patients respiratory rate during airway flow measurement" />
      <max value="1" />
    </element>
    <element id="Observation.component:RespRate.code">
      <path value="Observation.component.code" />
      <code>
        <system value="http://loinc.org" />
        <code value="76171-8" />
        <display value="Respiratory rate" />
      </code>
    </element>
    <element id="Observation.component:RespRate.value[x]">
      <path value="Observation.component.value[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <short value="Value of the Respitory rate" />
      <definition value="The patients respitory rate during the measurement." />
      <min value="1" />
      <type>
        <code value="integer" />
      </type>
    </element>
    <element id="Observation.component:Ethnicity">
      <path value="Observation.component" />
      <sliceName value="Ethnicity" />
      <short value="Race or ethnicity" />
      <definition value="The Race or ethnicity of the measured patient." />
      <max value="1" />
    </element>
    <element id="Observation.component:Ethnicity.code">
      <path value="Observation.component.code" />
      <short value="Code for the Race/Ethnicity" />
      <definition value="Code that represents the Race or Ethnicity." />
      <patternCodeableConcept>
        <coding>
          <system value="http://loinc.org" />
          <code value="46463-6" />
          <display value="Race or ethnicity" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.component:Ethnicity.value[x]">
      <path value="Observation.component.value[x]" />
      <short value="Value of the Race/Ethnicity" />
      <definition value="The patient's race or ethnicity." />
      <min value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <binding>
        <strength value="required" />
        <valueSet value="http://hl7.org/fhir/us/core/ValueSet/omb-race-category" />
      </binding>
    </element>
    <element id="Observation.component:DLCOsingleBreath">
      <path value="Observation.component" />
      <sliceName value="DLCOsingleBreath" />
      <short value="Diffusing Capacity for Carbon Monoxide" />
      <max value="1" />
    </element>
    <element id="Observation.component:ERV">
      <path value="Observation.component" />
      <sliceName value="ERV" />
      <short value="Expiratory reserve" />
      <max value="1" />
    </element>
    <element id="Observation.component:ERV.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:ERV.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="1" />
    </element>
    <element id="Observation.component:FEF25">
      <path value="Observation.component" />
      <sliceName value="FEF25" />
      <code>
        <system value="http://loinc.org" />
        <code value="20150-9" />
        <display value="FEF25" />
      </code>
      <short value="FEF25" />
      <definition value="Forced expiratory flow by 25% FVC" />
      <max value="1" />
    </element>
    <element id="Observation.component:FEF25.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:FEF25.code">
      <path value="Observation.component.code" />
      <short value="Code for the FEF25 component" />
      <definition value="Code that represents FEF25 measurement." />
      <patternCodeableConcept>
        <coding>
          <system value="http://loinc.org" />
          <code value="20150-9" />
          <display value="FEF25" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.component:FEF50">
      <path value="Observation.component" />
      <sliceName value="FEF50" />
      <short value="FEV50" />
      <definition value="Forced expiratory flow by 50% FVC" />
      <max value="1" />
    </element>
    <element id="Observation.component:FEF50.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:FEF50.code">
      <path value="Observation.component.code" />
      <short value="Code for the FEF50 component" />
      <definition value="Code that represents FEF50 measurement." />
      <patternCodeableConcept>
        <coding>
          <system value="http://loinc.org" />
          <code value="20151-7" />
          <display value="FEF50" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.component:FEF75">
      <path value="Observation.component" />
      <sliceName value="FEF75" />
      <short value="FEF75" />
      <definition value="Forced expiratory flow by 75% FVC" />
      <max value="1" />
    </element>
    <element id="Observation.component:FEF75.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:FEV1">
      <path value="Observation.component" />
      <sliceName value="FEV1" />
      <short value="FEV1" />
      <definition value="Forced expiatory volume by 1s forced expiration" />
      <max value="1" />
    </element>
    <element id="Observation.component:FEV1.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:FEV1.code">
      <path value="Observation.component.code" />
      <short value="Code for the FEV1 component" />
      <definition value="Code that represents FEV1 measurement." />
      <patternCodeableConcept>
        <coding>
          <system value="http://loinc.org" />
          <code value="19868-9" />
          <display value="FEV1" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Observation.component:FEV1.value[x]">
      <path value="Observation.component.value[x]" />
      <short value="Value of the FEV1 observation" />
      <definition value="The measured value of FEV1 in liters." />
    </element>
    <element id="Observation.component:FVC">
      <path value="Observation.component" />
      <sliceName value="FVC" />
      <code>
        <system value="http://loinc.org" />
        <code value="19868-9" />
        <display value="Forced Vital Capacity (FVC)" />
      </code>
      <short value="FVC" />
      <definition value="The value of Forced Vital Capacity (FVC)" />
      <max value="1" />
    </element>
    <element id="Observation.component:FVC.extension">
      <path value="Observation.component.extension" />
      <label value="measurementDetails" />
      <alias value="measurementDetails" />
    </element>
    <element id="Observation.component:FVC.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:IC">
      <path value="Observation.component" />
      <sliceName value="IC" />
      <code>
        <system value="http://loinc.org" />
        <code value="19848-1" />
        <display value="Inspoiratory capacity (Plethmograohy)" />
      </code>
      <code>
        <system value="http://loinc.org" />
        <code value="19852-3" />
        <display value="Inspiratory capacity (Spirometry)" />
      </code>
      <short value="Inspiratory capacity" />
      <definition value="The measured value of the inspoiratory capacity." />
      <max value="1" />
    </element>
    <element id="Observation.component:IC.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:MEP">
      <path value="Observation.component" />
      <sliceName value="MEP" />
      <code>
        <system value="http://loinc.org" />
        <code value="76249-2" />
        <display value="MEP" />
      </code>
      <short value="MEP" />
      <definition value="Maximum expiratory pressure of the respiratory system airway." />
      <max value="1" />
    </element>
    <element id="Observation.component:MEP.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:MIP">
      <path value="Observation.component" />
      <sliceName value="MIP" />
      <code>
        <system value="http://loinc.org" />
        <code value="60951-1" />
        <display value="Maximum inspiratory pressure" />
      </code>
      <short value="MIP" />
      <definition value="Maximum inspiratory pressure." />
      <max value="1" />
    </element>
    <element id="Observation.component:MIP.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:PEF">
      <path value="Observation.component" />
      <sliceName value="PEF" />
      <code>
        <system value="http://loinc.org" />
        <code value="33452-4" />
        <display value="Peak expiratory flow" />
      </code>
      <short value="PEF" />
      <definition value="Peak Expiratory Flow" />
      <max value="1" />
    </element>
    <element id="Observation.component:PEF.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:PFTpanel">
      <path value="Observation.component" />
      <sliceName value="PFTpanel" />
      <code>
        <system value="http://loinc.org" />
        <code value="81458-2" />
        <display value="Pulmonary function test panel" />
      </code>
      <short value="PFT Panel" />
      <definition value="Pulmonary function test panel&#xD;&#xA;e.g. Pre or Post" />
      <max value="1" />
    </element>
    <element id="Observation.component:RV">
      <path value="Observation.component" />
      <sliceName value="RV" />
      <code>
        <system value="http://loinc.org" />
        <code value="20146-7" />
      </code>
      <short value="Residual volume" />
      <max value="1" />
    </element>
    <element id="Observation.component:RV.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:TLC">
      <path value="Observation.component" />
      <sliceName value="TLC" />
      <code>
        <system value="http://loinc.org" />
        <code value="19862-2" />
        <display value="Total lung capacity" />
      </code>
      <code>
        <system value="http://loinc.org" />
        <code value="19859-8" />
        <display value="Total lung capacity by Plethysmograph body box" />
      </code>
      <short value="TLC" />
      <definition value="Total Lung Capacity" />
      <max value="1" />
    </element>
    <element id="Observation.component:TLC.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Observation.component:VC">
      <path value="Observation.component" />
      <sliceName value="VC" />
      <code>
        <system value="http://loinc.org" />
        <code value="19867-1" />
        <display value="Vital capacity" />
      </code>
      <short value="VC" />
      <definition value="Vital capacity [Volume] Respiratory system" />
      <max value="1" />
    </element>
    <element id="Observation.component:VC.extension:pulmonaryReferenceValues">
      <path value="Observation.component.extension" />
      <sliceName value="pulmonaryReferenceValues" />
      <type>
        <code value="Extension" />
        <profile value="https://simplifier.net/pulmonary-measurement/PulmonaryReferenceValues" />
      </type>
      <isModifier value="false" />
    </element>
  </differential>
</StructureDefinition>