<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-patient-sg-nric" />
  <url value="https://fhir.synapxe.sg/StructureDefinition/profile-patient-sg-nric" />
  <version value="1.0.0" />
  <name value="SGPatientNRICProfile" />
  <title value="Singapore Patient Profile with NRIC" />
  <status value="draft" />
  <date value="2026-05-25" />
  <publisher value="Synapxe" />
  <description value="A FHIR Patient profile for Singapore healthcare context requiring NRIC (National Registration Identity Card) as the primary identifier. This profile enforces Singapore NRIC format validation and mandates specific identifier fields." />
  <purpose value="To standardize patient identification in Singapore healthcare systems using NRIC as the primary identifier, ensuring data quality and interoperability across healthcare institutions." />
  <fhirVersion value="5.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Patient" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient" />
  <derivation value="constraint" />
  <differential>
    <element id="Patient">
      <path value="Patient" />
      <short value="Singapore Patient with NRIC" />
      <definition value="Patient resource profiled for Singapore healthcare context with mandatory NRIC identifier." />
    </element>
    <element id="Patient.identifier">
      <path value="Patient.identifier" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="system" />
        </discriminator>
        <description value="Slice based on identifier system to distinguish NRIC from other identifier types" />
        <ordered value="false" />
        <rules value="open" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:nric">
      <path value="Patient.identifier" />
      <sliceName value="nric" />
      <short value="Singapore NRIC" />
      <definition value="Singapore National Registration Identity Card number. Must follow the format: S/T/F/G/M + 7 digits + checksum letter." />
      <min value="1" />
      <max value="1" />
      <patternIdentifier>
        <system value="https://fhir.synapxe.sg/NamingSystem/nric" />
      </patternIdentifier>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:nric.use">
      <path value="Patient.identifier.use" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Patient.identifier:nric.type">
      <path value="Patient.identifier.type" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Patient.identifier:nric.system">
      <path value="Patient.identifier.system" />
      <short value="NRIC identifier system" />
      <definition value="Fixed URI for Singapore NRIC identification system" />
      <min value="1" />
      <max value="1" />
      <fixedUri value="https://fhir.synapxe.sg/NamingSystem/nric" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:nric.value">
      <path value="Patient.identifier.value" />
      <short value="NRIC number" />
      <definition value="The actual NRIC number in the format: S/T/F/G/M + 7 digits + checksum letter (e.g., S1234567D)" />
      <min value="1" />
      <max value="1" />
      <constraint>
        <key value="nric-format-1" />
        <severity value="error" />
        <human value="NRIC must follow Singapore NRIC format: S/T/F/G/M followed by 7 digits and a checksum letter" />
        <expression value="matches('^[STFGM]\\d{7}[A-Z]$')" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:nric.period">
      <path value="Patient.identifier.period" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Patient.identifier:nric.assigner">
      <path value="Patient.identifier.assigner" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Patient.name">
      <path value="Patient.name" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.gender">
      <path value="Patient.gender" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.birthDate">
      <path value="Patient.birthDate" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>