{
  "resourceType": "StructureDefinition",
  "id": "profile-DwOrganization",
  "meta": {
    "lastUpdated": "2024-05-02T14:59:57.7063454+00:00"
  },
  "url": "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization",
  "version": "2.0.0",
  "name": "DwOrganization",
  "status": "active",
  "date": "2026-05-29",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Organization",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Organization",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Organization",
        "path": "Organization",
        "definition": "A grouping of people or organizations with a common purpose.",
        "comment": "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."
      },
      {
        "id": "Organization.id",
        "path": "Organization.id",
        "definition": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.\r\n\r\nAll Organizations provided by TELUS Health EMR Data Warehouse, wil match the pattern urn:telus:emr:{emrType}:{emrInstanceId}:dw-emr-organization",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Organization.meta.lastUpdated",
        "path": "Organization.meta.lastUpdated",
        "mustSupport": true
      },
      {
        "id": "Organization.meta.source",
        "path": "Organization.meta.source",
        "mustSupport": true
      },
      {
        "id": "Organization.meta.security",
        "path": "Organization.meta.security",
        "mustSupport": true
      },
      {
        "id": "Organization.text",
        "path": "Organization.text",
        "mustSupport": true
      },
      {
        "id": "Organization.extension",
        "path": "Organization.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "Organization.extension:communication",
        "path": "Organization.extension",
        "sliceName": "communication",
        "definition": "Indentifies languages that services are provided in at the organization",
        "comment": "Usage note: When the language options for the clinic are stored in the EMR then this will be provided.",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-servicelanguage"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Organization.extension:communication.value[x]",
        "path": "Organization.extension.value[x]",
        "code": [
          {
            "system": "http://hl7.org/fhir/ValueSet/languages",
            "version": "4.0.1"
          }
        ]
      },
      {
        "id": "Organization.extension:communication.value[x].coding",
        "path": "Organization.extension.value[x].coding",
        "comment": "Usage Note: Where EMR primary language is French or English provide the appropriate language code."
      },
      {
        "id": "Organization.extension:communication.value[x].coding.system",
        "path": "Organization.extension.value[x].coding.system",
        "mustSupport": true
      },
      {
        "id": "Organization.extension:communication.value[x].coding.code",
        "path": "Organization.extension.value[x].coding.code",
        "mustSupport": true
      },
      {
        "id": "Organization.extension:communication.value[x].coding.display",
        "path": "Organization.extension.value[x].coding.display",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier",
        "path": "Organization.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "type.coding"
            }
          ],
          "ordered": false,
          "rules": "open"
        },
        "definition": "Identifier for the organization that is used to identify the organization across multiple disparate systems. An organization may have multiple identifiers.",
        "comment": "There shall at least be one of the idenitier has to be to identify the EMR instance",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier",
        "path": "Organization.identifier",
        "sliceName": "TelusIdentifier",
        "min": 0,
        "max": "*",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier.type",
        "path": "Organization.identifier.type",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier.type.coding",
        "path": "Organization.identifier.type.coding",
        "min": 1,
        "patternCoding": {
          "code": "XX",
          "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
          "display": "Organization identifier"
        },
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier.type.text",
        "path": "Organization.identifier.type.text",
        "comment": "Usage Note:  Telus Identifier\r\nVery often the text is the same as a displayName of one of the codings.",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier.system",
        "path": "Organization.identifier.system",
        "comment": "Follow the pattern urn:telus:emr:{emrtype}:{emrinstance}:organization or urn:telus:emr:{emrtype}:{region}:{emrinstance}:organization\r\nExample urn:telus:emr:ma:labtestsk1:organization",
        "min": 1,
        "constraint": [
          {
            "key": "dw-organization-identifier-system",
            "severity": "warning",
            "human": "Organization identifier system must follow pattern urn:telus:emr:{emrType}:{instanceId}:organization or urn:telus:emr:{emrType}:{region}:{instanceId}:organization",
            "expression": "matches('urn:telus:emr:([^:]+:){2,3}[Oo][Rr][Gg][Aa][Nn][Ii][Zz][Aa][Tt][Ii][Oo][Nn]')",
            "source": "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier.value",
        "path": "Organization.identifier.value",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier.assigner",
        "path": "Organization.identifier.assigner",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:TelusIdentifier.assigner.display",
        "path": "Organization.identifier.assigner.display",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier",
        "path": "Organization.identifier",
        "sliceName": "JuristictionalFacilityIdentifier",
        "comment": "Usage Note: for provinces that have facility identifiers for physician offices, provide the appropriate facility ID",
        "min": 0,
        "max": "*",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier.type",
        "path": "Organization.identifier.type",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier.type.coding",
        "path": "Organization.identifier.type.coding",
        "min": 1,
        "patternCoding": {
          "code": "FI",
          "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
          "display": "Facility ID"
        },
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier.type.text",
        "path": "Organization.identifier.type.text",
        "comment": "Usage Note: Juristictional facility identifer\r\n\r\nVery often the text is the same as coding.display.",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier.system",
        "path": "Organization.identifier.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier.value",
        "path": "Organization.identifier.value",
        "comment": "Usage Note: appropriate Juristictional Facility number.\r\n\r\nIf 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": 1
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier.assigner",
        "path": "Organization.identifier.assigner",
        "mustSupport": true
      },
      {
        "id": "Organization.identifier:JuristictionalFacilityIdentifier.assigner.display",
        "path": "Organization.identifier.assigner.display",
        "comment": "Usage Note: The appropriate assigner of the Provincial facility identifer. e.g. Alberta - Alberta Facility Number\r\nBC - MSP Facility Number\r\nOntario - Master Number\r\n\r\nThis 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": true
      },
      {
        "id": "Organization.active",
        "path": "Organization.active",
        "comment": "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.\n\nThis element is labeled as a modifier because it may be used to mark that the resource was created in error.\r\n\r\nInclude status for all EMR where it is available.",
        "meaningWhenMissing": "This resource is generally assumed to be active if no value is provided for the active element."
      },
      {
        "id": "Organization.type",
        "path": "Organization.type",
        "mustSupport": true,
        "binding": {
          "strength": "preferred",
          "valueSet": "https://fhir.infoway-inforoute.ca/ValueSet/sharedorganizationtype"
        }
      },
      {
        "id": "Organization.type.coding.system",
        "path": "Organization.type.coding.system",
        "fixedUri": "http://terminology.hl7.org/CodeSystem/v3-RoleCode"
      },
      {
        "id": "Organization.type.coding.code",
        "path": "Organization.type.coding.code",
        "comment": "Default for most of the clinics in CHR, PSS and MA will be PROFF"
      },
      {
        "id": "Organization.type.coding.display",
        "path": "Organization.type.coding.display",
        "comment": "Default Provider's Office"
      },
      {
        "id": "Organization.name",
        "path": "Organization.name",
        "short": "Organization Name",
        "definition": "A name associated with the organization and EMR location combined.",
        "requirements": "Need to use the name as the label of the organization. When the location in EMR is \"default\" do not add default to the name.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Organization.address",
        "path": "Organization.address",
        "definition": "An address for the organization",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Organization.partOf",
        "path": "Organization.partOf",
        "comment": "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": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization"
            ],
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy",
                "valueBoolean": true
              }
            ]
          }
        ]
      }
    ]
  }
}