<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-patient" />
  <url value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient" />
  <version value="1.1.1" />
  <name value="PatientProfile" />
  <title value="Patient Profile" />
  <status value="draft" />
  <date value="2026-01-09" />
  <publisher value="HL7 Canada - FHIR Implementation Work Group" />
  <contact>
    <telecom>
      <system value="url" />
      <value value="https://infocentral.infoway-inforoute.ca/en/collaboration/wg/fhir-implementations" />
    </telecom>
  </contact>
  <description value="Proposed constraints and extensions on the Patient Resource as scoped to human patients" />
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166" />
      <code value="CA" />
    </coding>
  </jurisdiction>
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="cda" />
    <uri value="http://hl7.org/v3/cda" />
    <name value="CDA (R2)" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <mapping>
    <identity value="loinc" />
    <uri value="http://loinc.org" />
    <name value="LOINC code for the element" />
  </mapping>
  <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="Patient Profile" />
      <definition value="The Patient Profile is based upon the core FHIR Patient Resource" />
      <isModifier value="false" />
    </element>
    <element id="Patient.extension">
      <path value="Patient.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Patient.extension:aboriginalidentitygroup">
      <path value="Patient.extension" />
      <sliceName value="aboriginalidentitygroup" />
      <short value="Extension: Aboriginal Identity Group" />
      <definition value="A code classifying the person's aboriginal identity" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-aboriginalidentitygroup" />
      </type>
    </element>
    <element id="Patient.extension:aboriginalidentityindicator">
      <path value="Patient.extension" />
      <sliceName value="aboriginalidentityindicator" />
      <short value="Extension: Aboriginal Identity Indicator" />
      <definition value="A code classifying the person's self identity as an aboriginal person" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-aboriginalidentityindicator" />
      </type>
    </element>
    <element id="Patient.extension:birthsex">
      <path value="Patient.extension" />
      <sliceName value="birthsex" />
      <short value="Extension: Sex at Birth" />
      <definition value="A code classifying the person's sex assigned at birth  as specified by the [TODO: assigning authority]. This extension aligns with the C-CDA Birth Sex Observation (LOINC 76689-9)" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-patientbirthsex" />
      </type>
    </element>
    <element id="Patient.extension:ethnicity">
      <path value="Patient.extension" />
      <sliceName value="ethnicity" />
      <short value="Extension: ethnicity extension" />
      <definition value="A code classifying the person's ethnic group or ethnicity as the category of people who identify with each other, usually on the basis of a presumed common genealogy or ancestry or on other similarities." />
      <comment value="This attribute is based on the belief of the person or the person reporting the attribute, not on any formal analysis of genetic, genealogical or historical relationships as these would need to be captured as observations." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-ethnicity" />
      </type>
      <isModifier value="false" />
      <mapping>
        <identity value="HL7v2" />
        <map value="PID.22 [Ethnic Group]" />
        <comment value="This field further defines the patient's ancestry.  Refer to User-defined Table 0189 - Ethnic Group in Chapter 2C, Code Tables, for suggested values." />
      </mapping>
      <mapping>
        <identity value="rim" />
        <map value="Person.ethnicGroupCode" />
        <comment value="A code classifying the person into a named category of humans sharing a common real or presumed heritage" />
      </mapping>
      <mapping>
        <identity value="CDA" />
        <map value="/ClinicalDocument/recordTarget/patientRole/patient/sdtc:ethnicGroupCode" />
        <comment value="This CDA R2 SDTC ethnicGroupCode extension is used to record additional ethnicity groups for the recordTarget or subjectPerson" />
      </mapping>
    </element>
    <element id="Patient.identifier">
      <path value="Patient.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="type" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
      <type>
        <code value="Identifier" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-identifier" />
      </type>
    </element>
    <element id="Patient.identifier.type">
      <path value="Patient.identifier.type" />
      <comment value="The slice provided below is one example of an identifier type and has been socialized because of a Canadian extension on that identifier type. It is not required, and the slicing is open meaning that other types can be provided." />
    </element>
    <element id="Patient.identifier.system">
      <path value="Patient.identifier.system" />
      <min value="1" />
      <isModifier value="false" />
    </element>
    <element id="Patient.identifier.value">
      <path value="Patient.identifier.value" />
      <short value="The value that is unique within the system." />
      <min value="1" />
      <isModifier value="false" />
    </element>
    <element id="Patient.identifier:JHN">
      <path value="Patient.identifier" />
      <sliceName value="JHN" />
      <short value="Jurisdictional Health Number" />
      <definition value="Federal patient and person health numbers used by all jurisdictions across Canada" />
    </element>
    <element id="Patient.identifier:JHN.extension">
      <path value="Patient.identifier.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Patient.identifier:JHN.extension:versionCode">
      <path value="Patient.identifier.extension" />
      <sliceName value="versionCode" />
      <short value="Health Number Version Code" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-identifierversion" />
      </type>
    </element>
    <element id="Patient.identifier:JHN.type">
      <path value="Patient.identifier.type" />
      <min value="1" />
      <patternCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
          <code value="JHN" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="Patient.identifier:JHN.system">
      <path value="Patient.identifier.system" />
      <short value="A Health Number Naming System from the Canadian URI Registry" />
      <min value="1" />
    </element>
    <element id="Patient.identifier:JHN.value">
      <path value="Patient.identifier.value" />
      <min value="1" />
    </element>
    <element id="Patient.name">
      <path value="Patient.name" />
      <min value="0" />
      <constraint>
        <key value="ipa-pat-2" />
        <severity value="error" />
        <human value="Either Patient.name.given and/or Patient.name.family and/or Patient.name.text SHALL be present or a Data Absent Reason Extension SHALL be present." />
        <expression value="(family.exists() or given.exists() or text.exists()) xor extension.where(url='http://hl7.org/fhir/StructureDefinition/data-absent-reason').exists()" />
        <xpath value="(/f:name/f:extension/@url='http://hl7.org/fhir/StructureDefinition/data-absent-reason' and not(/f:name/f:family or /f:name/f:given or /f:name/f:text)) or (not(/f:name/f:extension/@url='http://hl7.org/fhir/StructureDefinition/data-absent-reason') and (/f:name/f:family or /f:name/f:given or /f:name/f:text))" />
      </constraint>
    </element>
    <element id="Patient.name.family">
      <path value="Patient.name.family" />
    </element>
    <element id="Patient.name.given">
      <path value="Patient.name.given" />
    </element>
    <element id="Patient.telecom">
      <path value="Patient.telecom" />
    </element>
    <element id="Patient.telecom.system">
      <path value="Patient.telecom.system" />
      <min value="1" />
    </element>
    <element id="Patient.telecom.value">
      <path value="Patient.telecom.value" />
      <min value="1" />
    </element>
    <element id="Patient.address">
      <path value="Patient.address" />
    </element>
    <element id="Patient.address.extension">
      <path value="Patient.address.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Patient.address.extension:preferred">
      <path value="Patient.address.extension" />
      <sliceName value="preferred" />
      <short value="HL7 Preferred Address Flag extension" />
      <definition value="Flag denoting whether parent address item is preferred" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/StructureDefinition/iso21090-preferred" />
      </type>
    </element>
    <element id="Patient.address.extension:noFixedAddress">
      <path value="Patient.address.extension" />
      <sliceName value="noFixedAddress" />
      <short value="No Fixed Address indicator" />
      <definition value="Flag indicating that there is an assertion that there is no fixed address" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/ext-nofixedaddress" />
      </type>
    </element>
  </differential>
</StructureDefinition>