{
  "resourceType": "StructureDefinition",
  "id": "jcpm-related-person",
  "language": "he-IL",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-category",
      "valueString": "Base.Individuals"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-security-category",
      "valueCode": "patient"
    }
  ],
  "url": "http://fhir.outburn.co.il/StructureDefinition/jcpm-related-person",
  "version": "0.1.0",
  "name": "JCPMRelatedPerson",
  "title": "JCPM JCPMRelatedPerson Profile",
  "status": "draft",
  "date": "2022-01-30",
  "publisher": "Outburn LTD",
  "contact": [
    {
      "name": "Outburn LTD",
      "telecom": [
        {
          "system": "url",
          "value": "http://outburn.co.il"
        }
      ]
    }
  ],
  "description": "Proposed constraints and extensions on the JCPMRelatedPerson Resource",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    },
    {
      "identity": "w5",
      "uri": "http://hl7.org/fhir/fivews",
      "name": "FiveWs Pattern Mapping"
    },
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "RelatedPerson",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "RelatedPerson",
        "path": "RelatedPerson",
        "short": "JCPMRelatedPerson Profile",
        "definition": "Definitions for the profile-JCPMRelatedPerson resource profile.",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier",
        "path": "RelatedPerson.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "RelatedPerson.identifier.system",
        "path": "RelatedPerson.identifier.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier.value",
        "path": "RelatedPerson.identifier.value",
        "short": "The value that is unique within the system.",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier:il-id",
        "path": "RelatedPerson.identifier",
        "sliceName": "il-id",
        "short": "Israeli National Identifier",
        "definition": "Israeli ID number (9 digit unchangeable number, including leading zeros and includes a control digit), including temporarily identification numbers assigned by Israeli National Insurance",
        "min": 0,
        "max": "1",
        "patternIdentifier": {
          "system": "http://fhir.health.gov.il/identifier/il-national-id"
        },
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier:il-id.value",
        "path": "RelatedPerson.identifier.value",
        "short": "An Israeli ID number",
        "constraint": [
          {
            "key": "il-id-chk",
            "severity": "error",
            "human": "Israeli ID must be 9-digits with a correct check-digit at the end.",
            "expression": "\r\nmatches('[0-9]{9}') and\r\nsubstring(8,1).toInteger()=\r\n(10-((substring(0,1).toInteger() +\r\nsubstring(1,1).toInteger()*2 mod 10 +\r\nsubstring(1,1).toInteger()*2 div 10 +\r\nsubstring(2,1).toInteger() +\r\nsubstring(3,1).toInteger()*2 mod 10 +\r\nsubstring(3,1).toInteger()*2 div 10 +\r\nsubstring(4,1).toInteger() +\r\nsubstring(5,1).toInteger()*2 mod 10 +\r\nsubstring(5,1).toInteger()*2 div 10 +\r\nsubstring(6,1).toInteger() +\r\nsubstring(7,1).toInteger()*2 mod 10 +\r\nsubstring(7,1).toInteger()*2 div 10) mod 10)) mod 10\r\n",
            "source": "http://fhir.outburn.co.il/StructureDefinition/jcpm-related-person"
          }
        ]
      },
      {
        "id": "RelatedPerson.identifier:pna-id",
        "path": "RelatedPerson.identifier",
        "sliceName": "pna-id",
        "short": "Palestinian National Identifier",
        "definition": "Palestinian ID number",
        "min": 0,
        "max": "1",
        "patternIdentifier": {
          "system": "http://fhir.health.gov.il/identifier/pna-national-id"
        },
        "mustSupport": false
      },
      {
        "id": "RelatedPerson.identifier:pna-id.value",
        "path": "RelatedPerson.identifier.value",
        "short": "A Palestininan ID number"
      },
      {
        "id": "RelatedPerson.identifier:ppn",
        "path": "RelatedPerson.identifier",
        "sliceName": "ppn",
        "short": "Passport Number",
        "definition": "Passport number",
        "min": 0,
        "max": "*",
        "patternIdentifier": {
          "type": {
            "coding": [
              {
                "code": "PPN",
                "system": "http://terminology.hl7.org/CodeSystem/v2-0203"
              }
            ]
          }
        },
        "mustSupport": false
      },
      {
        "id": "RelatedPerson.identifier:ppn.type",
        "path": "RelatedPerson.identifier.type",
        "min": 1
      },
      {
        "id": "RelatedPerson.identifier:ppn.system",
        "path": "RelatedPerson.identifier.system",
        "binding": {
          "strength": "required",
          "valueSet": "http://fhir.health.gov.il/ValueSet/passport-uri"
        }
      },
      {
        "id": "RelatedPerson.identifier:ppn.value",
        "path": "RelatedPerson.identifier.value",
        "short": "Passport Number"
      },
      {
        "id": "RelatedPerson.identifier:enc",
        "path": "RelatedPerson.identifier",
        "sliceName": "enc",
        "short": "Person's Identifier - MoH encrypted",
        "definition": "The person’s identifier after applying MoH’s standard primary encryption algorithm",
        "min": 0,
        "max": "*",
        "patternIdentifier": {
          "system": "http://fhir.health.gov.il/identifier/encrypted-id-primary-moh"
        },
        "mustSupport": false
      },
      {
        "id": "RelatedPerson.identifier:enc.value",
        "path": "RelatedPerson.identifier.value",
        "short": "An encrypted identifier"
      },
      {
        "id": "RelatedPerson.identifier:hadassah-temp",
        "path": "RelatedPerson.identifier",
        "sliceName": "hadassah-temp",
        "short": "Person's Identifier - hadassah temporary id",
        "definition": "The person’s temporary identifier in Hadassah hospital ",
        "min": 0,
        "max": "1",
        "patternIdentifier": {
          "system": "http://fhir.hadassah.org.il/identifier/temporary-patient-id"
        },
        "mustSupport": false
      },
      {
        "id": "RelatedPerson.identifier:hadassah-temp.value",
        "path": "RelatedPerson.identifier.value",
        "short": "A Hadassah temporary identifier"
      },
      {
        "id": "RelatedPerson.identifier:meuhedet-temp",
        "path": "RelatedPerson.identifier",
        "sliceName": "meuhedet-temp",
        "short": "Person's Identifier - meuhedet temporary id",
        "definition": "The person’s temporary identifier in Meuhedet HMO ",
        "min": 0,
        "max": "1",
        "patternIdentifier": {
          "system": "http://fhir.meuhedet.org.il/identifier/temporary-patient-id"
        },
        "mustSupport": false
      },
      {
        "id": "RelatedPerson.identifier:meuhedet-temp.value",
        "path": "RelatedPerson.identifier.value",
        "short": "A Meuhedet temporary identifier"
      },
      {
        "id": "RelatedPerson.identifier:szmc-temp",
        "path": "RelatedPerson.identifier",
        "sliceName": "szmc-temp",
        "short": "Person's Identifier - szmc temporary id",
        "definition": "The person’s temporary identifier in SZMC hospital ",
        "min": 0,
        "max": "1",
        "patternIdentifier": {
          "system": "http://fhir.szmc.org.il/identifier/temporary-patient-id"
        },
        "mustSupport": false
      },
      {
        "id": "RelatedPerson.identifier:szmc-temp.value",
        "path": "RelatedPerson.identifier.value",
        "short": "A SZMC temporary identifier"
      },
      {
        "id": "RelatedPerson.patient",
        "path": "RelatedPerson.patient",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://fhir.health.gov.il/StructureDefinition/il-core-patient"
            ]
          }
        ]
      },
      {
        "id": "RelatedPerson.relationship.coding.system",
        "path": "RelatedPerson.relationship.coding.system",
        "patternUri": "http://terminology.hl7.org/CodeSystem/v3-RoleCode"
      },
      {
        "id": "RelatedPerson.relationship.coding.code",
        "path": "RelatedPerson.relationship.coding.code",
        "patternCode": "NMTH"
      }
    ]
  }
}