{
  "resourceType": "StructureDefinition",
  "id": "profile-DwLocation",
  "url": "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwLocation",
  "version": "2.0.0",
  "name": "DwLocation",
  "status": "active",
  "date": "2026-05-29",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Location",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Location",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Location.id",
        "path": "Location.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 Locations provided by TELUS Health EMR Data Warehouse will match the pattern urn:telus:emr:{emrType}:{emrInstanceId}:dw-emr-location",
        "comment": "CHR has two location types: Clinic Locations and Room Locations. Room Locations are child locations under Clinic Locations.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Location.meta",
        "path": "Location.meta",
        "mustSupport": true
      },
      {
        "id": "Location.meta.lastUpdated",
        "path": "Location.meta.lastUpdated",
        "mustSupport": true
      },
      {
        "id": "Location.meta.source",
        "path": "Location.meta.source",
        "mustSupport": true
      },
      {
        "id": "Location.text",
        "path": "Location.text",
        "comment": "Usage Note: Narrative text representation of the location when available from the EMR."
      },
      {
        "id": "Location.identifier",
        "path": "Location.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "definition": "Unique code or number identifying the location.",
        "comment": "Usage Note: Identifier(s) that uniquely identify this location within the EMR system.",
        "min": 1
      },
      {
        "id": "Location.identifier:TelusIdentifier",
        "path": "Location.identifier",
        "sliceName": "TelusIdentifier",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Location.identifier:TelusIdentifier.type.text",
        "path": "Location.identifier.type.text",
        "comment": "Usage Note: Telus Identifier"
      },
      {
        "id": "Location.identifier:TelusIdentifier.system",
        "path": "Location.identifier.system",
        "comment": "Pattern: urn:telus:emr:{emrtype}:{emrinstance}:location\nExample: urn:telus:emr:chr:{region}:{accountId}:location",
        "min": 1
      },
      {
        "id": "Location.identifier:TelusIdentifier.value",
        "path": "Location.identifier.value",
        "comment": "Usage Note: The location identifier value from the source EMR system.",
        "min": 1
      },
      {
        "id": "Location.status",
        "path": "Location.status",
        "definition": "The status of the location.",
        "comment": "Usage Note: active | suspended | inactive. CHR includes archived/deleted locations as 'inactive' rather than omitting them, so a deletion in the source EMR is reflected as a status change here.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Location.name",
        "path": "Location.name",
        "short": "Location Name",
        "definition": "Name of the location as presented to users.",
        "comment": "Usage Note: The name of the location as it appears in the EMR. (e.g., 'Exam Room 1', 'Procedure Room A').",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Location.alias",
        "path": "Location.alias",
        "comment": "CHR may provide up to two aliases: the internal location name and the online booking description title."
      },
      {
        "id": "Location.description",
        "path": "Location.description",
        "definition": "Additional details about the location that could be displayed as further information to identify the location beyond its name.",
        "comment": "CHR provides the online booking description for the location."
      },
      {
        "id": "Location.type",
        "path": "Location.type",
        "comment": "MA always sets a fixed facility type value; it is not derived per-location.\nBinding: http://terminology.hl7.org/ValueSet/v3-ServiceDeliveryLocationRoleType"
      },
      {
        "id": "Location.telecom",
        "path": "Location.telecom",
        "definition": "The contact details of communication devices available at the location.",
        "comment": "CHR provides phone and fax contact details for clinic locations (room locations inherit their parent clinic's contact details). MA provides phone/fax from the associated provider's address record when exactly one matching address exists; absent otherwise.",
        "mustSupport": true
      },
      {
        "id": "Location.telecom.system",
        "path": "Location.telecom.system",
        "comment": "Usage Note: phone | fax | email | pager | url | sms | other",
        "mustSupport": true
      },
      {
        "id": "Location.telecom.value",
        "path": "Location.telecom.value",
        "comment": "Usage Note: Will be NULL if no linked facility to location.",
        "mustSupport": true
      },
      {
        "id": "Location.telecom.use",
        "path": "Location.telecom.use",
        "comment": "Usage Note: CHR hard-codes 'work' for both phone and fax."
      },
      {
        "id": "Location.address",
        "path": "Location.address",
        "definition": "Physical location address.",
        "comment": "CHR provides the full address for clinic locations (room locations inherit their parent clinic's address). MA provides the address from the associated provider's address record when exactly one matching address exists; absent otherwise.",
        "mustSupport": true
      },
      {
        "id": "Location.address.use",
        "path": "Location.address.use",
        "comment": "Usage Note: CHR hard-codes 'work'."
      },
      {
        "id": "Location.address.line",
        "path": "Location.address.line",
        "comment": "Usage Note: Each address line is provided as a separate element. MA provides up to three address lines."
      },
      {
        "id": "Location.address.state",
        "path": "Location.address.state",
        "comment": "Usage Note: MA provides the province code (not the full province name)."
      },
      {
        "id": "Location.address.country",
        "path": "Location.address.country",
        "comment": "Usage Note: MA provides the 3-letter country code."
      },
      {
        "id": "Location.physicalType",
        "path": "Location.physicalType",
        "definition": "Physical form of the location, e.g. a room, building, or vehicle.",
        "comment": "CHR always sets this to 'Site' for clinic locations and 'Room' for room locations.\nBinding: http://terminology.hl7.org/ValueSet/location-physical-type"
      },
      {
        "id": "Location.position",
        "path": "Location.position",
        "definition": "The absolute geographic location of the Location, expressed using the WGS84 datum.",
        "comment": "Usage Note: GPS coordinates when available from the EMR (rarely populated)."
      },
      {
        "id": "Location.managingOrganization",
        "path": "Location.managingOrganization",
        "comment": "Usage Note: Reference to the Organization that manages this location.\r\nReferences SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.).",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Location.partOf",
        "path": "Location.partOf",
        "comment": "CHR room locations reference their parent clinic location via partOf. Clinic locations are top-level and never populate partOf.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwLocation"
            ],
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy",
                "valueBoolean": true
              }
            ]
          }
        ]
      },
      {
        "id": "Location.hoursOfOperation",
        "path": "Location.hoursOfOperation",
        "comment": "Not currently populated by any EMR source."
      },
      {
        "id": "Location.hoursOfOperation.daysOfWeek",
        "path": "Location.hoursOfOperation.daysOfWeek",
        "comment": "Usage Note: mon | tue | wed | thu | fri | sat | sun"
      }
    ]
  }
}