{
  "resourceType": "StructureDefinition",
  "id": "SenaiteServiceRequest",
  "url": "https://senaite.com/modeling/fhir/StructureDefinition/SenaiteServiceRequest",
  "name": "SenaiteServiceRequest",
  "status": "draft",
  "description": "This will be an incoming lab request. It relies on references to:\r\n- Specimen: to handle the related specimen details.\r\n- Subject: The patient\r\n- Encounter: Determining where and when the request originated.\r\n- Requester: The practitioner who made the request.",
  "fhirVersion": "4.3.0",
  "kind": "resource",
  "abstract": false,
  "type": "ServiceRequest",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/ServiceRequest",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "ServiceRequest.extension",
        "path": "ServiceRequest.extension",
        "max": "0"
      },
      {
        "id": "ServiceRequest.modifierExtension",
        "path": "ServiceRequest.modifierExtension",
        "max": "0"
      },
      {
        "id": "ServiceRequest.identifier",
        "path": "ServiceRequest.identifier",
        "max": "0"
      },
      {
        "id": "ServiceRequest.instantiatesCanonical",
        "path": "ServiceRequest.instantiatesCanonical",
        "max": "0"
      },
      {
        "id": "ServiceRequest.instantiatesUri",
        "path": "ServiceRequest.instantiatesUri",
        "max": "0"
      },
      {
        "id": "ServiceRequest.basedOn",
        "path": "ServiceRequest.basedOn",
        "max": "0"
      },
      {
        "id": "ServiceRequest.replaces",
        "path": "ServiceRequest.replaces",
        "max": "0"
      },
      {
        "id": "ServiceRequest.requisition",
        "path": "ServiceRequest.requisition",
        "max": "0"
      },
      {
        "id": "ServiceRequest.status",
        "path": "ServiceRequest.status",
        "short": "draft | active | on-hold | revoked | entered-in-error"
      },
      {
        "id": "ServiceRequest.intent",
        "path": "ServiceRequest.intent",
        "short": "order | reflex-order ",
        "fixedCode": "order"
      },
      {
        "id": "ServiceRequest.category",
        "path": "ServiceRequest.category",
        "definition": "This will always be a Laboratory procedure",
        "min": 1,
        "max": "1"
      },
      {
        "id": "ServiceRequest.category.coding.system",
        "path": "ServiceRequest.category.coding.system",
        "definition": "Always using SNOMED",
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "ServiceRequest.category.coding.version",
        "path": "ServiceRequest.category.coding.version",
        "max": "0"
      },
      {
        "id": "ServiceRequest.category.coding.code",
        "path": "ServiceRequest.category.coding.code",
        "fixedCode": "108252007"
      },
      {
        "id": "ServiceRequest.category.coding.display",
        "path": "ServiceRequest.category.coding.display",
        "fixedString": "Laboratory procedure"
      },
      {
        "id": "ServiceRequest.category.coding.userSelected",
        "path": "ServiceRequest.category.coding.userSelected",
        "max": "0"
      },
      {
        "id": "ServiceRequest.category.text",
        "path": "ServiceRequest.category.text",
        "fixedString": "Laboratory procedure"
      },
      {
        "id": "ServiceRequest.doNotPerform",
        "path": "ServiceRequest.doNotPerform",
        "max": "0"
      },
      {
        "id": "ServiceRequest.code",
        "path": "ServiceRequest.code",
        "min": 1,
        "binding": {
          "strength": "preferred",
          "description": "For laboratory codes",
          "valueSet": "http://loinc.org"
        }
      },
      {
        "id": "ServiceRequest.code.extension",
        "path": "ServiceRequest.code.extension",
        "max": "0"
      },
      {
        "id": "ServiceRequest.code.coding.system",
        "path": "ServiceRequest.code.coding.system",
        "definition": "Prefer LOINC http://loinc.org and without this it will default to LOINC"
      },
      {
        "id": "ServiceRequest.code.coding.code",
        "path": "ServiceRequest.code.coding.code",
        "min": 1,
        "binding": {
          "strength": "preferred",
          "valueSet": "http://loinc.org"
        }
      },
      {
        "id": "ServiceRequest.orderDetail",
        "path": "ServiceRequest.orderDetail",
        "definition": "This is where we handle the individual test codes for the test comprised from the profile as defined in the code."
      },
      {
        "id": "ServiceRequest.orderDetail.extension",
        "path": "ServiceRequest.orderDetail.extension",
        "max": "0"
      },
      {
        "id": "ServiceRequest.orderDetail.coding",
        "path": "ServiceRequest.orderDetail.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "ServiceRequest.orderDetail.coding.system",
        "path": "ServiceRequest.orderDetail.coding.system",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://loinc.org"
        }
      },
      {
        "id": "ServiceRequest.orderDetail.coding.code",
        "path": "ServiceRequest.orderDetail.coding.code",
        "min": 1
      },
      {
        "id": "ServiceRequest.quantity[x]",
        "path": "ServiceRequest.quantity[x]",
        "max": "0"
      },
      {
        "id": "ServiceRequest.subject.reference",
        "path": "ServiceRequest.subject.reference",
        "constraint": [
          {
            "key": "subject-identified",
            "severity": "error",
            "human": "If there is no identifier then it must have a key",
            "expression": "hasValue() or subject.identifier.count()"
          }
        ]
      },
      {
        "id": "ServiceRequest.encounter.reference",
        "path": "ServiceRequest.encounter.reference",
        "min": 1
      },
      {
        "id": "ServiceRequest.encounter.type",
        "path": "ServiceRequest.encounter.type",
        "max": "0"
      },
      {
        "id": "ServiceRequest.encounter.identifier",
        "path": "ServiceRequest.encounter.identifier",
        "max": "0"
      },
      {
        "id": "ServiceRequest.encounter.display",
        "path": "ServiceRequest.encounter.display",
        "max": "0"
      },
      {
        "id": "ServiceRequest.occurrence[x]",
        "path": "ServiceRequest.occurrence[x]",
        "max": "0"
      },
      {
        "id": "ServiceRequest.asNeeded[x]",
        "path": "ServiceRequest.asNeeded[x]",
        "max": "0"
      },
      {
        "id": "ServiceRequest.requester.extension",
        "path": "ServiceRequest.requester.extension",
        "max": "0"
      },
      {
        "id": "ServiceRequest.requester.reference",
        "path": "ServiceRequest.requester.reference",
        "min": 1
      },
      {
        "id": "ServiceRequest.requester.type",
        "path": "ServiceRequest.requester.type",
        "min": 1,
        "fixedUri": "Practitioner"
      },
      {
        "id": "ServiceRequest.requester.identifier",
        "path": "ServiceRequest.requester.identifier",
        "max": "0"
      },
      {
        "id": "ServiceRequest.requester.display",
        "path": "ServiceRequest.requester.display",
        "max": "0"
      },
      {
        "id": "ServiceRequest.performerType",
        "path": "ServiceRequest.performerType",
        "max": "0"
      },
      {
        "id": "ServiceRequest.performer",
        "path": "ServiceRequest.performer",
        "max": "0"
      },
      {
        "id": "ServiceRequest.locationCode",
        "path": "ServiceRequest.locationCode",
        "max": "0"
      },
      {
        "id": "ServiceRequest.locationReference",
        "path": "ServiceRequest.locationReference",
        "max": "0"
      },
      {
        "id": "ServiceRequest.reasonCode",
        "path": "ServiceRequest.reasonCode",
        "max": "0"
      },
      {
        "id": "ServiceRequest.reasonReference",
        "path": "ServiceRequest.reasonReference",
        "max": "0"
      },
      {
        "id": "ServiceRequest.insurance",
        "path": "ServiceRequest.insurance",
        "max": "0"
      },
      {
        "id": "ServiceRequest.supportingInfo",
        "path": "ServiceRequest.supportingInfo",
        "max": "0"
      },
      {
        "id": "ServiceRequest.specimen",
        "path": "ServiceRequest.specimen",
        "min": 1,
        "max": "1"
      },
      {
        "id": "ServiceRequest.specimen.reference",
        "path": "ServiceRequest.specimen.reference",
        "min": 1
      },
      {
        "id": "ServiceRequest.note.extension",
        "path": "ServiceRequest.note.extension",
        "max": "0"
      },
      {
        "id": "ServiceRequest.patientInstruction",
        "path": "ServiceRequest.patientInstruction",
        "max": "0"
      },
      {
        "id": "ServiceRequest.relevantHistory",
        "path": "ServiceRequest.relevantHistory",
        "max": "0"
      }
    ]
  }
}