<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-reference-patient" />
  <url value="https://fhir.synapxe.sg/StructureDefinition/profile-reference-patient" />
  <name value="Reference" />
  <title value="Patient Reference Type Profile" />
  <status value="active" />
  <publisher value="Synapxe" />
  <description value="A profile constraining the Reference data type for references to Patient resources." />
  <fhirVersion value="5.0.0" />
  <kind value="complex-type" />
  <abstract value="false" />
  <type value="Reference" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Reference" />
  <derivation value="constraint" />
  <differential>
    <element id="Reference">
      <path value="Reference" />
      <constraint>
        <key value="ref-patient-local" />
        <severity value="error" />
        <human value="A patient reference is by identifier; Reference.reference may only point at a contained Patient (&quot;#&lt;id&gt;&quot;)" />
        <expression value="reference.empty() or reference.startsWith('#')" />
        <source value="https://fhir.synapxe.sg/StructureDefinition/profile-reference-patient" />
      </constraint>
    </element>
    <element id="Reference.id">
      <path value="Reference.id" />
      <max value="0" />
    </element>
    <element id="Reference.extension">
      <path value="Reference.extension" />
      <max value="0" />
    </element>
    <element id="Reference.reference">
      <path value="Reference.reference" />
      <short value="&quot;#&lt;id&gt;&quot; of a contained Patient, else absent" />
      <definition value="Only a local reference to a Patient contained in the same resource (e.g. &quot;#patient&quot;), so the contained Patient is referenced (dom-3). Bundle entries reference the patient by identifier only." />
    </element>
    <element id="Reference.type">
      <path value="Reference.type" />
      <min value="1" />
      <patternUri value="Patient" />
    </element>
    <element id="Reference.identifier">
      <path value="Reference.identifier" />
      <min value="1" />
      <type>
        <code value="Identifier" />
        <profile value="https://fhir.synapxe.sg/StructureDefinition/profile-identifier-nric" />
        <profile value="https://fhir.synapxe.sg/StructureDefinition/profile-identifier-fin" />
        <profile value="https://fhir.synapxe.sg/StructureDefinition/profile-identifier-others" />
        <profile value="https://fhir.synapxe.sg/StructureDefinition/profile-identifier-mrn" />
      </type>
    </element>
    <element id="Reference.identifier.system">
      <path value="Reference.identifier.system" />
      <short value="https://fhir.synapxe.sg/NamingSystem/nric, /fin, /others or /mrn" />
      <definition value="The naming system of the patient's identification: nric for an NRIC, fin for a FIN, others for any other identification document (e.g. a passport number, NEHR identification type P), with Identifier.type saying which document (patient-identifier-type); mrn when the patient is referenced by MRN (e.g. identification type OT)." />
      <min value="1" />
      <example>
        <label value="NRIC" />
        <valueUri value="https://fhir.synapxe.sg/NamingSystem/nric" />
      </example>
      <example>
        <label value="FIN" />
        <valueUri value="https://fhir.synapxe.sg/NamingSystem/fin" />
      </example>
      <example>
        <label value="Others" />
        <valueUri value="https://fhir.synapxe.sg/NamingSystem/others" />
      </example>
      <example>
        <label value="MRN" />
        <valueUri value="https://fhir.synapxe.sg/NamingSystem/mrn" />
      </example>
    </element>
  </differential>
</StructureDefinition>