{
  "resourceType": "StructureDefinition",
  "url": "http://electronichealth.se/fhir/StructureDefinition/NLLRelatedPerson",
  "name": "NLLRelatedPerson",
  "status": "draft",
  "description": "Information about a person that is related to a patient. Used in NLL primarily to represent the guardian of a child.",
  "fhirVersion": "4.0.0",
  "mapping": [
    {
      "identity": "EHM",
      "name": "E-hälsomyndigheten Information Model"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "RelatedPerson",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "RelatedPerson",
        "path": "RelatedPerson",
        "short": "A person that is related to a patient in the form of care taker (sv: vårdnadshavare)",
        "definition": "Represents a person, or rather the relation between a person acting as a care taker (sv: vårdnadshavare) and a patient (child). Only represents a one to one mapping - meaning one care taker and one child.",
        "mapping": [
          {
            "identity": "EHM",
            "map": "Vårdnadshavare"
          }
        ]
      },
      {
        "id": "RelatedPerson.identifier",
        "path": "RelatedPerson.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        },
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier:pnr",
        "path": "RelatedPerson.identifier",
        "sliceName": "pnr",
        "mapping": [
          {
            "identity": "EHM",
            "map": "Personnummer"
          }
        ]
      },
      {
        "id": "RelatedPerson.identifier:pnr.system",
        "path": "RelatedPerson.identifier.system",
        "fixedUri": "http://electronichealth.se/identifier/personnummer"
      },
      {
        "id": "RelatedPerson.identifier:pnr.value",
        "path": "RelatedPerson.identifier.value",
        "short": "The value, swedish national identification number",
        "definition": "Value of the identifier, a swedish national identification number which must be a 12 digit numeric value.",
        "constraint": [
          {
            "key": "swe-id-rule",
            "severity": "error",
            "human": "Personal id must have 12 digits",
            "expression": "$this.matches('^\\\\d{12}$')",
            "source": "RelatedPerson"
          }
        ]
      },
      {
        "id": "RelatedPerson.patient",
        "path": "RelatedPerson.patient",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://electronichealth.se/fhir/StructureDefinition/NLLPatient"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.relationship",
        "path": "RelatedPerson.relationship",
        "definition": "The nature of the relationship, fixed to GUARD (guardian) sv: vårdnadshavare since NLL currently only supports related person of this type.",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "EHM",
            "map": "Roll"
          }
        ]
      },
      {
        "id": "RelatedPerson.relationship.coding.system",
        "path": "RelatedPerson.relationship.coding.system",
        "fixedUri": "http://terminology.hl7.org/CodeSystem/v3-RoleCode"
      },
      {
        "id": "RelatedPerson.relationship.coding.code",
        "path": "RelatedPerson.relationship.coding.code",
        "fixedCode": "GUARD"
      }
    ]
  }
}