<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="au-organisation" />
  <url value="http://hl7.org.au/fhir/StructureDefinition/au-organisation" />
  <version value="1.1.0" />
  <name value="AUBaseOrganisation" />
  <title value="AU Base Organisation" />
  <status value="draft" />
  <date value="2018-08-03" />
  <publisher value="Health Level Seven Australia (Patient Administration WG)" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="http://hl7.org.au/fhir" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="This profile defines an organisation administration details structure that includes core localisation concepts for use in an Australian context." />
  <fhirVersion value="3.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Organization" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Organization" />
  <derivation value="constraint" />
  <differential>
    <element id="Organization">
      <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
        <valueCode value="trial-use" />
      </extension>
      <path value="Organization" />
      <short value="An organisation in an Australian healthcare context" />
    </element>
    <element id="Organization.identifier">
      <path value="Organization.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <short value="Organisation identifiers" />
    </element>
    <element id="Organization.identifier:hpio">
      <path value="Organization.identifier" />
      <sliceName value="hpio" />
      <short value="Healthcare Provider Identifier – Organisation (HPI-O)" />
      <definition value="National identifier Health Provider Identifier for Organisations (HPI-O)." />
      <constraint>
        <key value="inv-hpio-value-0" />
        <severity value="error" />
        <human value="HPI-O shall be an exactly 16 digit number" />
        <expression value="value.matches('^([0-9]{16})$')" />
      </constraint>
      <constraint>
        <key value="inv-hpio-value-1" />
        <severity value="error" />
        <human value="HPI-O prefix is 800362" />
        <expression value="value.startsWith('800362')" />
      </constraint>
      <constraint>
        <key value="inv-hpio-value-2" />
        <requirements value="HPI-O shall pass the Luhn algorithm check" />
        <severity value="error" />
        <human value="The identifier shall pass the Luhn algorithm check" />
        <expression value="(((select(value.substring(0,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(1,1).toInteger())+(select(value.substring(2,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(3,1).toInteger())+(select(value.substring(4,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(5,1).toInteger())+(select(value.substring(6,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(7,1).toInteger())+(select(value.substring(8,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(9,1).toInteger())+(select(value.substring(10,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(11,1).toInteger())+(select(value.substring(12,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(13,1).toInteger())+(select(value.substring(14,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(15,1).toInteger()))mod 10=0)" />
      </constraint>
    </element>
    <element id="Organization.identifier:hpio.type">
      <path value="Organization.identifier.type" />
      <short value="Identifier type for HPI-O" />
      <definition value="Healthcare Provider Identifier – Organisation (HPI-O) identifier type." />
      <patternCodeableConcept>
        <coding>
          <system value="http://hl7.org.au/fhir/v2/0203" />
          <code value="NOI" />
        </coding>
      </patternCodeableConcept>
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="IdentifierType" />
        </extension>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding">
          <valueBoolean value="true" />
        </extension>
        <strength value="required" />
        <description value="Local identifier type" />
        <valueSetReference>
          <reference value="http://hl7.org.au/fhir/ValueSet/au-hl7v2-0203" />
        </valueSetReference>
      </binding>
    </element>
    <element id="Organization.identifier:hpio.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Organization.identifier.type.text" />
      <definition value="hpi-o" />
      <fixedString value="HPI-O" />
    </element>
    <element id="Organization.identifier:hpio.system">
      <path value="Organization.identifier.system" />
      <short value="Namespace for HPI-O" />
      <definition value="This namespace is used for qualified identifiers to represent Healthcare Provider Identifier for Organisations (HPI-O) numbers. An example of the syntax of a HPI-O represented as a qualified identifer using this namespace is: http://ns.electronichealth.net.au/id/hi/hpio/1.0/8003620000000000" />
      <min value="1" />
      <fixedUri value="http://ns.electronichealth.net.au/id/hi/hpio/1.0" />
    </element>
    <element id="Organization.identifier:hpio.value">
      <path value="Organization.identifier.value" />
      <short value="HPI-O number" />
      <definition value="Identifier for the organization that is used to identify the organization across multiple disparate systems." />
      <min value="1" />
      <example>
        <label value="HPI-O number" />
        <valueString value="8003621566684455" />
      </example>
      <maxLength value="16" />
    </element>
    <element id="Organization.identifier:abn">
      <path value="Organization.identifier" />
      <sliceName value="abn" />
      <short value="Australian Business Number (ABN)" />
      <definition value="Australian Securities and Investment Commission (ASIC) assigned identifier for business/entity. ABN (Australian Business Number)." />
      <constraint>
        <key value="inv-asic-abn-length" />
        <severity value="error" />
        <human value="ABN shall be exactly 11 digits" />
        <expression value="value.length()=11" />
      </constraint>
    </element>
    <element id="Organization.identifier:abn.type">
      <path value="Organization.identifier.type" />
      <short value="Coded identifier type for ABN" />
    </element>
    <element id="Organization.identifier:abn.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Organization.identifier.type.text" />
      <fixedString value="ABN" />
    </element>
    <element id="Organization.identifier:abn.system">
      <path value="Organization.identifier.system" />
      <short value="Namespace for ABN" />
      <min value="1" />
      <fixedUri value="http://hl7.org.au/id/abn" />
    </element>
    <element id="Organization.identifier:abn.value">
      <path value="Organization.identifier.value" />
      <short value="ABN" />
      <definition value="Australian Business Number (ABN) identifier ." />
      <min value="1" />
    </element>
    <element id="Organization.identifier:acn">
      <path value="Organization.identifier" />
      <sliceName value="acn" />
      <short value="Australian Company Number (ACN)" />
      <definition value="Australian Securities and Investment Commission (ASIC) assigned identifier for business/entity. ACN (Australian Company Number)." />
      <constraint>
        <key value="inv-asic-acn-length" />
        <severity value="error" />
        <human value="ACN shall be exactly 9 digits" />
        <expression value="value.length()=9" />
      </constraint>
    </element>
    <element id="Organization.identifier:acn.type">
      <path value="Organization.identifier.type" />
      <short value="Coded identifier type for ACN" />
    </element>
    <element id="Organization.identifier:acn.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Organization.identifier.type.text" />
      <fixedString value="ACN" />
    </element>
    <element id="Organization.identifier:acn.system">
      <path value="Organization.identifier.system" />
      <short value="Namespace for ACN" />
      <min value="1" />
      <fixedUri value="http://hl7.org.au/id/acn" />
    </element>
    <element id="Organization.identifier:acn.value">
      <path value="Organization.identifier.value" />
      <short value="ACN" />
      <definition value="Australian Company Number (ACN) identifier" />
      <min value="1" />
    </element>
    <element id="Organization.identifier:arbn">
      <path value="Organization.identifier" />
      <sliceName value="arbn" />
      <short value="Australian Registered Body Number (ARBN)" />
      <definition value="Australian Securities and Investment Commission (ASIC) assigned identifier for business/entity. ARBN (Australian Registered Body Number)." />
      <constraint>
        <key value="inv-asic-arbn-length" />
        <severity value="error" />
        <human value="ARBN shall be exactly 9 digits" />
        <expression value="value.length()=9" />
      </constraint>
    </element>
    <element id="Organization.identifier:arbn.type">
      <path value="Organization.identifier.type" />
      <binding>
        <strength value="extensible" />
        <valueSetUri value="http://hl7.org/fhir/ValueSet/identifier-type" />
      </binding>
    </element>
    <element id="Organization.identifier:arbn.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Organization.identifier.type.text" />
      <fixedString value="ARBN" />
    </element>
    <element id="Organization.identifier:arbn.system">
      <path value="Organization.identifier.system" />
      <short value="Namespace for ARBN" />
      <min value="1" />
      <fixedUri value="http://hl7.org.au/id/arbn" />
    </element>
    <element id="Organization.identifier:arbn.value">
      <path value="Organization.identifier.value" />
      <short value="ARBN" />
      <definition value="Australian Registered Body Number (ARBN) identifier." />
      <min value="1" />
    </element>
    <element id="Organization.identifier:paio">
      <path value="Organization.identifier" />
      <sliceName value="paio" />
      <short value="My Health Record Assigned Identity for Organisations (PAI-O)" />
      <definition value="My Health Record Assigned Identity for Organisations (PAI-O)." />
      <constraint>
        <key value="inv-paio-value-0" />
        <severity value="error" />
        <human value="PAI-O shall be an exactly 16 digit number" />
        <expression value="value.matches('^([0-9]{16})$')" />
      </constraint>
      <constraint>
        <key value="inv-paio-value-1" />
        <severity value="error" />
        <human value="PAI-O prefix is 800364" />
        <expression value="value.startsWith('800364')" />
      </constraint>
      <constraint>
        <key value="inv-paio-value-2" />
        <requirements value="PAI-O shall pass the Luhn algorithm check" />
        <severity value="error" />
        <human value="The identifier shall pass the Luhn algorithm check" />
        <expression value="(((select(value.substring(0,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(1,1).toInteger())+(select(value.substring(2,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(3,1).toInteger())+(select(value.substring(4,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(5,1).toInteger())+(select(value.substring(6,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(7,1).toInteger())+(select(value.substring(8,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(9,1).toInteger())+(select(value.substring(10,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(11,1).toInteger())+(select(value.substring(12,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(13,1).toInteger())+(select(value.substring(14,1).toInteger()).select(iif($this&lt;5, $this*2, (($this*2)-9))))+(value.substring(15,1).toInteger()))mod 10=0)" />
      </constraint>
    </element>
    <element id="Organization.identifier:paio.type">
      <path value="Organization.identifier.type" />
      <short value="Identifier type for PAI-O" />
      <definition value="Element describing the type of identifier" />
    </element>
    <element id="Organization.identifier:paio.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Organization.identifier.type.text" />
      <fixedString value="PAI-O" />
    </element>
    <element id="Organization.identifier:paio.system">
      <path value="Organization.identifier.system" />
      <short value="Namespace for PAI-O" />
      <definition value="This namespace is used for qualified identifiers to represent My Health Record (PCEHR) Assigned Identity for Organisations (PAI-O) numbers. This is an organisational identifier for organisations who are not eligible for an Healthcare Provider Identifier – Organisation (HPI-O). When represented as an OID, the prefix would be 1.2.36.1.2001.1007.1 An example of the syntax of a PAI-O represented as a qualified identifier using this namespace is:  http://ns.electronichealth.net.au/id/pcehr/paio/1.0/800364wwwwxxxxxz where:   wwww is '0001' is the resource management partition; xxxxx is issued by the system operator; z is the check digit derived using ISO/IEC 7812 across the 15-digit number." />
      <min value="1" />
      <fixedUri value="http://ns.electronichealth.net.au/id/pcehr/paio/1.0" />
    </element>
    <element id="Organization.identifier:paio.value">
      <path value="Organization.identifier.value" />
      <short value="PAI-O number" />
      <definition value="PAI-O number" />
      <min value="1" />
      <example>
        <label value="PAI-O number" />
        <valueString value="8003647500000328" />
      </example>
      <maxLength value="16" />
    </element>
    <element id="Organization.identifier:csp">
      <path value="Organization.identifier" />
      <sliceName value="csp" />
      <short value="Contracted Service Provider (CSP) Number" />
      <definition value="Contracted Service Provider (CSP) number identifier for organisations " />
      <constraint>
        <key value="inv-csp-0" />
        <severity value="error" />
        <human value="CSP number is exactly 16 characters" />
        <expression value="value.length() = 16" />
      </constraint>
      <constraint>
        <key value="inv-csp-1" />
        <severity value="error" />
        <human value="CSP number prefix is 800363" />
        <expression value="value.startsWith('800363')" />
      </constraint>
    </element>
    <element id="Organization.identifier:csp.type">
      <path value="Organization.identifier.type" />
      <short value="Identifier type for CSP number" />
      <definition value="Element describing the type of identifier" />
    </element>
    <element id="Organization.identifier:csp.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Organization.identifier.type.text" />
      <fixedString value="CSP" />
    </element>
    <element id="Organization.identifier:csp.system">
      <path value="Organization.identifier.system" />
      <short value="Namespace for CSP number" />
      <definition value="This namespace is used for qualified identifiers to represent Contracted Service Provider (CSP) numbers. An example of the syntax of a CSP number represented as a qualified identifer using this namespace is: http://ns.electronichealth.net.au/id/hi/csp/1.0/8003630000000000" />
      <min value="1" />
      <fixedUri value="http://ns.electronichealth.net.au/id/hi/csp/1.0" />
    </element>
    <element id="Organization.identifier:csp.value">
      <path value="Organization.identifier.value" />
      <short value="CSP number" />
      <definition value="This is an organisational identifier for organisations that are contracted service providers." />
      <min value="1" />
      <example>
        <label value="CSP number" />
        <valueString value="8003635500000327" />
      </example>
      <maxLength value="16" />
    </element>
    <element id="Organization.identifier:nataAccreditation">
      <path value="Organization.identifier" />
      <sliceName value="nataAccreditation" />
      <short value="National Association of Testing Authorities (NATA) Accreditation Number" />
      <definition value="Identifier of an organization accredited by the National Association of Testing Authorities (NATA)" />
    </element>
    <element id="Organization.identifier:nataAccreditation.type">
      <path value="Organization.identifier.type" />
      <short value="Identifier type for NATA accreditation number" />
    </element>
    <element id="Organization.identifier:nataAccreditation.type.text">
      <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable">
        <valueBoolean value="true" />
      </extension>
      <path value="Organization.identifier.type.text" />
      <fixedString value="NATA Accreditation Number" />
    </element>
    <element id="Organization.identifier:nataAccreditation.system">
      <path value="Organization.identifier.system" />
      <short value="Namespace for NATA accreditation number" />
      <min value="1" />
      <fixedUri value="http://hl7.org.au/id/nata-accreditation" />
    </element>
    <element id="Organization.identifier:nataAccreditation.value">
      <path value="Organization.identifier.value" />
      <short value="NATA accreditation number" />
      <min value="1" />
      <example>
        <label value="NATA accreditation number" />
        <valueString value="24482" />
      </example>
    </element>
  </differential>
</StructureDefinition>