<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="problem-closed-by" />
  <url value="http://hl7.org/fhir/StructureDefinition/problem-closed-by" />
  <version value="4.0" />
  <name value="problem-closed-by" />
  <title value="Problem Closed By" />
  <status value="draft" />
  <publisher value="Orion Health" />
  <description value="Indicates the practitioner who closed a problem" />
  <purpose value="This extension indicates the practitioner who closed a problem. This can be used in conjunction with the problem-closed-reason and problem-closed-date extensions" />
  <fhirVersion value="4.0" />
  <kind value="complex-type" />
  <abstract value="false" />
  <type value="Extension" />
  <snapshot>
    <element id="Extension">
      <path value="Extension" />
      <max value="1" />
      <base>
        <path value="Extension" />
        <max value="1" />
      </base>
    </element>
    <element id="Extension.url">
      <path value="Extension.url" />
      <base>
        <path value="Extension.url" />
      </base>
      <fixedUri value="http://hl7.org/fhir/StructureDefinition/problem-closed-by" />
    </element>
    <element id="Extension.value[x]">
      <path value="Extension.value[x]" />
      <short value="Indicates the practitioner who closed a problem" />
      <definition value="Set the practitioner who closed a problem" />
      <min value="1" />
      <max value="1" />
      <base>
        <path value="Extension.value[x]" />
        <min value="1" />
        <max value="1" />
      </base>
      <type>
        <code value="Practitioner" />
      </type>
      <constraint>
        <key value="dom-2" />
        <severity value="error" />
        <human value="If the resource is contained in another resource, it SHALL NOT contain nested Resources" />
        <expression value="contained.contained.empty()" />
        <xpath value="not(parent::f:contained and f:contained)" />
        <source value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
      </constraint>
      <constraint>
        <key value="dom-4" />
        <severity value="error" />
        <human value="If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated" />
        <expression value="contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()" />
        <xpath value="not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))" />
        <source value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
      </constraint>
      <constraint>
        <key value="dom-3" />
        <severity value="error" />
        <human value="If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource" />
        <expression value="contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()" />
        <xpath value="not(exists(for $id in f:contained/*/f:id/@value return $contained[not(parent::*/descendant::f:reference/@value=concat('#', $contained/*/id/@value) or descendant::f:reference[@value='#'])]))" />
        <source value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
      </constraint>
      <constraint>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice">
          <valueBoolean value="true" />
        </extension>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice-explanation">
          <valueMarkdown value="When a resource has no narrative, only systems that fully understand the data can display the resource to a human safely. Including a human readable representation in the resource makes for a much more robust eco-system and cheaper handling of resources by intermediary systems. Some ecosystems restrict distribution of resources to only those systems that do fully understand the resources, and as a consequence implementers may believe that the narrative is superfluous. However experience shows that such eco-systems often open up to new participants over time." />
        </extension>
        <key value="dom-6" />
        <severity value="warning" />
        <human value="A resource should have narrative for robust management" />
        <expression value="text.`div`.exists()" />
        <xpath value="exists(f:text/h:div)" />
        <source value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
      </constraint>
      <constraint>
        <key value="dom-5" />
        <severity value="error" />
        <human value="If a resource is contained in another resource, it SHALL NOT have a security label" />
        <expression value="contained.meta.security.empty()" />
        <xpath value="not(exists(f:contained/*/f:meta/f:security))" />
        <source value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
      </constraint>
      <mapping>
        <identity value="rim" />
        <map value="Entity. Role, or Act" />
      </mapping>
      <mapping>
        <identity value="v2" />
        <map value="PRD (as one example)" />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="Role" />
      </mapping>
      <mapping>
        <identity value="servd" />
        <map value="Provider" />
      </mapping>
    </element>
  </snapshot>
  <differential>
    <element id="Extension">
      <path value="Extension" />
      <max value="1" />
    </element>
    <element id="Extension.url">
      <path value="Extension.url" />
      <fixedUri value="http://hl7.org/fhir/StructureDefinition/problem-closed-by" />
    </element>
    <element id="Extension.value[x]">
      <path value="Extension.value[x]" />
      <short value="Indicates the practitioner who closed a problem" />
      <definition value="Set the practitioner who closed a problem" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Practitioner" />
      </type>
    </element>
  </differential>
</StructureDefinition>