{
  "resourceType": "StructureDefinition",
  "id": "LocationABeOrderLab",
  "url": "https://www.alberta.ca/fhir/ab-eorder-lab/StructureDefinition/LocationABeOrderLab",
  "version": "1.1.0",
  "name": "LocationABeOrderLab",
  "title": "Location (AB:eOrder-Lab)",
  "status": "draft",
  "description": "This profile defines a set of constraints to the FHIR Location resource for use in Alberta eOrder Laboratory (AB:eOrder-Lab). 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:eOrder-Lab.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Location",
  "baseDefinition": "http://fhir.infoway-inforoute.ca/io/CA-eReC/StructureDefinition/CA-eReC-Location",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Location",
        "path": "Location",
        "comment": "Location resources included in Alberta eOrder Laboratory Bundles have rules that certain attributes are not to be contained in Location resources. These are mechanically enforced through invariants at the AB:eOrder-Lab Bundle level."
      },
      {
        "id": "Location.identifier",
        "path": "Location.identifier",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Location.identifier.type",
        "path": "Location.identifier.type",
        "label": "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": 1,
        "mustSupport": true
      },
      {
        "id": "Location.identifier.value",
        "path": "Location.identifier.value",
        "label": "Must be a valid provincially-assigned delivery site identifier (Site WDFA key, AH Billing ID, or other approved identifier)"
      },
      {
        "id": "Location.status",
        "path": "Location.status",
        "comment": "'Active' recommended (but not required)"
      },
      {
        "id": "Location.name",
        "path": "Location.name",
        "comment": "Max Character length (100)",
        "min": 1
      },
      {
        "id": "Location.telecom",
        "path": "Location.telecom",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Location.telecom:Phone",
        "path": "Location.telecom",
        "sliceName": "Phone",
        "min": 1,
        "max": "*",
        "mustSupport": true
      },
      {
        "id": "Location.telecom:Phone.system",
        "path": "Location.telecom.system",
        "min": 1,
        "patternCode": "phone"
      },
      {
        "id": "Location.telecom:Phone.value",
        "path": "Location.telecom.value",
        "comment": "Formatted as: #-###-###-####"
      },
      {
        "id": "Location.telecom:Fax",
        "path": "Location.telecom",
        "sliceName": "Fax",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Location.telecom:Fax.system",
        "path": "Location.telecom.system",
        "min": 1,
        "patternCode": "fax"
      },
      {
        "id": "Location.telecom:Fax.value",
        "path": "Location.telecom.value",
        "comment": "Formatted as: #-###-###-####"
      },
      {
        "id": "Location.address",
        "path": "Location.address",
        "min": 1
      },
      {
        "id": "Location.address.line",
        "path": "Location.address.line",
        "min": 1
      },
      {
        "id": "Location.address.city",
        "path": "Location.address.city",
        "comment": "Max Character length (100)",
        "min": 1
      },
      {
        "id": "Location.address.state",
        "path": "Location.address.state",
        "comment": "Canadian Province/Territory Codes",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Location.address.postalCode",
        "path": "Location.address.postalCode",
        "comment": "Must be valid Canadian alphanumeric (A/N) postal code formatted as: ANA NAN",
        "min": 1
      },
      {
        "id": "Location.partOf",
        "path": "Location.partOf",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://www.alberta.ca/fhir/ab-eorder-lab/StructureDefinition/LocationABeOrderLab"
            ],
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-hierarchy",
                "valueBoolean": true
              }
            ]
          }
        ]
      }
    ]
  }
}