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