<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-DwOrganization" />
  <meta>
    <lastUpdated value="2024-05-02T14:59:57.7063454+00:00" />
  </meta>
  <url value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization" />
  <version value="2.0.0" />
  <name value="DwOrganization" />
  <status value="active" />
  <date value="2026-05-29" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Organization" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Organization" />
  <derivation value="constraint" />
  <differential>
    <element id="Organization">
      <path value="Organization" />
      <definition value="A grouping of people or organizations with a common purpose." />
      <comment value="An organization is a EMR instance location, a grouping of people working under an organization to provide patient care. An organization may have one or more physical location where the care is provided to the patient." />
    </element>
    <element id="Organization.id">
      <path value="Organization.id" />
      <definition value="The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.&#xD;&#xA;&#xD;&#xA;All Organizations provided by TELUS Health EMR Data Warehouse, wil match the pattern urn:telus:emr:{emrType}:{emrInstanceId}:dw-emr-organization" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.meta.lastUpdated">
      <path value="Organization.meta.lastUpdated" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.meta.source">
      <path value="Organization.meta.source" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.meta.security">
      <path value="Organization.meta.security" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.text">
      <path value="Organization.text" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.extension">
      <path value="Organization.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="Organization.extension:communication">
      <path value="Organization.extension" />
      <sliceName value="communication" />
      <definition value="Indentifies languages that services are provided in at the organization" />
      <comment value="Usage note: When the language options for the clinic are stored in the EMR then this will be provided." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-servicelanguage" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Organization.extension:communication.value[x]">
      <path value="Organization.extension.value[x]" />
      <code>
        <system value="http://hl7.org/fhir/ValueSet/languages" />
        <version value="4.0.1" />
      </code>
    </element>
    <element id="Organization.extension:communication.value[x].coding">
      <path value="Organization.extension.value[x].coding" />
      <comment value="Usage Note: Where EMR primary language is French or English provide the appropriate language code." />
    </element>
    <element id="Organization.extension:communication.value[x].coding.system">
      <path value="Organization.extension.value[x].coding.system" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.extension:communication.value[x].coding.code">
      <path value="Organization.extension.value[x].coding.code" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.extension:communication.value[x].coding.display">
      <path value="Organization.extension.value[x].coding.display" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier">
      <path value="Organization.identifier" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="type.coding" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <definition value="Identifier for the organization that is used to identify the organization across multiple disparate systems. An organization may have multiple identifiers." />
      <comment value="There shall at least be one of the idenitier has to be to identify the EMR instance" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier">
      <path value="Organization.identifier" />
      <sliceName value="TelusIdentifier" />
      <min value="0" />
      <max value="*" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier.type">
      <path value="Organization.identifier.type" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier.type.coding">
      <path value="Organization.identifier.type.coding" />
      <min value="1" />
      <patternCoding>
        <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
        <code value="XX" />
        <display value="Organization identifier" />
      </patternCoding>
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier.type.text">
      <path value="Organization.identifier.type.text" />
      <comment value="Usage Note:  Telus Identifier&#xD;&#xA;Very often the text is the same as a displayName of one of the codings." />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier.system">
      <path value="Organization.identifier.system" />
      <comment value="Follow the pattern urn:telus:emr:{emrtype}:{emrinstance}:organization or urn:telus:emr:{emrtype}:{region}:{emrinstance}:organization&#xD;&#xA;Example urn:telus:emr:ma:labtestsk1:organization" />
      <min value="1" />
      <constraint>
        <key value="dw-organization-identifier-system" />
        <severity value="warning" />
        <human value="Organization identifier system must follow pattern urn:telus:emr:{emrType}:{instanceId}:organization or urn:telus:emr:{emrType}:{region}:{instanceId}:organization" />
        <expression value="matches('urn:telus:emr:([^:]+:){2,3}[Oo][Rr][Gg][Aa][Nn][Ii][Zz][Aa][Tt][Ii][Oo][Nn]')" />
        <source value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier.value">
      <path value="Organization.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier.assigner">
      <path value="Organization.identifier.assigner" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:TelusIdentifier.assigner.display">
      <path value="Organization.identifier.assigner.display" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier">
      <path value="Organization.identifier" />
      <sliceName value="JuristictionalFacilityIdentifier" />
      <comment value="Usage Note: for provinces that have facility identifiers for physician offices, provide the appropriate facility ID" />
      <min value="0" />
      <max value="*" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier.type">
      <path value="Organization.identifier.type" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier.type.coding">
      <path value="Organization.identifier.type.coding" />
      <min value="1" />
      <patternCoding>
        <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
        <code value="FI" />
        <display value="Facility ID" />
      </patternCoding>
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier.type.text">
      <path value="Organization.identifier.type.text" />
      <comment value="Usage Note: Juristictional facility identifer&#xD;&#xA;&#xD;&#xA;Very often the text is the same as coding.display." />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier.system">
      <path value="Organization.identifier.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier.value">
      <path value="Organization.identifier.value" />
      <comment value="Usage Note: appropriate Juristictional Facility number.&#xD;&#xA;&#xD;&#xA;If the value is a full URI, then the system SHALL be urn:ietf:rfc:3986.  The value's primary purpose is computational mapping.  As a result, it may be normalized for comparison purposes (e.g. removing non-significant whitespace, dashes, etc.)  A value formatted for human display can be conveyed using the [Rendered Value extension](extension-rendered-value.html). Identifier.value is to be treated as case sensitive unless knowledge of the Identifier.system allows the processer to be confident that non-case-sensitive processing is safe." />
      <min value="1" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier.assigner">
      <path value="Organization.identifier.assigner" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.identifier:JuristictionalFacilityIdentifier.assigner.display">
      <path value="Organization.identifier.assigner.display" />
      <comment value="Usage Note: The appropriate assigner of the Provincial facility identifer. e.g. Alberta - Alberta Facility Number&#xD;&#xA;BC - MSP Facility Number&#xD;&#xA;Ontario - Master Number&#xD;&#xA;&#xD;&#xA;This is generally not the same as the Resource.text of the referenced resource.  The purpose is to identify what's being referenced, not to fully describe it." />
      <mustSupport value="true" />
    </element>
    <element id="Organization.active">
      <path value="Organization.active" />
      <comment value="This active flag is not intended to be used to mark an organization as temporarily closed or under construction. Instead the Location(s) within the Organization should have the suspended status. If further details of the reason for the suspension are required, then an extension on this element should be used.&#xA;&#xA;This element is labeled as a modifier because it may be used to mark that the resource was created in error.&#xD;&#xA;&#xD;&#xA;Include status for all EMR where it is available." />
      <meaningWhenMissing value="This resource is generally assumed to be active if no value is provided for the active element." />
    </element>
    <element id="Organization.type">
      <path value="Organization.type" />
      <mustSupport value="true" />
      <binding>
        <strength value="preferred" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/sharedorganizationtype" />
      </binding>
    </element>
    <element id="Organization.type.coding.system">
      <path value="Organization.type.coding.system" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/v3-RoleCode" />
    </element>
    <element id="Organization.type.coding.code">
      <path value="Organization.type.coding.code" />
      <comment value="Default for most of the clinics in CHR, PSS and MA will be PROFF" />
    </element>
    <element id="Organization.type.coding.display">
      <path value="Organization.type.coding.display" />
      <comment value="Default Provider's Office" />
    </element>
    <element id="Organization.name">
      <path value="Organization.name" />
      <short value="Organization Name" />
      <definition value="A name associated with the organization and EMR location combined." />
      <requirements value="Need to use the name as the label of the organization. When the location in EMR is &quot;default&quot; do not add default to the name." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.address">
      <path value="Organization.address" />
      <definition value="An address for the organization" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Organization.partOf">
      <path value="Organization.partOf" />
      <comment value="Usage note: An EMR security separation defined by “functional location” (sub-organization) configuration in EMR will be identified by partof. Partof is used by sub organizations to point to parent organization." />
      <type>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy">
          <valueBoolean value="true" />
        </extension>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization" />
      </type>
    </element>
  </differential>
</StructureDefinition>