{
  "resourceType": "StructureDefinition",
  "id": "745e2135-9b3c-4c0c-a3f7-5f22961db23a",
  "url": "https://fhir.nhs.uk/fhir/StructureDefinition/NHSDigital-Logical-Request",
  "name": "NHSDigitalLogicalRequest",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "kind": "logical",
  "abstract": false,
  "type": "https://fhir.nhs.uk/fhir/StructureDefinition/UKCore-Request",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Element",
  "derivation": "specialization",
  "snapshot": {
    "element": [
      {
        "id": "UKCore-Request",
        "path": "UKCore-Request",
        "short": "Base for all elements",
        "definition": "Base definition for all elements in a resource.",
        "min": 0,
        "max": "*",
        "base": {
          "path": "UKCore-Request",
          "min": 0,
          "max": "*"
        },
        "type": [
          {
            "code": "Element"
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          }
        ]
      },
      {
        "id": "UKCore-Request.id",
        "path": "UKCore-Request.id",
        "representation": [
          "xmlAttr"
        ],
        "short": "Unique id for inter-element referencing",
        "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.",
        "min": 0,
        "max": "1",
        "base": {
          "path": "Element.id",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "extension": [
              {
                "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type",
                "valueUrl": "string"
              }
            ],
            "code": "http://hl7.org/fhirpath/System.String"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          }
        ]
      },
      {
        "id": "UKCore-Request.extension",
        "path": "UKCore-Request.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "description": "Extensions are always sliced by (at least) url",
          "rules": "open"
        },
        "short": "Additional content defined by implementations",
        "definition": "May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
        "comment": "There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.",
        "alias": [
          "extensions",
          "user content"
        ],
        "min": 0,
        "max": "*",
        "base": {
          "path": "Element.extension",
          "min": 0,
          "max": "*"
        },
        "type": [
          {
            "code": "Extension"
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "ext-1",
            "severity": "error",
            "human": "Must have either extensions or value[x], not both",
            "expression": "extension.exists() != value.exists()",
            "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])",
            "source": "http://hl7.org/fhir/StructureDefinition/Extension"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "rim",
            "map": "N/A"
          }
        ]
      },
      {
        "id": "UKCore-Request.identifier",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "UKCore-Request.identifier",
        "short": "An identifier intended for computation",
        "definition": "At least one identifier MUST be provided.",
        "min": 1,
        "max": "*",
        "base": {
          "path": "UKCore-Request.identifier",
          "min": 1,
          "max": "*"
        },
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Identifier"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "v2",
            "map": "CX / EI (occasionally, more often EI maps to a resource id or a URL)"
          },
          {
            "identity": "rim",
            "map": "II - The Identifier class is a little looser than the v3 type II because it allows URIs as well as registered OIDs or GUIDs.  Also maps to Role[classCode=IDENT]"
          },
          {
            "identity": "servd",
            "map": "Identifier"
          }
        ]
      },
      {
        "id": "UKCore-Request.subject",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "UKCore-Request.subject",
        "short": "A reference from one resource to another",
        "definition": "reference should be provided\r\nidentifier (NHS Number) MUST be provided (if traced), it is not permitted to exchange untraced NHS Numbers",
        "comment": "References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "UKCore-Request.subject",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Patient"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "ref-1",
            "severity": "error",
            "human": "SHALL have a contained resource if a local reference is provided",
            "expression": "reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))",
            "xpath": "not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])",
            "source": "http://hl7.org/fhir/StructureDefinition/Reference"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "rim",
            "map": "The target of a resource reference is a RIM entry point (Act, Role, or Entity)"
          }
        ]
      },
      {
        "id": "UKCore-Request.requester",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "UKCore-Request.requester",
        "short": "A reference from one resource to another",
        "definition": "A reference from one resource to another.",
        "comment": "References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "UKCore-Request.requester",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Organization",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Practitioner",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Patient",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-PractitionerRole"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "ref-1",
            "severity": "error",
            "human": "SHALL have a contained resource if a local reference is provided",
            "expression": "reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))",
            "xpath": "not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])",
            "source": "http://hl7.org/fhir/StructureDefinition/Reference"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "rim",
            "map": "The target of a resource reference is a RIM entry point (Act, Role, or Entity)"
          }
        ]
      },
      {
        "id": "UKCore-Request.code",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "UKCore-Request.code",
        "short": "Concept - reference to a terminology or just  text",
        "definition": "A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.",
        "comment": "Not all terminology uses fit this general pattern. In some cases, models should not use CodeableConcept and use Coding directly and provide their own structure for managing text, codings, translations and the relationship between elements and pre- and post-coordination.",
        "min": 1,
        "max": "1",
        "base": {
          "path": "UKCore-Request.code",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "CodeableConcept",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/CodeableConcept"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "v2",
            "map": "CE/CNE/CWE"
          },
          {
            "identity": "rim",
            "map": "CD"
          },
          {
            "identity": "orim",
            "map": "fhir:CodeableConcept rdfs:subClassOf dt:CD"
          }
        ]
      },
      {
        "id": "UKCore-Request.status",
        "path": "UKCore-Request.status",
        "short": "Primitive Type code",
        "definition": "A string which has at least one character and no leading or trailing whitespace and where there is no whitespace other than single spaces in the contents",
        "comment": "Note that FHIR strings SHALL NOT exceed 1MB in size",
        "min": 1,
        "max": "1",
        "base": {
          "path": "UKCore-Request.status",
          "min": 1,
          "max": "1"
        },
        "type": [
          {
            "code": "code",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/code"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          }
        ]
      },
      {
        "id": "UKCore-Request.encounter",
        "extension": [
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
            "valueCode": "normative"
          },
          {
            "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-normative-version",
            "valueCode": "4.0.0"
          }
        ],
        "path": "UKCore-Request.encounter",
        "short": "Encounter created as part of (recommended)",
        "definition": "A reference from one resource to another.",
        "comment": "References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository.",
        "min": 0,
        "max": "1",
        "base": {
          "path": "UKCore-Request.encounter",
          "min": 0,
          "max": "1"
        },
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Encounter"
            ]
          }
        ],
        "condition": [
          "ele-1"
        ],
        "constraint": [
          {
            "key": "ele-1",
            "severity": "error",
            "human": "All FHIR elements must have a @value or children",
            "expression": "hasValue() or (children().count() > id.count())",
            "xpath": "@value|f:*|h:div",
            "source": "http://hl7.org/fhir/StructureDefinition/Element"
          },
          {
            "key": "ref-1",
            "severity": "error",
            "human": "SHALL have a contained resource if a local reference is provided",
            "expression": "reference.startsWith('#').not() or (reference.substring(1).trace('url') in %rootResource.contained.id.trace('ids'))",
            "xpath": "not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])",
            "source": "http://hl7.org/fhir/StructureDefinition/Reference"
          }
        ],
        "mapping": [
          {
            "identity": "rim",
            "map": "n/a"
          },
          {
            "identity": "rim",
            "map": "The target of a resource reference is a RIM entry point (Act, Role, or Entity)"
          }
        ]
      }
    ]
  },
  "differential": {
    "element": [
      {
        "id": "UKCore-Request",
        "path": "UKCore-Request",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Element"
          }
        ]
      },
      {
        "id": "UKCore-Request.identifier",
        "path": "UKCore-Request.identifier",
        "definition": "At least one identifier MUST be provided.",
        "min": 1,
        "max": "*",
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/Identifier"
            ]
          }
        ]
      },
      {
        "id": "UKCore-Request.subject",
        "path": "UKCore-Request.subject",
        "definition": "reference should be provided\r\nidentifier (NHS Number) MUST be provided (if traced), it is not permitted to exchange untraced NHS Numbers",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Patient"
            ]
          }
        ]
      },
      {
        "id": "UKCore-Request.requester",
        "path": "UKCore-Request.requester",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Organization",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Practitioner",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Patient",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-PractitionerRole"
            ]
          }
        ]
      },
      {
        "id": "UKCore-Request.code",
        "path": "UKCore-Request.code",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "CodeableConcept",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/CodeableConcept"
            ]
          }
        ]
      },
      {
        "id": "UKCore-Request.status",
        "path": "UKCore-Request.status",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "code",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/code"
            ]
          }
        ]
      },
      {
        "id": "UKCore-Request.encounter",
        "path": "UKCore-Request.encounter",
        "short": "Encounter created as part of (recommended)",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Encounter"
            ]
          }
        ]
      }
    ]
  }
}