<StructureDefinition xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../input-cache/schemas/R5/fhir-single.xsd">
  <id value="profile-Person" />
  <url value="https://bpcs.exchange/fhir/StructureDefinition/profile-Person" />
  <name value="Person" />
  <title value="Person Profile" />
  <status value="active" />
  <experimental value="false" />
  <description value="Information about a registered individual's demographics used as a starting point when introducing a recipient" />
  <fhirVersion value="5.0.0" />
  <mapping>
    <identity value="BPCS" />
    <name value="Internal BPCS API" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="Person" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Person" />
  <derivation value="constraint" />
  <differential>
    <element id="Person">
      <path value="Person" />
    </element>
    <element id="Person.id">
      <path value="Person.id" />
      <comment value="This will also be the ODB number" />
      <mustSupport value="true" />
    </element>
    <element id="Person.identifier">
      <path value="Person.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="use" />
        </discriminator>
        <discriminator>
          <type value="value" />
          <path value="type" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
    </element>
    <element id="Person.identifier:odbNum">
      <path value="Person.identifier" />
      <sliceName value="odbNum" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Person.identifier:odbNum.extension:ODBVersion">
      <path value="Person.identifier.extension" />
      <sliceName value="ODBVersion" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7canada.ca/ig/baseline/StructureDefinition/ext-identifierversion" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.healthCardVersion" />
      </mapping>
    </element>
    <element id="Person.identifier:odbNum.use">
      <path value="Person.identifier.use" />
      <comment value="Distinguishes current ODBNumber from cross-reference numbers" />
      <min value="1" />
      <patternCode value="official" />
      <mustSupport value="true" />
    </element>
    <element id="Person.identifier:odbNum.system">
      <path value="Person.identifier.system" />
      <short value="Distinguishes type of primary identifier" />
      <min value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-ODBTypes" />
      </binding>
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.idFlag" />
      </mapping>
    </element>
    <element id="Person.identifier:odbNum.value">
      <path value="Person.identifier.value" />
      <min value="1" />
      <maxLength value="10" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.odbNum" />
      </mapping>
    </element>
    <element id="Person.identifier:xref">
      <path value="Person.identifier" />
      <sliceName value="xref" />
      <definition value="Alternate PHNs" />
      <mustSupport value="true" />
    </element>
    <element id="Person.identifier:xref.use">
      <path value="Person.identifier.use" />
      <comment value="Distinguishes current ODBNumber from cross-reference numbers" />
      <min value="1" />
      <patternCode value="old" />
      <mustSupport value="true" />
    </element>
    <element id="Person.identifier:xref.system">
      <path value="Person.identifier.system" />
      <short value="Distinguishes type of xref identifier" />
      <min value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-ODBTypes" />
      </binding>
      <mapping>
        <identity value="BPCS" />
        <map value="CrossReferenceValuesDTO.idType" />
      </mapping>
    </element>
    <element id="Person.identifier:xref.value">
      <path value="Person.identifier.value" />
      <min value="1" />
      <maxLength value="10" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="CrossReferenceValuesDTO.id" />
      </mapping>
    </element>
    <element id="Person.name">
      <path value="Person.name" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Person.name.family">
      <path value="Person.name.family" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.lastName" />
      </mapping>
    </element>
    <element id="Person.name.given">
      <path value="Person.name.given" />
      <comment value="First name is first repetition, middle name is second repetition" />
      <min value="1" />
      <max value="2" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.firstName, RpdbDTO.middleName" />
      </mapping>
    </element>
    <element id="Person.gender">
      <path value="Person.gender" />
      <min value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-administrative-gender" />
      </binding>
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.sex" />
      </mapping>
    </element>
    <element id="Person.birthDate">
      <path value="Person.birthDate" />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.birthDate" />
      </mapping>
    </element>
    <element id="Person.address">
      <path value="Person.address" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Person.address.line">
      <path value="Person.address.line" />
      <short value="First line of an address. Usually will contain the street number and street name. Second line of an address. Usually will contain an apartment number, rural route or other similar information." />
      <min value="1" />
      <max value="2" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.address (1st repetition), RpdbDTO.address2 (2nd repetition)" />
      </mapping>
    </element>
    <element id="Person.address.city">
      <path value="Person.address.city" />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.city" />
      </mapping>
    </element>
    <element id="Person.address.state">
      <path value="Person.address.state" />
      <min value="1" />
      <maxLength value="2" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-Province" />
      </binding>
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.province" />
      </mapping>
    </element>
    <element id="Person.address.postalCode">
      <path value="Person.address.postalCode" />
      <min value="1" />
      <maxLength value="10" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.postalCode" />
      </mapping>
    </element>
    <element id="Person.address.country">
      <path value="Person.address.country" />
      <min value="1" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-Country" />
      </binding>
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.country" />
      </mapping>
    </element>
    <element id="Person.communication">
      <path value="Person.communication" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Person.communication.language">
      <path value="Person.communication.language" />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://bpcs.exchange/fhir/ValueSet/vs-Language" />
        <additional>
          <purpose value="starter" />
          <valueSet value="http://hl7.org/fhir/ValueSet/languages" />
        </additional>
      </binding>
    </element>
    <element id="Person.communication.language.coding">
      <path value="Person.communication.language.coding" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Person.communication.language.coding.system">
      <path value="Person.communication.language.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Person.communication.language.coding.code">
      <path value="Person.communication.language.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
      <mapping>
        <identity value="BPCS" />
        <map value="RpdbDTO.language" />
      </mapping>
    </element>
    <element id="Person.communication.preferred">
      <path value="Person.communication.preferred" />
      <patternBoolean value="true" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>