{
  "resourceType": "StructureDefinition",
  "id": "KT2RelatedPerson",
  "language": "nl-NL",
  "url": "http://koppeltaal.nl/fhir/StructureDefinition/KT2RelatedPerson",
  "name": "KT2_RelatedPerson",
  "status": "draft",
  "publisher": "VZVZ",
  "contact": [
    {
      "name": "VZVZ",
      "telecom": [
        {
          "system": "email",
          "value": "standaardisatie@vzvz.nl",
          "use": "work"
        }
      ]
    }
  ],
  "description": "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": [
        {
          "code": "NL",
          "system": "urn:iso:std:iso:3166",
          "display": "Netherlands"
        }
      ]
    }
  ],
  "copyright": "VZVZ",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "RelatedPerson",
  "baseDefinition": "http://nictiz.nl/fhir/StructureDefinition/nl-core-ContactPerson",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "RelatedPerson.extension",
        "path": "RelatedPerson.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "RelatedPerson.extension:resource-origin",
        "path": "RelatedPerson.extension",
        "sliceName": "resource-origin",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://koppeltaal.nl/fhir/StructureDefinition/resource-origin"
            ]
          }
        ]
      },
      {
        "id": "RelatedPerson.identifier",
        "path": "RelatedPerson.identifier",
        "min": 1
      },
      {
        "id": "RelatedPerson.active",
        "path": "RelatedPerson.active",
        "min": 1
      },
      {
        "id": "RelatedPerson.patient",
        "path": "RelatedPerson.patient",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://koppeltaal.nl/fhir/StructureDefinition/KT2Patient"
            ]
          }
        ]
      },
      {
        "id": "RelatedPerson.relationship",
        "path": "RelatedPerson.relationship",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "$this"
            }
          ],
          "rules": "closed"
        },
        "comment": "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": 1
      },
      {
        "id": "RelatedPerson.relationship:role",
        "path": "RelatedPerson.relationship",
        "sliceName": "role",
        "comment": "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": "kt2-role-display-validation",
            "severity": "error",
            "human": "Display values for role codes 23 and 24 (COD472) must match the CodeSystem definitions exactly",
            "expression": "coding.where(system='urn:oid:2.16.840.1.113883.2.4.3.11.22.472').all(\n  (code='23' and display='Contactpersoon') or\n  (code='24' and display='Wettelijke vertegenwoordiger') or\n  code!='23' and code!='24'\n)",
            "source": "http://koppeltaal.nl/fhir/StructureDefinition/KT2RelatedPerson"
          }
        ]
      },
      {
        "id": "RelatedPerson.name",
        "path": "RelatedPerson.name",
        "min": 1
      },
      {
        "id": "RelatedPerson.name:nameInformation",
        "path": "RelatedPerson.name",
        "sliceName": "nameInformation",
        "comment": "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.\r\n\r\n**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.\r\n\r\n**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_.\r\n\r\n**Note 3**: The examples illustrate how the zib is mapped to FHIR."
      },
      {
        "id": "RelatedPerson.gender",
        "path": "RelatedPerson.gender",
        "min": 1
      },
      {
        "id": "RelatedPerson.birthDate",
        "path": "RelatedPerson.birthDate",
        "min": 1
      },
      {
        "id": "RelatedPerson.photo",
        "path": "RelatedPerson.photo",
        "max": "0"
      }
    ]
  }
}