<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-fileattachment" />
  <url value="https://fhir.synapxe.sg/StructureDefinition/profile-fileattachment" />
  <name value="FileAttachment" />
  <title value="File Attachment Profile" />
  <status value="active" />
  <description value="DocumentReference profile for storing file attachments associated with clinical documentation." />
  <fhirVersion value="5.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="DocumentReference" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DocumentReference" />
  <derivation value="constraint" />
  <differential>
    <element id="DocumentReference">
      <path value="DocumentReference" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment`: Refers to content represented using file attachments.&#xA;- `putComposition/composition/section/content/other/extension/fileAttachment`: Refers to data content represented using an external file format.&#xA;- `putDischargeSummary/fileAttachment`: File attachments associated with the discharge summary.&#xA;- `putEDNotes/fileAttachment`: Refers to data content represented using an attachment format.&#xA;- `putOTNotes/content/Composition/section/entry/DiagnosticReport/presentedForm`: Rich text representation of the entire result as issued by the diagnostic service.&#xA;- `putOTNotes/content/Composition/section/entry/Procedure/report/presentedForm`: Rich text representation of the report.&#xA;- `putOTNotes/fileAttachment`: Refers to data content represented using an attachment format." />
    </element>
    <element id="DocumentReference.identifier">
      <path value="DocumentReference.identifier" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/sequenceNo`: Sequence number assigned to the attachment.&#xA;- `putComposition/composition/section/content/other/extension/fileAttachment/sequenceId`: Display sequence number of the attachment.&#xA;- `putDischargeSummary/fileAttachment/sequenceNo`: Sequence number assigned to the attachment.&#xA;- `putEDNotes/fileAttachment/sequenceNo`: Sequence number of the attachment within the message payload.&#xA;- `putOTNotes/fileAttachment/sequenceNo`: Sequence number assigned to the attachment within the message payload." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Identifier" />
        <profile value="https://fhir.synapxe.sg/StructureDefinition/profile-identifier-sequence-no" />
      </type>
    </element>
    <element id="DocumentReference.version">
      <path value="DocumentReference.version" />
      <max value="0" />
    </element>
    <element id="DocumentReference.basedOn">
      <path value="DocumentReference.basedOn" />
      <max value="0" />
    </element>
    <element id="DocumentReference.status">
      <path value="DocumentReference.status" />
      <patternCode value="current" />
    </element>
    <element id="DocumentReference.docStatus">
      <path value="DocumentReference.docStatus" />
      <max value="0" />
    </element>
    <element id="DocumentReference.modality">
      <path value="DocumentReference.modality" />
      <max value="0" />
    </element>
    <element id="DocumentReference.type">
      <path value="DocumentReference.type" />
      <max value="0" />
    </element>
    <element id="DocumentReference.category">
      <path value="DocumentReference.category" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/attachmentCategory`: Category of the attachment.&#xA;- `putOTNotes/fileAttachment/attachmentCategory`: Code that classifies the category of the attachment." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
        <profile value="https://fhir.synapxe.sg/StructureDefinition/profile-codeableconcept" />
      </type>
      <binding>
        <strength value="required" />
        <valueSet value="https://fhir.synapxe.sg/ValueSet/attachment-category" />
      </binding>
    </element>
    <element id="DocumentReference.category.coding.system">
      <path value="DocumentReference.category.coding.system" />
    </element>
    <element id="DocumentReference.subject">
      <path value="DocumentReference.subject" />
      <max value="0" />
    </element>
    <element id="DocumentReference.context">
      <path value="DocumentReference.context" />
      <max value="0" />
    </element>
    <element id="DocumentReference.event">
      <path value="DocumentReference.event" />
      <max value="0" />
    </element>
    <element id="DocumentReference.bodySite">
      <path value="DocumentReference.bodySite" />
      <max value="0" />
    </element>
    <element id="DocumentReference.facilityType">
      <path value="DocumentReference.facilityType" />
      <max value="0" />
    </element>
    <element id="DocumentReference.practiceSetting">
      <path value="DocumentReference.practiceSetting" />
      <max value="0" />
    </element>
    <element id="DocumentReference.period">
      <path value="DocumentReference.period" />
      <max value="0" />
    </element>
    <element id="DocumentReference.date">
      <path value="DocumentReference.date" />
      <max value="0" />
    </element>
    <element id="DocumentReference.author">
      <path value="DocumentReference.author" />
      <max value="0" />
    </element>
    <element id="DocumentReference.attester">
      <path value="DocumentReference.attester" />
      <max value="0" />
    </element>
    <element id="DocumentReference.custodian">
      <path value="DocumentReference.custodian" />
      <max value="0" />
    </element>
    <element id="DocumentReference.relatesTo">
      <path value="DocumentReference.relatesTo" />
      <max value="0" />
    </element>
    <element id="DocumentReference.description">
      <path value="DocumentReference.description" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/comments`: Additional comments describing the attachment.&#xA;- `putDischargeSummary/fileAttachment/comments`: Additional comments describing the attachment.&#xA;- `putOTNotes/content/Composition/section/entry/DiagnosticReport/presentedForm/comments`: Additional comments describing the attachment.&#xA;- `putOTNotes/content/Composition/section/entry/Procedure/report/presentedForm/comments`: Additional comments used to describe the attachment, if any&#xA;- `putOTNotes/fileAttachment/comments`: Additional comments used to describe the attachment." />
    </element>
    <element id="DocumentReference.securityLabel">
      <path value="DocumentReference.securityLabel" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.id">
      <path value="DocumentReference.content.id" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.extension">
      <path value="DocumentReference.content.extension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.modifierExtension">
      <path value="DocumentReference.content.modifierExtension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.extension">
      <path value="DocumentReference.content.attachment.extension" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.contentType">
      <path value="DocumentReference.content.attachment.contentType" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/contentType`: MIME type of the attachment.&#xA;- `putComposition/composition/section/content/other/extension/fileAttachment/contentType`: Identifies the type of content in the attachment and how it should be interpreted.&#xA;- `putDischargeSummary/fileAttachment/contentType`: Identifies the type of data contained in the attachment and how it should be interpreted.&#xA;- `putEDNotes/fileAttachment/contentType`: Type of content contained within the attachment.&#xA;- `putOTNotes/content/Composition/section/entry/DiagnosticReport/presentedForm/contentType`: Type of the attachment content.&#xA;- `putOTNotes/content/Composition/section/entry/Procedure/report/presentedForm/contentType`: Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.&#xA;- `putOTNotes/fileAttachment/contentType`: Identifies the type of content contained in the attachment and how it should be interpreted." />
      <min value="1" />
    </element>
    <element id="DocumentReference.content.attachment.language">
      <path value="DocumentReference.content.attachment.language" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/language`: Human language of the attachment content.&#xA;- `putComposition/composition/section/content/other/extension/fileAttachment/language`: Human language of the attachment content.&#xA;- `putDischargeSummary/fileAttachment/language`: Human language of the attachment content.&#xA;- `putEDNotes/fileAttachment/language`: Human language of the attachment content.&#xA;- `putOTNotes/content/Composition/section/entry/DiagnosticReport/presentedForm/language`: Human language of the attachment content.&#xA;- `putOTNotes/content/Composition/section/entry/Procedure/report/presentedForm/language`: The human language of the content. The value can be any valid value according to BCP 47.&#xA;- `putOTNotes/fileAttachment/language`: Human language of the attachment content." />
    </element>
    <element id="DocumentReference.content.attachment.data">
      <path value="DocumentReference.content.attachment.data" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/data`: Base64 encoded attachment content.&#xA;- `putComposition/composition/section/content/other/extension/fileAttachment/file`: Actual attachment content represented as a sequence of bytes encoded in base64.&#xA;- `putDischargeSummary/fileAttachment/file`: Actual content of the attachment represented as a sequence of bytes.&#xA;- `putEDNotes/fileAttachment/file`: Actual attachment content represented as base64 encoded bytes.&#xA;- `putOTNotes/content/Composition/section/entry/DiagnosticReport/presentedForm/data`: Actual attachment data represented using base64 encoding.&#xA;- `putOTNotes/content/Composition/section/entry/Procedure/report/presentedForm/data`: The actual data of the attachment - a sequence of bytes. In XML, represented using base64.&#xA;- `putOTNotes/fileAttachment/data`: Actual content of the attachment represented as a sequence of bytes encoded in base64." />
      <min value="1" />
    </element>
    <element id="DocumentReference.content.attachment.url">
      <path value="DocumentReference.content.attachment.url" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.size">
      <path value="DocumentReference.content.attachment.size" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/size`: Number of bytes in the attachment.&#xA;- `putComposition/composition/section/content/other/extension/fileAttachment/size`: Number of bytes that make up the attachment.&#xA;- `putDischargeSummary/fileAttachment/size`: Number of bytes contained in the attachment.&#xA;- `putEDNotes/fileAttachment/size`: Number of bytes contained in the attachment.&#xA;- `putOTNotes/content/Composition/section/entry/DiagnosticReport/presentedForm/size`: Number of bytes in the attachment.&#xA;- `putOTNotes/content/Composition/section/entry/Procedure/report/presentedForm/size`: The number of bytes of data that make up this attachment.&#xA;- `putOTNotes/fileAttachment/size`: Number of bytes contained within the attachment." />
    </element>
    <element id="DocumentReference.content.attachment.hash">
      <path value="DocumentReference.content.attachment.hash" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.title">
      <path value="DocumentReference.content.attachment.title" />
      <definition value="Carries these NEHR XML elements:&#xA;&#xA;- `putCardiology/fileAttachment/title`: Display title of the attachment.&#xA;- `putComposition/composition/section/content/other/extension/fileAttachment/title`: Label or display title associated with the attachment.&#xA;- `putDischargeSummary/fileAttachment/title`: Label or title displayed for the attachment.&#xA;- `putOTNotes/content/Composition/section/entry/DiagnosticReport/presentedForm/title`: Display label for the attachment.&#xA;- `putOTNotes/content/Composition/section/entry/Procedure/report/presentedForm/title`: A label or set of text to display in place of the data.&#xA;- `putOTNotes/fileAttachment/title`: Label or title used to display the attachment." />
    </element>
    <element id="DocumentReference.content.attachment.height">
      <path value="DocumentReference.content.attachment.height" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.width">
      <path value="DocumentReference.content.attachment.width" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.frames">
      <path value="DocumentReference.content.attachment.frames" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.duration">
      <path value="DocumentReference.content.attachment.duration" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.attachment.pages">
      <path value="DocumentReference.content.attachment.pages" />
      <max value="0" />
    </element>
    <element id="DocumentReference.content.profile">
      <path value="DocumentReference.content.profile" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>