<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="Mxx-HealthHub-Observation" />
  <url value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_Observation" />
  <version value="1.5.0" />
  <name value="Mxx_HealthHub_Observation" />
  <status value="active" />
  <publisher value="medatixx GmbH &amp; Co. KG" />
  <description value="Laboratory values and vital signs from the patient record. Laboratory results are coded against Mxx_HealthHub_CS_LabCodes (locally defined identifiers, no LOINC mapping). Includes reference ranges and abnormal flags. Supports both laboratory results and vital signs (height, weight)." />
  <copyright value="medatixx GmbH &amp; Co. KG" />
  <fhirVersion value="4.0.1" />
  <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="Lab values and vital signs" />
      <definition value="Represents laboratory values and vital signs (height, weight) from the patient record. Individual values are usually `final`; laboratory values from an incomplete or amended report may be `preliminary` or `amended` (see `Observation.status`). Laboratory results are coded against Mxx_HealthHub_CS_LabCodes; consumers are responsible for any translations to standard terminologies they require." />
    </element>
    <element id="Observation.identifier">
      <path value="Observation.identifier" />
      <max value="0" />
    </element>
    <element id="Observation.basedOn">
      <path value="Observation.basedOn" />
      <max value="0" />
    </element>
    <element id="Observation.partOf">
      <path value="Observation.partOf" />
      <max value="0" />
    </element>
    <element id="Observation.status">
      <path value="Observation.status" />
      <short value="final | preliminary | amended" />
      <definition value="Status of the individual value. Vital signs and complete laboratory results are `final`; a value delivered as part of an incomplete report may be `preliminary`, and `amended` when a previously delivered value was changed. Values with status `cancelled` or `entered-in-error` are not returned. Report-level completeness is additionally expressed via `DiagnosticReport.status`." />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.medatixx.de/HealthHub/ValueSet/Mxx_HealthHub_VS_ObservationStatus" />
      </binding>
    </element>
    <element id="Observation.category">
      <path value="Observation.category" />
      <short value="laboratory | vital-signs" />
      <definition value="Classifies the observation as either a laboratory result or a vital sign measurement." />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.category.coding">
      <path value="Observation.category.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.category.coding.system">
      <path value="Observation.category.coding.system" />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/observation-category" />
    </element>
    <element id="Observation.category.coding.code">
      <path value="Observation.category.coding.code" />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.medatixx.de/HealthHub/ValueSet/Mxx_HealthHub_VS_ObservationCategory" />
      </binding>
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <short value="Lab test code" />
      <definition value="The lab test identifier. Coded against Mxx_HealthHub_CS_LabCodes (no LOINC mapping). The text element provides the human-readable test name." />
    </element>
    <element id="Observation.code.coding">
      <path value="Observation.code.coding" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <max value="*" />
    </element>
    <element id="Observation.code.coding:labCode">
      <path value="Observation.code.coding" />
      <sliceName value="labCode" />
      <short value="Practice-internal lab test code" />
      <definition value="Laboratory result coded against Mxx_HealthHub_CS_LabCodes (practice-internal identifiers, no LOINC mapping). Used by the laboratory-value read path." />
      <max value="1" />
    </element>
    <element id="Observation.code.coding:labCode.system">
      <path value="Observation.code.coding.system" />
      <min value="1" />
      <fixedUri value="https://fhir.medatixx.de/HealthHub/CodeSystem/Mxx_HealthHub_CS_LabCodes" />
    </element>
    <element id="Observation.code.coding:labCode.code">
      <path value="Observation.code.coding.code" />
      <short value="Lab test code" />
      <min value="1" />
    </element>
    <element id="Observation.code.coding:labCode.display">
      <path value="Observation.code.coding.display" />
      <short value="Lab test name" />
    </element>
    <element id="Observation.code.coding:loinc">
      <path value="Observation.code.coding" />
      <sliceName value="loinc" />
      <short value="LOINC code (vital signs)" />
      <definition value="LOINC coding used for vital-signs observations, e.g. body height (8302-2) and body weight (29463-7). Used by the vital-signs read path." />
      <max value="1" />
    </element>
    <element id="Observation.code.coding:loinc.system">
      <path value="Observation.code.coding.system" />
      <min value="1" />
      <fixedUri value="http://loinc.org" />
    </element>
    <element id="Observation.code.coding:loinc.code">
      <path value="Observation.code.coding.code" />
      <short value="LOINC code" />
      <min value="1" />
    </element>
    <element id="Observation.code.coding:loinc.display">
      <path value="Observation.code.coding.display" />
      <short value="LOINC display name" />
    </element>
    <element id="Observation.code.text">
      <path value="Observation.code.text" />
      <short value="Human-readable lab test name" />
    </element>
    <element id="Observation.subject">
      <path value="Observation.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.medatixx.de/HealthHub/StructureDefinition/Mxx_HealthHub_Patient" />
      </type>
    </element>
    <element id="Observation.focus">
      <path value="Observation.focus" />
      <max value="0" />
    </element>
    <element id="Observation.encounter">
      <path value="Observation.encounter" />
      <max value="0" />
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <short value="Clinically relevant time of the observation" />
      <definition value="The clinically relevant time of the observation. For laboratory values this is the specimen collection date/time (falling back to the date the specimen was received at the lab). For vital signs this is the measurement date. Optional, because the vital-signs source may not carry a measurement date." />
      <type>
        <code value="dateTime" />
      </type>
    </element>
    <element id="Observation.issued">
      <path value="Observation.issued" />
      <short value="When the result was released by the lab" />
    </element>
    <element id="Observation.performer">
      <path value="Observation.performer" />
      <max value="0" />
    </element>
    <element id="Observation.value[x]">
      <path value="Observation.value[x]" />
      <short value="Observation result value" />
      <definition value="The observation result. Quantitative results use valueQuantity with UCUM units. Qualitative results use valueCodeableConcept. Non-standardized text results use valueString." />
      <type>
        <code value="Quantity" />
      </type>
      <type>
        <code value="CodeableConcept" />
      </type>
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="Observation.dataAbsentReason">
      <path value="Observation.dataAbsentReason" />
      <max value="0" />
    </element>
    <element id="Observation.interpretation">
      <path value="Observation.interpretation" />
      <short value="Abnormal flag (N/H/HH/L/LL)" />
      <definition value="Abnormal flag indicating whether the result is normal (N), high (H), critically high (HH), low (L), or critically low (LL)." />
      <max value="1" />
    </element>
    <element id="Observation.interpretation.coding">
      <path value="Observation.interpretation.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.interpretation.coding.system">
      <path value="Observation.interpretation.coding.system" />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v3-ObservationInterpretation" />
    </element>
    <element id="Observation.interpretation.coding.code">
      <path value="Observation.interpretation.coding.code" />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.medatixx.de/HealthHub/ValueSet/Mxx_HealthHub_VS_AbnormalFlag" />
      </binding>
    </element>
    <element id="Observation.bodySite">
      <path value="Observation.bodySite" />
      <max value="0" />
    </element>
    <element id="Observation.method">
      <path value="Observation.method" />
      <short value="Measurement method (when available)" />
    </element>
    <element id="Observation.specimen">
      <path value="Observation.specimen" />
      <max value="0" />
    </element>
    <element id="Observation.device">
      <path value="Observation.device" />
      <max value="0" />
    </element>
    <element id="Observation.referenceRange">
      <path value="Observation.referenceRange" />
      <short value="Reference range for the lab value" />
      <definition value="The reference range for the observation. May include age- and gender-specific ranges." />
    </element>
    <element id="Observation.hasMember">
      <path value="Observation.hasMember" />
      <max value="0" />
    </element>
    <element id="Observation.derivedFrom">
      <path value="Observation.derivedFrom" />
      <max value="0" />
    </element>
    <element id="Observation.component">
      <path value="Observation.component" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>