<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="KT2RelatedPerson" />
  <language value="nl-NL" />
  <url value="http://koppeltaal.nl/fhir/StructureDefinition/KT2RelatedPerson" />
  <name value="KT2_RelatedPerson" />
  <status value="draft" />
  <publisher value="VZVZ" />
  <contact>
    <name value="VZVZ" />
    <telecom>
      <system value="email" />
      <value value="standaardisatie@vzvz.nl" />
      <use value="work" />
    </telecom>
  </contact>
  <description value="The RelatedPerson resource represents an individual who has a personal or professional relationship with a patient and may be involved in their care. This includes family members, caregivers, legal guardians, and other support persons who assist in the patient's therapy and treatment. The profile extends the NlcoreContactPerson profile with Koppeltaal-specific requirements." />
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166" />
      <code value="NL" />
      <display value="Netherlands" />
    </coding>
  </jurisdiction>
  <copyright value="VZVZ" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="RelatedPerson" />
  <baseDefinition value="http://nictiz.nl/fhir/StructureDefinition/nl-core-ContactPerson" />
  <derivation value="constraint" />
  <differential>
    <element id="RelatedPerson.extension">
      <path value="RelatedPerson.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="RelatedPerson.extension:resource-origin">
      <path value="RelatedPerson.extension" />
      <sliceName value="resource-origin" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://koppeltaal.nl/fhir/StructureDefinition/resource-origin" />
      </type>
    </element>
    <element id="RelatedPerson.identifier">
      <path value="RelatedPerson.identifier" />
      <min value="1" />
    </element>
    <element id="RelatedPerson.active">
      <path value="RelatedPerson.active" />
      <min value="1" />
    </element>
    <element id="RelatedPerson.patient">
      <path value="RelatedPerson.patient" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://koppeltaal.nl/fhir/StructureDefinition/KT2Patient" />
      </type>
    </element>
    <element id="RelatedPerson.relationship">
      <path value="RelatedPerson.relationship" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="$this" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <comment value="See [Koppeltaal Implementation Guide](https://simplifier.net/guide/koppeltaal/Home/Profile-Specific-Notes/RelatedPerson.page.md?version=current) for more information on the ValueSet" />
      <min value="1" />
    </element>
    <element id="RelatedPerson.relationship:role">
      <path value="RelatedPerson.relationship" />
      <sliceName value="role" />
      <comment value="When using the `display` element for COD472 codes 23 (Contactpersoon) and 24 (Wettelijke vertegenwoordiger), you __MUST__ use the exact content of the `display` element from the __CodeSystem__. Otherwise, validation will result in errors. These specific codes require strict display validation due to known inconsistencies between different code systems and ValueSets. Other COD472 codes do not enforce display validation. Note that the display of the code in the ValueSet can be different from the CodeSystem." />
      <constraint>
        <key value="kt2-role-display-validation" />
        <severity value="error" />
        <human value="Display values for role codes 23 and 24 (COD472) must match the CodeSystem definitions exactly" />
        <expression value="coding.where(system='urn:oid:2.16.840.1.113883.2.4.3.11.22.472').all(&#xA;  (code='23' and display='Contactpersoon') or&#xA;  (code='24' and display='Wettelijke vertegenwoordiger') or&#xA;  code!='23' and code!='24'&#xA;)" />
        <source value="http://koppeltaal.nl/fhir/StructureDefinition/KT2RelatedPerson" />
      </constraint>
    </element>
    <element id="RelatedPerson.name">
      <path value="RelatedPerson.name" />
      <min value="1" />
    </element>
    <element id="RelatedPerson.name:nameInformation">
      <path value="RelatedPerson.name" />
      <sliceName value="nameInformation" />
      <comment value="This `.name` element represents a Dutch name according to the [zib NameInformation (v1.1, 2020)](https://zibs.nl/wiki/NameInformation-v1.1(2020EN)) (except for the GivenName concept). A Dutch name is represented in FHIR as an ordinary international name, but is augmented using extensions to specify how the last name is built up according to the Dutch rules. See the guidance on `.family` and on `.extension:nameUsage` for more information. Systems that need to work in a Dutch context **MUST** support these extensions as specified here. In addition, systems **MUST** use the core elements according to the FHIR specifications to provide compatibility outside Dutch contexts. It is encouraged to provide a representation of the full name in the `.text` element.&#xD;&#xA;&#xD;&#xA;**Note 1**: The zib cannot be represented straightforward in FHIR. Especially note the guidance on `.given` on how to map the FirstNames and Initials concepts, and on `.prefix`/`.suffix` on how to map the Titles concept.&#xD;&#xA;&#xD;&#xA;**Note 2**: This element should only contain a person's _official_ names. The GivenName concept is represented in another `.name` element with `.name.use` = _usual_.&#xD;&#xA;&#xD;&#xA;**Note 3**: The examples illustrate how the zib is mapped to FHIR." />
    </element>
    <element id="RelatedPerson.gender">
      <path value="RelatedPerson.gender" />
      <min value="1" />
    </element>
    <element id="RelatedPerson.birthDate">
      <path value="RelatedPerson.birthDate" />
      <min value="1" />
    </element>
    <element id="RelatedPerson.photo">
      <path value="RelatedPerson.photo" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>