<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="NHSEngland-DocumentReference-GenomicDataFile" />
  <url value="https://fhir.nhs.uk/StructureDefinition/NHSEngland-DocumentReference-GenomicDataFile" />
  <version value="0.3.0" />
  <name value="NHSEngland_DocumentReference_GenomicDataFile" />
  <title value="NHSEngland DocumentReference GenomicDataFile" />
  <status value="active" />
  <date value="2026-04-16" />
  <publisher value="NHS England" />
  <contact>
    <name value="NHS England" />
    <telecom>
      <system value="email" />
      <value value="interoperabilityteam@nhs.net" />
      <use value="work" />
      <rank value="1" />
    </telecom>
  </contact>
  <description value="This profile defines the Genomics constraints and extensions on the Genomics Reporting FHIR resource [Genomic Data File DocumentReference](http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/genomic-data-file)." />
  <purpose value="The DocumentReference resource is used to reference data files generated as part of genomic testing and allow these files to be retrieved through the DRS API standard.&#xD;&#xA;&#xD;&#xA;Primarily, the ServiceRequest SHALL be referenced via DiagnosticReport.basedOn. The DocumentReference then links back to the report via DocumentReference.context.related.&#xD;&#xA;&#xD;&#xA;If following the Genomic Reporting IG, you could also reference the DocumentReference from the DiagnosticReport using the following chain: DiagnosticReport.extension:genomic-study -&gt; Procedure (Genomic Study).extension:genomic-study-analysis -&gt; Procedure (Genomic Study Analysis).extension:output.extension:file.valueReference -&gt; DocumentReference (Genomic Data File)&#xD;&#xA;&#xD;&#xA;The R5 DiagnosticReport.media.link reference to DocumentReference MAY be used to support referencing the data files from the DiagnosticReport directly. DiagnosticReport resources MAY alternatively reference the DocumentReference for the data used by the report though the DiagnosticReport.extension:supporting-info element. In all cases the DocumentReference SHOULD reference the DNA Specimen from which the data originated and the ServiceRequest which triggered the capture of the data.&#xD;&#xA;&#xD;&#xA;Additionally MAY be used within requests to reference binary files such as images or unstructured reports." />
  <copyright value="Copyright © 2026+ NHS England Licensed under the Apache License, Version 2.0 (the \\\&quot;License\\\&quot;); you may not use this file except in compliance with the License. You may obtain a copy of the License at  http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \\\&quot;AS IS\\\&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. HL7® FHIR® standard Copyright © 2011+ HL7 The HL7® FHIR® standard is used under the FHIR license. You may obtain a copy of the FHIR license at  https://www.hl7.org/fhir/license.html." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="DocumentReference" />
  <baseDefinition value="http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/genomic-data-file" />
  <derivation value="constraint" />
  <differential>
    <element id="DocumentReference.subject">
      <path value="DocumentReference.subject" />
      <definition value="SHOULD be present if related to a patient. Reference to the Patient this data file is pertaining to. This MAY be through a resource reference if the ID on the central service is known (or provided within the transaction bundle) or through NHS number where this is known and has been traced through PDS" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.uk/StructureDefinition/NHSEngland-Patient-Genomics" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Group" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Device" />
        <aggregation value="referenced" />
      </type>
    </element>
    <element id="DocumentReference.author">
      <path value="DocumentReference.author" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <definition value="SHOULD reference the organization responsible for creating the data file, preferably by ODS code." />
    </element>
    <element id="DocumentReference.author:authorODS">
      <path value="DocumentReference.author" />
      <sliceName value="authorODS" />
    </element>
    <element id="DocumentReference.author:authorODS.reference">
      <path value="DocumentReference.author.reference" />
      <max value="0" />
    </element>
    <element id="DocumentReference.author:authorODS.identifier">
      <path value="DocumentReference.author.identifier" />
      <min value="1" />
    </element>
    <element id="DocumentReference.author:authorODS.identifier.system">
      <path value="DocumentReference.author.identifier.system" />
      <fixedUri value="https://fhir.nhs.uk/Id/ods-organization-code" />
    </element>
    <element id="DocumentReference.description">
      <path value="DocumentReference.description" />
      <definition value="Human readable description for the data file. NOTE: this is being used in place of DocumentReference.type until suitable LOINC or SNOMED CT concepts are identified for the file types expected." />
    </element>
    <element id="DocumentReference.content">
      <path value="DocumentReference.content" />
      <definition value="SHOULD be a DRS compatible reference to the data file." />
    </element>
    <element id="DocumentReference.context">
      <path value="DocumentReference.context" />
      <definition value="In all cases the DocumentReference SHOULD reference the DNA Specimen from which the data originated, where available, and the ServiceRequest which triggered the capture of the data.&#xD;&#xA;The DiagnosticReport using the data file SHOULD reference the DocumentReference via the DiagnosticReport.extension:supporting-info element. This guidance will be updated upon release of the R5 backport of DiagnosticReport.media, allowing references to DocumentReference. Once backported, the DiagnosticReport.media.link SHOULD be used to reference the DocumentReference resources for data files analysed for the report instead." />
    </element>
    <element id="DocumentReference.context.related">
      <path value="DocumentReference.context.related" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="type" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.nhs.uk/StructureDefinition/NHSEngland-Specimen-Genomics" />
        <targetProfile value="https://fhir.nhs.uk/StructureDefinition/NHSEngland-DiagnosticReport-GenomicReport" />
        <targetProfile value="https://fhir.nhs.uk/StructureDefinition/NHSEngland-ServiceRequest-Genomics" />
        <targetProfile value="http://hl7.org/fhir/uv/genomics-reporting/StructureDefinition/genomic-report" />
        <aggregation value="referenced" />
      </type>
    </element>
    <element id="DocumentReference.context.related:relatedServiceRequest">
      <path value="DocumentReference.context.related" />
      <sliceName value="relatedServiceRequest" />
    </element>
    <element id="DocumentReference.context.related:relatedServiceRequest.reference">
      <path value="DocumentReference.context.related.reference" />
      <min value="1" />
    </element>
    <element id="DocumentReference.context.related:relatedServiceRequest.type">
      <path value="DocumentReference.context.related.type" />
      <fixedUri value="ServiceRequest" />
    </element>
    <element id="DocumentReference.context.related:relatedSpecimen">
      <path value="DocumentReference.context.related" />
      <sliceName value="relatedSpecimen" />
    </element>
    <element id="DocumentReference.context.related:relatedSpecimen.reference">
      <path value="DocumentReference.context.related.reference" />
      <min value="1" />
    </element>
    <element id="DocumentReference.context.related:relatedSpecimen.type">
      <path value="DocumentReference.context.related.type" />
      <fixedUri value="Specimen" />
    </element>
  </differential>
</StructureDefinition>