<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="LocationABeReC" />
  <url value="https://www.alberta.ca/fhir/aberec/StructureDefinition/LocationABeReC" />
  <version value="1.1.0" />
  <name value="LocationABeReC" />
  <title value="Location (AB:eReC)" />
  <status value="draft" />
  <description value="This profile defines a set of constraints to the FHIR Location resource for use in Alberta eReferral and eConsult (AB:eReC). It re-profiles the CA-eReC Location profile and it includes constraints that represent the minimum expectations for the Location resource when used in the AB:eReC." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Location" />
  <baseDefinition value="http://fhir.infoway-inforoute.ca/io/CA-eReC/StructureDefinition/CA-eReC-Location" />
  <derivation value="constraint" />
  <differential>
    <element id="Location">
      <path value="Location" />
      <comment value="Location resources included in Alberta eReferral and eConsult Bundles have rules that certain attributes are not to be contained in Location resources. These are mechanically enforced through invariants at the AB:eReC 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.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)" />
    </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="2" />
    </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" />
    </element>
    <element id="Location.telecom:Phone.value">
      <path value="Location.telecom.value" />
      <comment value="Formatted as: #-###-###-####" />
    </element>
    <element id="Location.telecom:Fax">
      <path value="Location.telecom" />
      <sliceName value="Fax" />
      <min value="1" />
      <max value="*" />
    </element>
    <element id="Location.telecom:Fax.system">
      <path value="Location.telecom.system" />
      <min value="1" />
      <patternCode value="fax" />
    </element>
    <element id="Location.telecom:Fax.value">
      <path value="Location.telecom.value" />
      <comment value="Formatted as: #-###-###-####" />
    </element>
    <element id="Location.address">
      <path value="Location.address" />
      <min value="1" />
    </element>
    <element id="Location.address.line">
      <path value="Location.address.line" />
      <min value="1" />
    </element>
    <element id="Location.address.city">
      <path value="Location.address.city" />
      <comment value="Max Character length (100)" />
      <min value="1" />
    </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" />
    </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/aberec/StructureDefinition/LocationABeReC" />
      </type>
    </element>
  </differential>
</StructureDefinition>