{
  "resourceType": "StructureDefinition",
  "id": "NHSHC-Observation-Laboratory",
  "url": "https://fhir.nhs.uk/StructureDefinition/NHSHC-Observation-Laboratory",
  "version": "0.1.0",
  "name": "NHSHCObservationLaboratory",
  "title": "NHSHC Observation - Laboratory",
  "status": "draft",
  "date": "2026-07-30",
  "publisher": "NHS England",
  "description": "Derived profile from NHSHC-Observation for laboratory results in NHS Health Check Online. Constrains category to laboratory and provides code slices for cholesterol panel, serum cholesterol, HDL cholesterol, cholesterol ratio, and HbA1c with its component.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "https://fhir.nhs.uk/StructureDefinition/NHSHC-Observation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation",
        "constraint": [
          {
            "key": "nhshc-lab-1",
            "severity": "error",
            "human": "At least one of value[x], dataAbsentReason, component, or hasMember must be present.",
            "expression": "value.exists() or dataAbsentReason.exists() or component.exists() or hasMember.exists()"
          }
        ]
      },
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "min": 1,
        "fixedCode": "final"
      },
      {
        "id": "Observation.category",
        "path": "Observation.category",
        "min": 1,
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/observation-category",
              "code": "laboratory"
            }
          ]
        }
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "min": 1,
        "binding": {
          "strength": "required",
          "valueSet": "https://fhir.nhs.uk/ValueSet/NHSHC-LaboratoryCode"
        }
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Patient"
            ]
          }
        ]
      },
      {
        "id": "Observation.encounter",
        "path": "Observation.encounter",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.nhs.uk/StructureDefinition/NHSHC-Encounter"
            ]
          }
        ]
      },
      {
        "id": "Observation.effective[x]",
        "path": "Observation.effective[x]",
        "min": 1
      },
      {
        "id": "Observation.performer",
        "path": "Observation.performer",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Organization",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Practitioner"
            ]
          }
        ]
      },
      {
        "id": "Observation.component",
        "path": "Observation.component",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "code"
            }
          ],
          "description": "Slice by HbA1c component",
          "rules": "open"
        }
      },
      {
        "id": "Observation.component:hba1cLevel",
        "path": "Observation.component",
        "sliceName": "hba1cLevel",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Observation.component:hba1cLevel.code",
        "path": "Observation.component.code",
        "binding": {
          "strength": "required",
          "valueSet": "https://fhir.nhs.uk/ValueSet/NHSHC-HbA1cComponentCode"
        }
      }
    ]
  }
}