<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="User" />
  <url value="http://hl7.org/fhir/StructureDefinition/User" />
  <version value="0.1" />
  <name value="User" />
  <status value="draft" />
  <publisher value="Synapxe" />
  <copyright value="Copyright (C) 2024 Synapxe" />
  <fhirVersion value="4.3.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="User" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
  <derivation value="specialization" />
  <snapshot>
    <element id="User">
      <path value="User" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="User" />
        <min value="0" />
        <max value="*" />
      </base>
      <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()" />
        <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()" />
        <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.exists() and ('#'+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(uri) = '#').exists()).not()).trace('unmatched', id).empty()" />
        <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()" />
        <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()" />
        <source value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
      </constraint>
      <constraint>
        <key value="email-format" />
        <severity value="error" />
        <human value="If system is 'email', the value must be a valid email address." />
        <expression value="email.matches('^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$')" />
      </constraint>
      <mustSupport value="false" />
      <isModifier value="false" />
      <mapping>
        <identity value="rim" />
        <map value="Entity. Role, or Act" />
      </mapping>
    </element>
    <element id="User.id">
      <path value="User.id" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.id" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type">
          <valueString value="id" />
        </extension>
        <code value="http://hl7.org/fhirpath/System.String" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.meta">
      <path value="User.meta" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.meta" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Meta" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.implicitRules">
      <path value="User.implicitRules" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.implicitRules" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="uri" />
      </type>
      <isModifier value="true" />
    </element>
    <element id="User.language">
      <path value="User.language" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="Resource.language" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="code" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.text">
      <path value="User.text" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="DomainResource.text" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Narrative" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.contained">
      <path value="User.contained" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="DomainResource.contained" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Resource" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.extension">
      <path value="User.extension" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="DomainResource.extension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.modifierExtension">
      <path value="User.modifierExtension" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="DomainResource.modifierExtension" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Extension" />
      </type>
      <isModifier value="true" />
    </element>
    <element id="User.name">
      <path value="User.name" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.name" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.email">
      <path value="User.email" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.email" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.status">
      <path value="User.status" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.status" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.lastLoginOn">
      <path value="User.lastLoginOn" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.lastLoginOn" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="BackboneElement" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.preference">
      <path value="User.preference" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.preference" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.preferredRole">
      <path value="User.preferredRole" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.preferredRole" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Reference" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.role">
      <path value="User.role" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="User.role" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Reference" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.createdBy">
      <path value="User.createdBy" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.createdBy" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.creationDateTime">
      <path value="User.creationDateTime" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.creationDateTime" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="BackboneElement" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.modifiedBy">
      <path value="User.modifiedBy" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.modifiedBy" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.isDeleted">
      <path value="User.isDeleted" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.isDeleted" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="boolean" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.modificationDateTime">
      <path value="User.modificationDateTime" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.modificationDateTime" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="BackboneElement" />
      </type>
      <isModifier value="false" />
    </element>
  </snapshot>
  <differential>
    <element id="User">
      <path value="User" />
      <min value="0" />
      <max value="*" />
      <base>
        <path value="User" />
        <min value="0" />
        <max value="*" />
      </base>
      <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()" />
        <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()" />
        <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.exists() and ('#'+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(uri) = '#').exists()).not()).trace('unmatched', id).empty()" />
        <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()" />
        <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()" />
        <source value="http://hl7.org/fhir/StructureDefinition/DomainResource" />
      </constraint>
      <constraint>
        <key value="email-format" />
        <severity value="error" />
        <human value="If system is 'email', the value must be a valid email address." />
        <expression value="email.matches('^\\S+@\\S+\\.\\S{2,}$')" />
      </constraint>
      <mustSupport value="false" />
      <isModifier value="false" />
      <mapping>
        <identity value="rim" />
        <map value="Entity. Role, or Act" />
      </mapping>
    </element>
    <element id="User.name">
      <path value="User.name" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.name" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.email">
      <path value="User.email" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.email" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.status">
      <path value="User.status" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.status" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
      <binding>
        <valueSet value="https://fhir.synapxe.sg/ValueSet/user-status" />
      </binding>
    </element>
    <element id="User.location">
      <path value="User.location" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.location" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.lastLoginOn">
      <path value="User.lastLoginOn" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.lastLoginOn" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="BackboneElement" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.preference">
      <path value="User.preference" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.preference" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.preferredRole">
      <path value="User.preferredRole" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.preferredRole" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="Reference" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.role">
      <path value="User.role" />
      <min value="1" />
      <max value="*" />
      <base>
        <path value="User.role" />
        <min value="0" />
        <max value="*" />
      </base>
      <type>
        <code value="Reference" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.createdBy">
      <path value="User.createdBy" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.createdBy" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.creationDateTime">
      <path value="User.creationDateTime" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.creationDateTime" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="BackboneElement" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.modifiedBy">
      <path value="User.modifiedBy" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.modifiedBy" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="string" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.isDeleted">
      <path value="User.isDeleted" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.isDeleted" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="boolean" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="User.modificationDateTime">
      <path value="User.modificationDateTime" />
      <min value="0" />
      <max value="1" />
      <base>
        <path value="User.modificationDateTime" />
        <min value="0" />
        <max value="1" />
      </base>
      <type>
        <code value="BackboneElement" />
      </type>
      <isModifier value="false" />
    </element>
  </differential>
</StructureDefinition>