{
  "resourceType": "StructureDefinition",
  "url": "https://fhir.nhs.uk/StructureDefinition/NHSDigital-Location",
  "name": "NHSDigitalLocation",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Location",
  "baseDefinition": "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Location",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Location.identifier",
        "path": "Location.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "comment": "SHOULD contain an ANANA/ODS code."
      },
      {
        "id": "Location.identifier:odsCode",
        "path": "Location.identifier",
        "sliceName": "odsCode"
      },
      {
        "id": "Location.identifier:odsCode.system",
        "path": "Location.identifier.system",
        "min": 1,
        "fixedUri": "https://fhir.nhs.uk/Id/ods-organization-code"
      },
      {
        "id": "Location.identifier:odsCode.value",
        "path": "Location.identifier.value",
        "min": 1
      },
      {
        "id": "Location.address",
        "path": "Location.address",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Location.managingOrganization",
        "path": "Location.managingOrganization",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.nhs.uk/StructureDefinition/NHSDigital-Organization"
            ]
          }
        ],
        "constraint": [
          {
            "key": "nhds-10",
            "severity": "warning",
            "human": "managingOrganization - a display name should be provided",
            "expression": "(display.exists())"
          }
        ]
      },
      {
        "id": "Location.managingOrganization.identifier",
        "path": "Location.managingOrganization.identifier",
        "min": 1
      },
      {
        "id": "Location.managingOrganization.identifier.system",
        "path": "Location.managingOrganization.identifier.system",
        "min": 1
      },
      {
        "id": "Location.managingOrganization.identifier.value",
        "path": "Location.managingOrganization.identifier.value",
        "min": 1
      },
      {
        "id": "Location.partOf",
        "path": "Location.partOf",
        "constraint": [
          {
            "key": "nhsd-9",
            "severity": "warning",
            "human": "partOf - display name should be provided",
            "expression": "(display.exists())"
          }
        ]
      },
      {
        "id": "Location.partOf.identifier",
        "path": "Location.partOf.identifier",
        "min": 1
      },
      {
        "id": "Location.partOf.identifier.system",
        "path": "Location.partOf.identifier.system",
        "min": 1
      },
      {
        "id": "Location.partOf.identifier.value",
        "path": "Location.partOf.identifier.value",
        "min": 1
      }
    ]
  }
}