<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="LocationPSAB" />
  <url value="https://www.alberta.ca/fhir/psab/StructureDefinition/LocationPSAB" />
  <version value="1.2.0" />
  <name value="LocationPSAB" />
  <title value="Location (PS-AB)" />
  <status value="draft" />
  <description value="This profile defines a set of constraints to the FHIR Location resource for use in Alberta Patient Summaries (PS-AB). It includes constraints that represent the minimum expectations for the Location resource when used in the PS-AB Organization profile or in one of the referred resources." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Location" />
  <baseDefinition value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-location" />
  <derivation value="constraint" />
  <differential>
    <element id="Location">
      <path value="Location" />
      <comment value="Location resources included in Alberta Patient Summary Document Bundles have rules that certain attributes are not to be contained in Location resource. These are mechanically enforced through invariants at the PS-AB Bundle level." />
    </element>
    <element id="Location.identifier">
      <path value="Location.identifier" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Location.identifier.type">
      <path value="Location.identifier.type" />
      <label value="Must be a valid delivery site type ('domain') associated to the submitted identifier value 'AHWFACID' for AH Billing ID type, 'DPHIEXSTKID' for site WDFA key type" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier.system">
      <path value="Location.identifier.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.identifier.value">
      <path value="Location.identifier.value" />
      <label value="Must be a valid provincially-assigned delivery site identifier (Site WDFA key, AH Billing ID, or other approved identifier)" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.status">
      <path value="Location.status" />
      <comment value="'Active' recommended (but not required)" />
    </element>
    <element id="Location.name">
      <path value="Location.name" />
      <comment value="Max Character length (100)" />
      <min value="1" />
    </element>
    <element id="Location.telecom">
      <path value="Location.telecom" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Location.telecom:Phone">
      <path value="Location.telecom" />
      <sliceName value="Phone" />
      <min value="1" />
      <max value="*" />
      <mustSupport value="true" />
    </element>
    <element id="Location.telecom:Phone.system">
      <path value="Location.telecom.system" />
      <min value="1" />
      <patternCode value="phone" />
      <mustSupport value="true" />
    </element>
    <element id="Location.telecom:Phone.value">
      <path value="Location.telecom.value" />
      <comment value="Formatted as: #-###-###-####" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.telecom:Fax">
      <path value="Location.telecom" />
      <sliceName value="Fax" />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Location.telecom:Fax.system">
      <path value="Location.telecom.system" />
      <min value="1" />
      <patternCode value="fax" />
      <mustSupport value="true" />
    </element>
    <element id="Location.telecom:Fax.value">
      <path value="Location.telecom.value" />
      <comment value="Formatted as: #-###-###-####" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.address">
      <path value="Location.address" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.address.line">
      <path value="Location.address.line" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.address.city">
      <path value="Location.address.city" />
      <comment value="Max Character length (100)" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.address.state">
      <path value="Location.address.state" />
      <comment value="Canadian Province/Territory Codes" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.address.postalCode">
      <path value="Location.address.postalCode" />
      <comment value="Must be valid Canadian alphanumeric (A/N) postal code formatted as: ANA NAN" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Location.partOf">
      <path value="Location.partOf" />
      <type>
        <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy">
          <valueBoolean value="true" />
        </extension>
        <code value="Reference" />
        <targetProfile value="https://www.alberta.ca/fhir/psab/StructureDefinition/LocationPSAB" />
      </type>
    </element>
  </differential>
</StructureDefinition>