{
  "resourceType": "StructureDefinition",
  "id": "UKCore-DiagnosticReport-Lab",
  "url": "https://fhir.hl7.org.uk/StructureDefinition/UKCore-DiagnosticReport-Lab",
  "version": "1.0.0",
  "name": "UKCoreDiagnosticReportLab",
  "title": "UK Core DiagnosticReport Lab",
  "status": "active",
  "date": "2023-04-28",
  "publisher": "HL7 UK",
  "contact": [
    {
      "name": "HL7 UK",
      "telecom": [
        {
          "system": "email",
          "value": "ukcore@hl7.org.uk",
          "use": "work",
          "rank": 1
        }
      ]
    }
  ],
  "description": "Defines the constraints and extensions on the UK Core Profile DiagnosticReport",
  "purpose": "To provide implementers with additional support when implementing test result data and to provide a consistent structure to how the data is presented.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "DiagnosticReport",
  "baseDefinition": "https://fhir.hl7.org.uk/StructureDefinition/UKCore-DiagnosticReport",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "DiagnosticReport",
        "path": "DiagnosticReport",
        "constraint": [
          {
            "key": "ukcore-diag-lab-001",
            "severity": "warning",
            "human": "An effective time SHOULD be present if status = partial, preliminary, final, amended, corrected or appended",
            "expression": "effective.exists() or (effective.empty() and (status in ('partial' | 'preliminary' | 'final' | 'amended' | 'corrected' | 'appended')).not())"
          }
        ]
      },
      {
        "id": "DiagnosticReport.category",
        "path": "DiagnosticReport.category",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "coding.code"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "DiagnosticReport.category:sliceLaboratory",
        "path": "DiagnosticReport.category",
        "sliceName": "sliceLaboratory"
      },
      {
        "id": "DiagnosticReport.category:sliceLaboratory.coding.system",
        "path": "DiagnosticReport.category.coding.system",
        "fixedUri": "http://terminology.hl7.org/CodeSystem/v2-0074"
      },
      {
        "id": "DiagnosticReport.category:sliceLaboratory.coding.code",
        "path": "DiagnosticReport.category.coding.code",
        "fixedCode": "LAB"
      },
      {
        "id": "DiagnosticReport.code",
        "path": "DiagnosticReport.code",
        "fixedCodeableConcept": {
          "coding": [
            {
              "system": "http://snomed.info/sct",
              "code": "721981007",
              "display": "Diagnostic studies report"
            }
          ]
        }
      },
      {
        "id": "DiagnosticReport.subject",
        "path": "DiagnosticReport.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Patient"
            ]
          }
        ]
      },
      {
        "id": "DiagnosticReport.result",
        "path": "DiagnosticReport.result",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Observation",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Observation-LabGroup",
              "https://fhir.hl7.org.uk/StructureDefinition/UKCore-Observation-Lab"
            ]
          }
        ]
      }
    ]
  }
}