{
  "resourceType": "StructureDefinition",
  "id": "DataStandardsWales-Location",
  "url": "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Location",
  "version": "1.2.0",
  "name": "DataStandardsWalesLocation",
  "title": "Data Standards Wales Location",
  "status": "active",
  "experimental": false,
  "date": "2026-09-30",
  "publisher": "NHS Wales",
  "contact": [
    {
      "name": "FHIR Standards",
      "telecom": [
        {
          "system": "email",
          "value": "fhir.standards@wales.nhs.uk",
          "use": "work",
          "rank": 1
        }
      ]
    }
  ],
  "copyright": "2026 NHS Wales.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Location",
  "baseDefinition": "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Location",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Location.extension:locationPeriod",
        "path": "Location.extension",
        "sliceName": "locationPeriod",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-LocationPeriod"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "Location.extension:gridReference",
        "path": "Location.extension",
        "sliceName": "gridReference",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-GridReference"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "Location.extension:gridReference.extension",
        "path": "Location.extension.extension",
        "min": 2
      },
      {
        "id": "Location.identifier",
        "path": "Location.identifier",
        "comment": "Identifiers for the location SHOULD be populated if the data exists",
        "requirements": "Different location identities will apply which are managed by different registries",
        "mustSupport": true
      },
      {
        "id": "Location.identifier:wrtsLocationIdentifier",
        "path": "Location.identifier",
        "sliceName": "wrtsLocationIdentifier",
        "short": "The WRTS identifier for the location",
        "definition": "The identifier issued or recognised by the Welsh Reference and Terminology Services (WRTS) as the unique identifier for the location within Wales. The value may have been issued by another standards authority such as the Organisation Data Service (ODS) and adopted by WRTS as the unique identifier.",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Location.identifier:wrtsLocationIdentifier.system",
        "path": "Location.identifier.system",
        "short": "WRTS location identifier",
        "min": 1,
        "fixedUri": "https://fhir.nhs.wales/Id/wrts-location-identifier"
      },
      {
        "id": "Location.identifier:wrtsLocationIdentifier.value",
        "path": "Location.identifier.value",
        "min": 1
      },
      {
        "id": "Location.identifier:glnCode",
        "path": "Location.identifier",
        "sliceName": "glnCode",
        "short": "The Global Location Number (GLN) assigned to the location.",
        "definition": "The Global Location Number (GLN) assigned to the location by the responsible organisation. For more information regarding the GLN standard and how GLNs are used in healthcare please refer to the GS1 UK website",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Location.identifier:glnCode.system",
        "path": "Location.identifier.system",
        "min": 1,
        "fixedUri": "http://terminology.hl7.org/NamingSystem/GLN"
      },
      {
        "id": "Location.identifier:glnCode.value",
        "path": "Location.identifier.value",
        "min": 1
      },
      {
        "id": "Location.identifier:gphcPremisesNumber",
        "path": "Location.identifier",
        "sliceName": "gphcPremisesNumber",
        "short": "The General Pharmaceutical Council (GPhC) premises number.",
        "definition": "The General Pharmaceutical Council (GPhC) number assigned to the premises.",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Location.identifier:gphcPremisesNumber.system",
        "path": "Location.identifier.system",
        "min": 1,
        "fixedUri": "https://fhir.hl7.org.uk/Id/gphc-premises-number"
      },
      {
        "id": "Location.identifier:gphcPremisesNumber.value",
        "path": "Location.identifier.value",
        "min": 1
      },
      {
        "id": "Location.identifier:nwsspPharmacyAccountNumber",
        "path": "Location.identifier",
        "sliceName": "nwsspPharmacyAccountNumber",
        "short": "NHS Wales Shared Services Partnership (NWSSP) pharmacy account number.",
        "definition": "The account number assigned to the pharmacy premises by the NHS Wales Shared Services Partnership (NWSSP).",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Location.identifier:nwsspPharmacyAccountNumber.system",
        "path": "Location.identifier.system",
        "min": 1,
        "fixedUri": "https://fhir.nwssp.nhs.wales/Id/pharmacy-account-number"
      },
      {
        "id": "Location.identifier:nwsspPharmacyAccountNumber.value",
        "path": "Location.identifier.value",
        "min": 1
      },
      {
        "id": "Location.identifier:nhsbsaOpticianContractNumber",
        "path": "Location.identifier",
        "sliceName": "nhsbsaOpticianContractNumber",
        "short": "NHS Business Services Authority (NHSBSA) optician contract number.",
        "definition": "The contract number assigned to the optician premises by the NHS Business Services Authority (NHSBSA).",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Location.identifier:nhsbsaOpticianContractNumber.system",
        "path": "Location.identifier.system",
        "min": 1,
        "fixedUri": "https://fhir.hl7.org.uk/Id/nhsbsa-optician-contract-number"
      },
      {
        "id": "Location.identifier:nhsbsaOpticianContractNumber.value",
        "path": "Location.identifier.value",
        "min": 1
      },
      {
        "id": "Location.identifier:nhsbsaDentalLocationIdentifier",
        "path": "Location.identifier",
        "sliceName": "nhsbsaDentalLocationIdentifier",
        "short": "NHS Business Services Authority (NHSBSA) dental location identifier.",
        "definition": "The location identifier assigned to the dental surgery by the NHS Business Services Authority (NHSBSA).",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Location.identifier:nhsbsaDentalLocationIdentifier.system",
        "path": "Location.identifier.system",
        "min": 1,
        "fixedUri": "https://fhir.hl7.org.uk/Id/nhsbsa-dental-location-identifier"
      },
      {
        "id": "Location.identifier:nhsbsaDentalLocationIdentifier.value",
        "path": "Location.identifier.value",
        "min": 1
      },
      {
        "id": "Location.status",
        "path": "Location.status",
        "comment": "The status of the location (i.e., whether it is active, suspended or inactive) SHOULD be populated if the data exists."
      },
      {
        "id": "Location.name",
        "path": "Location.name",
        "comment": "Location name SHALL be populated. If the name of a location changes, consider putting the old name in the alias column so that it can still be located through searches."
      },
      {
        "id": "Location.name.extension",
        "path": "Location.name.extension",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://hl7.org/fhir/ValueSet/languages"
        }
      },
      {
        "id": "Location.name.extension:welshPreferredName",
        "path": "Location.name.extension",
        "sliceName": "welshPreferredName",
        "short": "The Welsh translation of the location name.",
        "definition": "A recognised Welsh translation of the English name for the location.",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/translation"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "Location.name.extension:welshPreferredName.extension",
        "path": "Location.name.extension.extension",
        "min": 2
      },
      {
        "id": "Location.name.extension:welshPreferredName.extension:lang",
        "path": "Location.name.extension.extension",
        "sliceName": "lang"
      },
      {
        "id": "Location.name.extension:welshPreferredName.extension:lang.value[x]",
        "path": "Location.name.extension.extension.value[x]",
        "fixedCode": "cy"
      },
      {
        "id": "Location.name.extension:welshPreferredName.extension:content",
        "path": "Location.name.extension.extension",
        "sliceName": "content"
      },
      {
        "id": "Location.name.extension:welshPreferredName.extension:content.value[x]",
        "path": "Location.name.extension.extension.value[x]",
        "type": [
          {
            "code": "string"
          }
        ]
      },
      {
        "id": "Location.alias.extension:aliasType",
        "path": "Location.alias.extension",
        "sliceName": "aliasType",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-AliasType"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "Location.type",
        "path": "Location.type",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "coding.system"
            }
          ],
          "description": "Slices to support a structured location type.",
          "rules": "open"
        },
        "binding": {
          "strength": "extensible",
          "valueSet": "https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationTypeExtended"
        }
      },
      {
        "id": "Location.type:locationCategory",
        "path": "Location.type",
        "sliceName": "locationCategory",
        "short": "The broad category of use of the location",
        "definition": "A high level classification of the location type according to the broad category of use e.g. Clinical area.",
        "max": "1",
        "binding": {
          "strength": "extensible",
          "description": "Categories for location type.",
          "valueSet": "https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationTypeCategory"
        }
      },
      {
        "id": "Location.type:locationCategory.coding",
        "path": "Location.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Location.type:locationCategory.coding.system",
        "path": "Location.type.coding.system",
        "min": 1,
        "fixedUri": "https://fhir.nhs.wales/CodeSystem/DataStandardsWales-LocationTypeCategory"
      },
      {
        "id": "Location.type:locationCategory.coding.code",
        "path": "Location.type.coding.code",
        "min": 1
      },
      {
        "id": "Location.type:locationCategory.coding.display",
        "path": "Location.type.coding.display",
        "min": 1
      },
      {
        "id": "Location.type:locationType",
        "path": "Location.type",
        "sliceName": "locationType",
        "short": "The functional type of the location",
        "definition": "A high level classification of the location type according to the functionality it provides, without straying into the details of the specific services available at the location.",
        "max": "1",
        "binding": {
          "strength": "extensible",
          "description": "A high level classification of the location type and function e.g. Hospital, Ward, GP surgery",
          "valueSet": "https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationType"
        }
      },
      {
        "id": "Location.type:locationType.coding",
        "path": "Location.type.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Location.type:locationType.coding.system",
        "path": "Location.type.coding.system",
        "min": 1,
        "fixedUri": "https://fhir.nhs.wales/CodeSystem/DataStandardsWales-LocationType"
      },
      {
        "id": "Location.type:locationType.coding.code",
        "path": "Location.type.coding.code",
        "min": 1
      },
      {
        "id": "Location.type:locationType.coding.display",
        "path": "Location.type.coding.display",
        "min": 1
      },
      {
        "id": "Location.address.extension:addressKey",
        "path": "Location.address.extension",
        "sliceName": "addressKey",
        "short": "An extension carrying the address key and type.",
        "definition": "An extension carrying the address key and type.  Extends the Address datatype to support the storage of address identifiers such as the Unique Property Reference Number (UPRN).",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey"
            ]
          }
        ],
        "isModifier": false
      },
      {
        "id": "Location.physicalType",
        "path": "Location.physicalType",
        "short": "The physical (or virtual) form of the location space",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "description": "The physical (or virtual) form of the location space, treating physicalType as locationForm which replaces this element at R5.",
          "valueSet": "https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationForm"
        }
      },
      {
        "id": "Location.managingOrganization",
        "path": "Location.managingOrganization",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Organization"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Location.managingOrganization.identifier.system",
        "path": "Location.managingOrganization.identifier.system",
        "min": 1
      },
      {
        "id": "Location.managingOrganization.identifier.value",
        "path": "Location.managingOrganization.identifier.value",
        "min": 1
      },
      {
        "id": "Location.partOf",
        "path": "Location.partOf",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Location"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Location.partOf.identifier.system",
        "path": "Location.partOf.identifier.system",
        "min": 1
      },
      {
        "id": "Location.partOf.identifier.value",
        "path": "Location.partOf.identifier.value",
        "min": 1
      },
      {
        "id": "Location.endpoint",
        "path": "Location.endpoint",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Endpoint"
            ]
          }
        ]
      }
    ]
  }
}