<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="digidot-ehds-body-structure" />
  <url value="https://novari.no/fhir/digidot/StructureDefinition/digidot-ehds-body-structure" />
  <version value="0.4.2" />
  <name value="DigidotEhdsBodyStructure" />
  <title value="DigiDOT inline Xt-EHR Body structure" />
  <status value="draft" />
  <date value="2026-09-30" />
  <publisher value="Novari AS - DigiDOT" />
  <description value="Readiness: [In development](https://simplifier.net/guide/Visual-overview/Home/Review-status-and-releases.page.md?version=current#readiness-ehds-body-structure).&#xA;&#xA;R4 complex extension representing all five fields, datatypes and cardinalities of Xt-EHR EHDSBodyStructure 0.3.0 with DigiDOT anatomical terminology bindings. The logical model is not a FHIR implementation profile; this extension is DigiDOT-defined." />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="xt-ehr" />
    <uri value="http://www.xt-ehr.eu/fhir/models/StructureDefinition/EHDSBodyStructure" />
    <name value="Xt-EHR EHDSBodyStructure 0.3.0" />
  </mapping>
  <kind value="complex-type" />
  <abstract value="false" />
  <context>
    <type value="element" />
    <expression value="CodeableConcept" />
  </context>
  <type value="Extension" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" />
  <derivation value="constraint" />
  <differential>
    <element id="Extension">
      <path value="Extension" />
      <short value="Inline Xt-EHR Body structure logical model" />
      <definition value="One inline anatomical group implementing the five fields of Xt-EHR EHDSBodyStructure 0.3.0. No independent resource identity is required." />
      <constraint>
        <key value="digidot-anatomy-qualifier-location" />
        <severity value="error" />
        <human value="A locationQualifier requires a location in the same anatomical group." />
        <expression value="extension.where(url = 'locationQualifier').empty() or extension.where(url = 'location').exists()" />
      </constraint>
      <constraint>
        <key value="digidot-anatomy-laterality-location" />
        <severity value="error" />
        <human value="Laterality requires a location in the same anatomical group." />
        <expression value="extension.where(url = 'laterality').empty() or extension.where(url = 'location').exists()" />
      </constraint>
    </element>
    <element id="Extension.extension">
      <path value="Extension.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="closed" />
      </slicing>
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Extension.extension:morphology">
      <path value="Extension.extension" />
      <sliceName value="morphology" />
      <short value="The kind of structure being represented by the body structure at BodyStructure.location. This can define both normal and abnormal morphologies." />
      <definition value="The kind of structure being represented by the body structure at BodyStructure.location. This can define both normal and abnormal morphologies." />
      <min value="0" />
      <max value="1" />
      <mapping>
        <identity value="xt-ehr" />
        <map value="EHDSBodyStructure.morphology" />
      </mapping>
    </element>
    <element id="Extension.extension:morphology.extension">
      <path value="Extension.extension.extension" />
      <max value="0" />
    </element>
    <element id="Extension.extension:morphology.url">
      <path value="Extension.extension.url" />
      <fixedUri value="morphology" />
    </element>
    <element id="Extension.extension:morphology.value[x]">
      <path value="Extension.extension.value[x]" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <binding>
        <strength value="preferred" />
        <description value="SNOMED CT" />
      </binding>
    </element>
    <element id="Extension.extension:location">
      <path value="Extension.extension" />
      <sliceName value="location" />
      <short value="Body site" />
      <definition value="One anatomical body structure. For a numbered tooth, choose a code from the Norwegian teeth reference set in the same SNOMED CT release. Other appropriate body structures may be used." />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="xt-ehr" />
        <map value="EHDSBodyStructure.location" />
      </mapping>
    </element>
    <element id="Extension.extension:location.extension">
      <path value="Extension.extension.extension" />
      <max value="0" />
    </element>
    <element id="Extension.extension:location.url">
      <path value="Extension.extension.url" />
      <fixedUri value="location" />
    </element>
    <element id="Extension.extension:location.value[x]">
      <path value="Extension.extension.value[x]" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <description value="SNOMED CT Body structure hierarchy (&lt;&lt; 123037004); use the national teeth reference set for a numbered tooth." />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/snomed-body-structures" />
      </binding>
    </element>
    <element id="Extension.extension:locationQualifier">
      <path value="Extension.extension" />
      <sliceName value="locationQualifier" />
      <short value="Additional qualifier of the body structure (e.g. upper, lower, left side)." />
      <definition value="An anatomical/topographical qualifier of the location. For a tooth, use an applicable qualifier value for each surface and keep it in the same anatomical group as that numbered tooth; do not repeat a qualifier. Clinical suitability depends on the structure." />
      <min value="0" />
      <max value="*" />
      <mustSupport value="true" />
      <mapping>
        <identity value="xt-ehr" />
        <map value="EHDSBodyStructure.locationQualifier" />
      </mapping>
    </element>
    <element id="Extension.extension:locationQualifier.extension">
      <path value="Extension.extension.extension" />
      <max value="0" />
    </element>
    <element id="Extension.extension:locationQualifier.url">
      <path value="Extension.extension.url" />
      <fixedUri value="locationQualifier" />
    </element>
    <element id="Extension.extension:locationQualifier.value[x]">
      <path value="Extension.extension.value[x]" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <description value="Only SNOMED CT anatomical qualifier values are permitted here. Tooth-surface body-structure concepts belong in the clinical expression, not in locationQualifier." />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/bodystructure-location-qualifiers" />
      </binding>
    </element>
    <element id="Extension.extension:laterality">
      <path value="Extension.extension" />
      <sliceName value="laterality" />
      <short value="Body structure laterality (e.g. left, right)." />
      <definition value="Left or right only when the selected structure can logically be lateralized and does not already encode a side. Do not repeat the side of a numbered tooth." />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="xt-ehr" />
        <map value="EHDSBodyStructure.laterality" />
      </mapping>
    </element>
    <element id="Extension.extension:laterality.extension">
      <path value="Extension.extension.extension" />
      <max value="0" />
    </element>
    <element id="Extension.extension:laterality.url">
      <path value="Extension.extension.url" />
      <fixedUri value="laterality" />
    </element>
    <element id="Extension.extension:laterality.value[x]">
      <path value="Extension.extension.value[x]" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <description value="SNOMED CT Left or Right qualifier values. This binding does not alone prove that the location permits laterality." />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/bodystructure-laterality" />
      </binding>
    </element>
    <element id="Extension.extension:description">
      <path value="Extension.extension" />
      <sliceName value="description" />
      <short value="Textual description of the body structure" />
      <definition value="Textual description of the body structure" />
      <min value="0" />
      <max value="1" />
      <mapping>
        <identity value="xt-ehr" />
        <map value="EHDSBodyStructure.description" />
      </mapping>
    </element>
    <element id="Extension.extension:description.extension">
      <path value="Extension.extension.extension" />
      <max value="0" />
    </element>
    <element id="Extension.extension:description.url">
      <path value="Extension.extension.url" />
      <fixedUri value="description" />
    </element>
    <element id="Extension.extension:description.value[x]">
      <path value="Extension.extension.value[x]" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="Extension.url">
      <path value="Extension.url" />
      <fixedUri value="https://novari.no/fhir/digidot/StructureDefinition/digidot-ehds-body-structure" />
    </element>
    <element id="Extension.value[x]">
      <path value="Extension.value[x]" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>