<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="DataStandardsWales-Location" />
  <url value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Location" />
  <version value="1.2.0" />
  <name value="DataStandardsWalesLocation" />
  <title value="Data Standards Wales Location" />
  <status value="active" />
  <experimental value="false" />
  <date value="2026-09-30" />
  <publisher value="NHS Wales" />
  <contact>
    <name value="FHIR Standards" />
    <telecom>
      <system value="email" />
      <value value="fhir.standards@wales.nhs.uk" />
      <use value="work" />
      <rank value="1" />
    </telecom>
  </contact>
  <copyright value="2026 NHS Wales." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Location" />
  <baseDefinition value="https://fhir.hl7.org.uk/StructureDefinition/UKCore-Location" />
  <derivation value="constraint" />
  <differential>
    <element id="Location.extension:locationPeriod">
      <path value="Location.extension" />
      <sliceName value="locationPeriod" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-LocationPeriod" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Location.extension:gridReference">
      <path value="Location.extension" />
      <sliceName value="gridReference" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-GridReference" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Location.extension:gridReference.extension">
      <path value="Location.extension.extension" />
      <min value="2" />
    </element>
    <element id="Location.identifier">
      <path value="Location.identifier" />
      <comment value="Identifiers for the location SHOULD be populated if the data exists" />
      <requirements value="Different location identities will apply which are managed by different registries" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier:wrtsLocationIdentifier">
      <path value="Location.identifier" />
      <sliceName value="wrtsLocationIdentifier" />
      <short value="The WRTS identifier for the location" />
      <definition value="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 value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier:wrtsLocationIdentifier.system">
      <path value="Location.identifier.system" />
      <short value="WRTS location identifier" />
      <min value="1" />
      <fixedUri value="https://fhir.nhs.wales/Id/wrts-location-identifier" />
    </element>
    <element id="Location.identifier:wrtsLocationIdentifier.value">
      <path value="Location.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.identifier:glnCode">
      <path value="Location.identifier" />
      <sliceName value="glnCode" />
      <short value="The Global Location Number (GLN) assigned to the location." />
      <definition value="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 value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier:glnCode.system">
      <path value="Location.identifier.system" />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/NamingSystem/GLN" />
    </element>
    <element id="Location.identifier:glnCode.value">
      <path value="Location.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.identifier:gphcPremisesNumber">
      <path value="Location.identifier" />
      <sliceName value="gphcPremisesNumber" />
      <short value="The General Pharmaceutical Council (GPhC) premises number." />
      <definition value="The General Pharmaceutical Council (GPhC) number assigned to the premises." />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier:gphcPremisesNumber.system">
      <path value="Location.identifier.system" />
      <min value="1" />
      <fixedUri value="https://fhir.hl7.org.uk/Id/gphc-premises-number" />
    </element>
    <element id="Location.identifier:gphcPremisesNumber.value">
      <path value="Location.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.identifier:nwsspPharmacyAccountNumber">
      <path value="Location.identifier" />
      <sliceName value="nwsspPharmacyAccountNumber" />
      <short value="NHS Wales Shared Services Partnership (NWSSP) pharmacy account number." />
      <definition value="The account number assigned to the pharmacy premises by the NHS Wales Shared Services Partnership (NWSSP)." />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier:nwsspPharmacyAccountNumber.system">
      <path value="Location.identifier.system" />
      <min value="1" />
      <fixedUri value="https://fhir.nwssp.nhs.wales/Id/pharmacy-account-number" />
    </element>
    <element id="Location.identifier:nwsspPharmacyAccountNumber.value">
      <path value="Location.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.identifier:nhsbsaOpticianContractNumber">
      <path value="Location.identifier" />
      <sliceName value="nhsbsaOpticianContractNumber" />
      <short value="NHS Business Services Authority (NHSBSA) optician contract number." />
      <definition value="The contract number assigned to the optician premises by the NHS Business Services Authority (NHSBSA)." />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier:nhsbsaOpticianContractNumber.system">
      <path value="Location.identifier.system" />
      <min value="1" />
      <fixedUri value="https://fhir.hl7.org.uk/Id/nhsbsa-optician-contract-number" />
    </element>
    <element id="Location.identifier:nhsbsaOpticianContractNumber.value">
      <path value="Location.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.identifier:nhsbsaDentalLocationIdentifier">
      <path value="Location.identifier" />
      <sliceName value="nhsbsaDentalLocationIdentifier" />
      <short value="NHS Business Services Authority (NHSBSA) dental location identifier." />
      <definition value="The location identifier assigned to the dental surgery by the NHS Business Services Authority (NHSBSA)." />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier:nhsbsaDentalLocationIdentifier.system">
      <path value="Location.identifier.system" />
      <min value="1" />
      <fixedUri value="https://fhir.hl7.org.uk/Id/nhsbsa-dental-location-identifier" />
    </element>
    <element id="Location.identifier:nhsbsaDentalLocationIdentifier.value">
      <path value="Location.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.status">
      <path value="Location.status" />
      <comment value="The status of the location (i.e., whether it is active, suspended or inactive) SHOULD be populated if the data exists." />
    </element>
    <element id="Location.name">
      <path value="Location.name" />
      <comment value="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." />
    </element>
    <element id="Location.name.extension">
      <path value="Location.name.extension" />
      <binding>
        <strength value="preferred" />
        <valueSet value="http://hl7.org/fhir/ValueSet/languages" />
      </binding>
    </element>
    <element id="Location.name.extension:welshPreferredName">
      <path value="Location.name.extension" />
      <sliceName value="welshPreferredName" />
      <short value="The Welsh translation of the location name." />
      <definition value="A recognised Welsh translation of the English name for the location." />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/translation" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Location.name.extension:welshPreferredName.extension">
      <path value="Location.name.extension.extension" />
      <min value="2" />
    </element>
    <element id="Location.name.extension:welshPreferredName.extension:lang">
      <path value="Location.name.extension.extension" />
      <sliceName value="lang" />
    </element>
    <element id="Location.name.extension:welshPreferredName.extension:lang.value[x]">
      <path value="Location.name.extension.extension.value[x]" />
      <fixedCode value="cy" />
    </element>
    <element id="Location.name.extension:welshPreferredName.extension:content">
      <path value="Location.name.extension.extension" />
      <sliceName value="content" />
    </element>
    <element id="Location.name.extension:welshPreferredName.extension:content.value[x]">
      <path value="Location.name.extension.extension.value[x]" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="Location.alias.extension:aliasType">
      <path value="Location.alias.extension" />
      <sliceName value="aliasType" />
      <type>
        <code value="Extension" />
        <profile value="https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-AliasType" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Location.type">
      <path value="Location.type" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="coding.system" />
        </discriminator>
        <description value="Slices to support a structured location type." />
        <rules value="open" />
      </slicing>
      <binding>
        <strength value="extensible" />
        <valueSet value="https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationTypeExtended" />
      </binding>
    </element>
    <element id="Location.type:locationCategory">
      <path value="Location.type" />
      <sliceName value="locationCategory" />
      <short value="The broad category of use of the location" />
      <definition value="A high level classification of the location type according to the broad category of use e.g. Clinical area." />
      <max value="1" />
      <binding>
        <strength value="extensible" />
        <description value="Categories for location type." />
        <valueSet value="https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationTypeCategory" />
      </binding>
    </element>
    <element id="Location.type:locationCategory.coding">
      <path value="Location.type.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Location.type:locationCategory.coding.system">
      <path value="Location.type.coding.system" />
      <min value="1" />
      <fixedUri value="https://fhir.nhs.wales/CodeSystem/DataStandardsWales-LocationTypeCategory" />
    </element>
    <element id="Location.type:locationCategory.coding.code">
      <path value="Location.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Location.type:locationCategory.coding.display">
      <path value="Location.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Location.type:locationType">
      <path value="Location.type" />
      <sliceName value="locationType" />
      <short value="The functional type of the location" />
      <definition value="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 value="1" />
      <binding>
        <strength value="extensible" />
        <description value="A high level classification of the location type and function e.g. Hospital, Ward, GP surgery" />
        <valueSet value="https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationType" />
      </binding>
    </element>
    <element id="Location.type:locationType.coding">
      <path value="Location.type.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Location.type:locationType.coding.system">
      <path value="Location.type.coding.system" />
      <min value="1" />
      <fixedUri value="https://fhir.nhs.wales/CodeSystem/DataStandardsWales-LocationType" />
    </element>
    <element id="Location.type:locationType.coding.code">
      <path value="Location.type.coding.code" />
      <min value="1" />
    </element>
    <element id="Location.type:locationType.coding.display">
      <path value="Location.type.coding.display" />
      <min value="1" />
    </element>
    <element id="Location.address.extension:addressKey">
      <path value="Location.address.extension" />
      <sliceName value="addressKey" />
      <short value="An extension carrying the address key and type." />
      <definition value="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 value="Extension" />
        <profile value="https://fhir.hl7.org.uk/StructureDefinition/Extension-UKCore-AddressKey" />
      </type>
      <isModifier value="false" />
    </element>
    <element id="Location.physicalType">
      <path value="Location.physicalType" />
      <short value="The physical (or virtual) form of the location space" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <description value="The physical (or virtual) form of the location space, treating physicalType as locationForm which replaces this element at R5." />
        <valueSet value="https://fhir.nhs.wales/ValueSet/DataStandardsWales-LocationForm" />
      </binding>
    </element>
    <element id="Location.managingOrganization">
      <path value="Location.managingOrganization" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Organization" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Location.managingOrganization.identifier.system">
      <path value="Location.managingOrganization.identifier.system" />
      <min value="1" />
    </element>
    <element id="Location.managingOrganization.identifier.value">
      <path value="Location.managingOrganization.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.partOf">
      <path value="Location.partOf" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Location" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Location.partOf.identifier.system">
      <path value="Location.partOf.identifier.system" />
      <min value="1" />
    </element>
    <element id="Location.partOf.identifier.value">
      <path value="Location.partOf.identifier.value" />
      <min value="1" />
    </element>
    <element id="Location.endpoint">
      <path value="Location.endpoint" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Endpoint" />
      </type>
    </element>
  </differential>
</StructureDefinition>