{
  "resourceType": "StructureDefinition",
  "id": "au-address",
  "url": "http://hl7.org.au/fhir/StructureDefinition/au-address",
  "version": "1.1.0",
  "name": "AUBaseAddress",
  "title": "AU Base Address",
  "status": "active",
  "date": "2018-09-25",
  "publisher": "Health Level Seven Australia (Patient Administration WG)",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "http://hl7.org.au/fhir",
          "use": "work"
        }
      ]
    }
  ],
  "description": "This profile is provided for use in an Australian context where some constraint on content is desirable to guarantee the quality of an Australian address whilst still supporting     other uses such as unstructured addresses.",
  "fhirVersion": "3.0.1",
  "kind": "complex-type",
  "abstract": false,
  "type": "Address",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Address",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Address",
        "path": "Address",
        "short": "An address in Australia for use within an Australian healthcare context",
        "definition": "An Australian address expressed using postal conventions (as opposed to GPS or other location definition formats).",
        "constraint": [
          {
            "key": "inv-add-0",
            "severity": "error",
            "human": "The address shall at least have text or a line",
            "expression": "text.exists() or line.exists()"
          },
          {
            "key": "inv-add-1",
            "severity": "error",
            "human": "If asserting no fixed address, the type shall be 'physical'",
            "expression": "extension.where(url='http://hl7.org.au/fhir/StructureDefinition/no-fixed-address' and value=true).exists() implies type='physical'"
          },
          {
            "key": "inv-add-2",
            "severity": "error",
            "human": "If asserting no fixed address, the address text shall begin with 'NO FIXED ADDRESS'",
            "expression": "extension.where(url='http://hl7.org.au/fhir/StructureDefinition/no-fixed-address').exists() implies text.startsWith('NO FIXED ADDRESS')"
          },
          {
            "key": "inv-add-3",
            "severity": "error",
            "human": "Postal code shall be 4 digits",
            "expression": "postalCode.exists() implies postalCode.matches('^[0-9]{4}$')"
          }
        ]
      },
      {
        "id": "Address.extension",
        "path": "Address.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Address.extension:noFixedAddress",
        "path": "Address.extension",
        "sliceName": "noFixedAddress",
        "definition": "No fixed address indicator.",
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": "http://hl7.org.au/fhir/StructureDefinition/no-fixed-address"
          }
        ]
      },
      {
        "id": "Address.city",
        "path": "Address.city",
        "short": "Name of city, town, suburb, etc.",
        "definition": "The name of the city, town, village, suburb, or other community or delivery center."
      },
      {
        "id": "Address.state",
        "path": "Address.state",
        "short": "Australian state and territory",
        "binding": {
          "strength": "required",
          "valueSetUri": "https://healthterminologies.gov.au/fhir/ValueSet/australian-states-territories-2"
        }
      },
      {
        "id": "Address.country",
        "path": "Address.country",
        "short": "Australia as a 2 digit ISO 3166 code",
        "definition": "Fixed value if present otherwise assumed to be Australia in this context.",
        "fixedString": "AU"
      }
    ]
  }
}