<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="ca-on-ps-profile-patient" />
  <url value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-patient" />
  <version value="0.12.0" />
  <name value="PatientPSON" />
  <title value="Patient (PS-ON)" />
  <status value="active" />
  <date value="2022-10-15T12:00:00+00:00" />
  <publisher value="Ontario Health" />
  <description value="This profile defines a set of constraints to the FHIR Patient resource for use in Ontario Patient Summaries (PS-ON).  It refines constraints applied to the Patient resource by the PS-CA project to represent the minimum expectations for the Patient resource when used in the PS-CA composition profile or in one of the referred resources. It is informed by the constraints of the [Patient-UV-IPS profile](http://hl7.org/fhir/uv/ips/StructureDefinition-Patient-uv-ips.html) and the [Canadian Baseline Profile](http://build.fhir.org/ig/HL7-Canada/ca-baseline/branches/master/StructureDefinition-profile-patient.html)" />
  <fhirVersion value="4.0.1" />
  <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" />
      <constraint>
        <key value="pson-pat-1" />
        <severity value="error" />
        <human value="Patient.identifier:JHN or Patient.identifier:MRN or both SHALL be present" />
        <expression value="identifier.where(type.coding.code = 'JHN').exists() or identifier.where(type.coding.code = 'MR').exists()" />
      </constraint>
    </element>
    <element id="Patient.meta">
      <path value="Patient.meta" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.meta.profile">
      <path value="Patient.meta.profile" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier">
      <path value="Patient.identifier" />
      <slicing>
        <discriminator>
          <type value="pattern" />
          <path value="type" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <comment value="This element employs the constraints on identifier put forth in the CA Baseline using a profiled data type." />
      <min value="1" />
      <type>
        <code value="Identifier" />
        <profile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-oh-profile-identifier" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier.type">
      <path value="Patient.identifier.type" />
      <example>
        <label value="Pattern" />
        <valueCodeableConcept>
          <coding>
            <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
            <code value="MR" />
          </coding>
        </valueCodeableConcept>
      </example>
    </element>
    <element id="Patient.identifier.system">
      <path value="Patient.identifier.system" />
      <isModifier value="false" />
    </element>
    <element id="Patient.identifier.value">
      <path value="Patient.identifier.value" />
      <short value="The value that is unique within the system." />
      <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" />
      <comment value="**MS applied in PS-ON**" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:JHN.extension">
      <path value="Patient.identifier.extension" />
      <mustSupport value="true" />
    </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>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:JHN.extension:versionCode.value[x]">
      <path value="Patient.identifier.extension.value[x]" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:JHN.type">
      <path value="Patient.identifier.type" />
      <min value="1" />
      <fixedCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
          <code value="JHN" />
        </coding>
      </fixedCodeableConcept>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:JHN.type.coding">
      <path value="Patient.identifier.type.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:JHN.type.coding.system">
      <path value="Patient.identifier.type.coding.system" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:JHN.type.coding.code">
      <path value="Patient.identifier.type.coding.code" />
      <mustSupport value="true" />
    </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" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:JHN.value">
      <path value="Patient.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:MRN">
      <path value="Patient.identifier" />
      <sliceName value="MRN" />
      <short value="Medical Record Number" />
      <definition value="A local patient identifier from the submitting PoS System" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:MRN.type">
      <path value="Patient.identifier.type" />
      <min value="1" />
      <fixedCodeableConcept>
        <coding>
          <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
          <code value="MR" />
        </coding>
      </fixedCodeableConcept>
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:MRN.type.coding">
      <path value="Patient.identifier.type.coding" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:MRN.type.coding.system">
      <path value="Patient.identifier.type.coding.system" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:MRN.type.coding.code">
      <path value="Patient.identifier.type.coding.code" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:MRN.system">
      <path value="Patient.identifier.system" />
      <short value="An identifier for the system supplying the MRN" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.identifier:MRN.value">
      <path value="Patient.identifier.value" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.name">
      <path value="Patient.name" />
      <requirements value="Need to be able to track the patient by multiple names. Examples are your official name and a partner name.&#xD;&#xA;The Alphabetic representation of the name SHALL be always provided" />
      <min value="1" />
      <constraint>
        <key value="cabaseline-pat-1" />
        <severity value="error" />
        <human value="Patient.name.given or Patient.name.family or both SHALL be present" />
        <expression value="family.exists() or given.exists()" />
        <xpath value="f:given or f:family" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Patient.name.text">
      <path value="Patient.name.text" />
      <definition value="Text representation of the full name. Due to the cultural variance around the world a consuming system may not know how to present the name correctly; moreover not all the parts of the name go in given or family. Creators are therefore strongly encouraged to provide through this element a presented version of the name. Future versions of this guide may require this element" />
      <comment value="Some systems will not have a field for representing the full name as a string, these systems are still expected to be able to demonstrate they can construct name.text when developing the patient summary instance" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.name.family">
      <path value="Patient.name.family" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.name.given">
      <path value="Patient.name.given" />
      <mustSupport value="true" />
    </element>
    <element id="Patient.telecom">
      <path value="Patient.telecom" />
      <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>
    <element id="Patient.address">
      <path value="Patient.address" />
      <constraint>
        <key value="pat-cnt-2or3-char" />
        <severity value="warning" />
        <human value="The content of the country element (if present) SHALL be selected EITHER from ValueSet ISO Country Alpha-2 http://hl7.org/fhir/ValueSet/iso3166-1-2 OR MAY be selected from ISO Country Alpha-3 Value Set http://hl7.org/fhir/ValueSet/iso3166-1-3, IF the country is not specified in value Set ISO Country Alpha-2 http://hl7.org/fhir/ValueSet/iso3166-1-2." />
        <expression value="country.empty() or (country.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-2') or country.memberOf('http://hl7.org/fhir/ValueSet/iso3166-1-3'))" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Patient.contact.relationship">
      <path value="Patient.contact.relationship" />
      <type>
        <code value="CodeableConcept" />
        <profile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-codeableconcept" />
      </type>
    </element>
    <element id="Patient.contact.relationship.coding.display.extension:translation">
      <path value="Patient.contact.relationship.coding.display.extension" />
      <sliceName value="translation" />
    </element>
    <element id="Patient.contact.relationship.coding.display.extension:translation.extension">
      <path value="Patient.contact.relationship.coding.display.extension.extension" />
      <min value="2" />
    </element>
    <element id="Patient.contact.relationship.coding.display.extension:translation.url">
      <path value="Patient.contact.relationship.coding.display.extension.url" />
      <fixedUri value="translation" />
    </element>
    <element id="Patient.communication.language">
      <path value="Patient.communication.language" />
      <binding>
        <strength value="required" />
        <valueSet value="http://hl7.org/fhir/ValueSet/all-languages" />
      </binding>
    </element>
    <element id="Patient.generalPractitioner">
      <path value="Patient.generalPractitioner" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="resolve()" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <mustSupport value="true" />
    </element>
    <element id="Patient.generalPractitioner:generalPractitionerPSON">
      <path value="Patient.generalPractitioner" />
      <sliceName value="generalPractitionerPSON" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-practitionerrole" />
        <targetProfile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-practitioner" />
        <targetProfile value="http://ontariohealth.ca/fhir/StructureDefinition/ca-on-ps-profile-organization" />
      </type>
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>