<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ISPMResource" />
  <meta>
    <lastUpdated value="2023-02-05T14:41:51.6934648+00:00" />
  </meta>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="normative" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version">
    <valueCode value="4.0.0" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="5" />
  </extension>
  <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="fhir" />
  </extension>
  <url value="http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResource" />
  <version value="1.0.1" />
  <name value="IspmResource" />
  <title value="ISPM Basic Resource" />
  <status value="draft" />
  <date value="2023-02-09T00:02:53.8161514+00:00" />
  <publisher value="Philips ISPM" />
  <contact>
    <name value="alexey.novikov@philips.com" />
    <telecom>
      <system value="email" />
      <value value="alexey.novikov@philips.com" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="Base StructureDefinition for every ISPM resource type." />
  <purpose value="Being a basic abstract definition for every ISPM resource type." />
  <fhirVersion value="4.0.1" />
  <kind value="logical" />
  <abstract value="true" />
  <type value="http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResource" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Resource" />
  <derivation value="specialization" />
  <differential>
    <element id="IspmResource">
      <path value="IspmResource" />
      <short value="A resource with narrative, extensions, and contained resources" />
      <definition value="A resource that includes narrative, extensions, and contained resources." />
      <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)" />
      </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))" />
      </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='#'])]))" />
      </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)" />
      </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))" />
      </constraint>
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
        <source value="http://hl7.org/fhir/StructureDefinition/Element" />
      </constraint>
    </element>
    <element id="IspmResource.text">
      <path value="IspmResource.text" />
      <short value="Text summary of the resource, for human interpretation" />
      <definition value="A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it &quot;clinically safe&quot; for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety." />
      <comment value="Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a &quot;text blob&quot; or where text is additionally entered raw or narrated and encoded information is added later." />
      <alias value="narrative" />
      <alias value="html" />
      <alias value="xhtml" />
      <alias value="display" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Narrative" />
      </type>
      <condition value="ele-1" />
    </element>
    <element id="IspmResource.context">
      <path value="IspmResource.context" />
      <short value="A reference from to other relative resources" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResourceContextReference" />
      </type>
    </element>
    <element id="IspmResource.authorization">
      <path value="IspmResource.authorization" />
      <short value="A reference to the owner of resource" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="http://com.philips.ispm.fhir.r4.profile/StructureDefinition/IspmResourceAuthorizationReference" />
      </type>
    </element>
    <element id="IspmResource.deleted">
      <path value="IspmResource.deleted" />
      <short value="Indicates if the resource was deleted" />
      <definition value="Indicates if the resource was deleted" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="boolean" />
        <profile value="http://hl7.org/fhir/StructureDefinition/boolean" />
      </type>
      <condition value="ele-1" />
    </element>
    <element id="IspmResource.modified">
      <path value="IspmResource.modified" />
      <short value="Indicates if the resource was manualy moified" />
      <definition value="Indicates if the resource was manualy moified" />
      <alias value="edited" />
      <alias value="changed" />
      <alias value="modified" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="boolean" />
        <profile value="http://hl7.org/fhir/StructureDefinition/boolean" />
      </type>
      <condition value="ele-1" />
    </element>
    <element id="IspmResource.resourceType">
      <path value="IspmResource.resourceType" />
      <short value="Type of the resource" />
      <definition value="Type of the resource" />
      <comment value="Type of the resource" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
        <profile value="http://hl7.org/fhir/StructureDefinition/string" />
      </type>
    </element>
    <element id="IspmResource.subResourceType">
      <path value="IspmResource.subResourceType" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Coding" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Coding" />
      </type>
      <constraint>
        <key value="ele-1" />
        <severity value="error" />
        <human value="All FHIR elements must have a @value or children" />
        <expression value="hasValue() or (children().count() &gt; id.count())" />
        <xpath value="@value|f:*|h:div" />
      </constraint>
    </element>
    <element id="IspmResource.affiliateOrganizations">
      <path value="IspmResource.affiliateOrganizations" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="BackboneElement" />
        <profile value="http://hl7.org/fhir/StructureDefinition/BackboneElement" />
      </type>
    </element>
    <element id="IspmResource.client_defined_identifier">
      <path value="IspmResource.client_defined_identifier" />
      <alias value="clientDefinedIdentifier" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Identifier" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Identifier" />
      </type>
    </element>
    <element id="IspmResource.client_defined_identifier_unique">
      <path value="IspmResource.client_defined_identifier_unique" />
      <alias value="clientDefinedIdentifierUnique" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Identifier" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Identifier" />
      </type>
    </element>
    <element id="IspmResource.sourceResource">
      <path value="IspmResource.sourceResource" />
      <short value="Additional data on the source that relevant for copy from event" />
      <definition value="Additional data on the source that relevant for copy from event." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="BackboneElement" />
      </type>
      <condition value="ele-1" />
    </element>
    <element id="IspmResource.sourceResource.date">
      <path value="IspmResource.sourceResource.date" />
      <max value="1" />
      <type>
        <code value="date" />
        <profile value="http://hl7.org/fhir/StructureDefinition/date" />
      </type>
      <condition value="ele-1" />
    </element>
    <element id="IspmResource.sourceResource.eventType">
      <path value="IspmResource.sourceResource.eventType" />
      <max value="1" />
      <type>
        <code value="Coding" />
        <profile value="http://hl7.org/fhir/StructureDefinition/Coding" />
      </type>
      <condition value="ele-1" />
    </element>
  </differential>
</StructureDefinition>