{
  "resourceType": "StructureDefinition",
  "id": "profile-RelatedPerson-delegate-create",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-RelatedPerson-delegate-create",
  "name": "RelatedPersonDelegateCreate",
  "title": "Related Person Delegate Create",
  "status": "active",
  "experimental": false,
  "date": "2024-04-29T15:03:38.9579645+00:00",
  "description": "Used when creating or updating a delegate person for a family coverage other than the family",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "RelatedPerson",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/RelatedPerson",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "RelatedPerson.id",
        "path": "RelatedPerson.id",
        "comment": "This will be the same as the application number",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier",
        "path": "RelatedPerson.identifier",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "use"
            },
            {
              "type": "value",
              "path": "type"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "RelatedPerson.identifier:odbNum",
        "path": "RelatedPerson.identifier",
        "sliceName": "odbNum",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier:odbNum.use",
        "path": "RelatedPerson.identifier.use",
        "comment": "Distinguishes current ODBNumber from cross-reference numbers",
        "min": 1,
        "patternCode": "official",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.identifier:odbNum.system",
        "path": "RelatedPerson.identifier.system",
        "short": "Distinguishes type of primary identifier",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-ODBTypes"
        }
      },
      {
        "id": "RelatedPerson.identifier:odbNum.value",
        "path": "RelatedPerson.identifier.value",
        "maxLength": 10,
        "condition": [
          "bpcs-odb1"
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.odbNum"
          }
        ]
      },
      {
        "id": "RelatedPerson.active",
        "path": "RelatedPerson.active",
        "max": "0"
      },
      {
        "id": "RelatedPerson.patient",
        "path": "RelatedPerson.patient",
        "comment": "This will point to the Patient identified as the contact for the application",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-create"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.name",
        "path": "RelatedPerson.name",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.name.family",
        "path": "RelatedPerson.name.family",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.lastName"
          }
        ]
      },
      {
        "id": "RelatedPerson.name.given",
        "path": "RelatedPerson.name.given",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.firstName (first rep), ContactDTO.middleName (second rep)"
          }
        ]
      },
      {
        "id": "RelatedPerson.telecom",
        "path": "RelatedPerson.telecom",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            },
            {
              "type": "value",
              "path": "use"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "RelatedPerson.telecom:homePhone",
        "path": "RelatedPerson.telecom",
        "sliceName": "homePhone",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:homePhone.system",
        "path": "RelatedPerson.telecom.system",
        "min": 1,
        "patternCode": "phone",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:homePhone.value",
        "path": "RelatedPerson.telecom.value",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.homePhoneNum"
          }
        ]
      },
      {
        "id": "RelatedPerson.telecom:homePhone.use",
        "path": "RelatedPerson.telecom.use",
        "min": 1,
        "patternCode": "home",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:workPhone",
        "path": "RelatedPerson.telecom",
        "sliceName": "workPhone",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:workPhone.extension:extension",
        "path": "RelatedPerson.telecom.extension",
        "sliceName": "extension",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/contactpoint-extension"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:workPhone.system",
        "path": "RelatedPerson.telecom.system",
        "min": 1,
        "patternCode": "phone",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:workPhone.value",
        "path": "RelatedPerson.telecom.value",
        "comment": "If there is an extension, separate concatenate it with ' ext:' as a separator from the base number.",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.workPhoneNum, ContactDTO.workPhoneExt"
          }
        ]
      },
      {
        "id": "RelatedPerson.telecom:workPhone.value.extension:extension",
        "path": "RelatedPerson.telecom.value.extension",
        "sliceName": "extension",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/contactpoint-extension"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:workPhone.use",
        "path": "RelatedPerson.telecom.use",
        "min": 1,
        "patternCode": "work",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:email",
        "path": "RelatedPerson.telecom",
        "sliceName": "email",
        "short": "A contact email for the delegate",
        "definition": "A contact email for the delegate",
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:email.system",
        "path": "RelatedPerson.telecom.system",
        "patternCode": "email",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.telecom:email.value",
        "path": "RelatedPerson.telecom.value",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.address",
        "path": "RelatedPerson.address",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "RelatedPerson.address:mailing",
        "path": "RelatedPerson.address",
        "sliceName": "mailing",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.address:mailing.type",
        "path": "RelatedPerson.address.type",
        "min": 1,
        "patternCode": "postal"
      },
      {
        "id": "RelatedPerson.address:mailing.line",
        "path": "RelatedPerson.address.line",
        "min": 1,
        "max": "2",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.address1 (first repetition) or address2 (2nd repetition)"
          }
        ]
      },
      {
        "id": "RelatedPerson.address:mailing.city",
        "path": "RelatedPerson.address.city",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.city"
          }
        ]
      },
      {
        "id": "RelatedPerson.address:mailing.state",
        "path": "RelatedPerson.address.state",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Province"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.province"
          }
        ]
      },
      {
        "id": "RelatedPerson.address:mailing.postalCode",
        "path": "RelatedPerson.address.postalCode",
        "min": 1,
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.city"
          }
        ]
      },
      {
        "id": "RelatedPerson.address:mailing.country",
        "path": "RelatedPerson.address.country",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Country"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.country"
          }
        ]
      },
      {
        "id": "RelatedPerson.communication",
        "path": "RelatedPerson.communication",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "preferred"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "RelatedPerson.communication:preferredLang",
        "path": "RelatedPerson.communication",
        "sliceName": "preferredLang",
        "mustSupport": true
      },
      {
        "id": "RelatedPerson.communication:preferredLang.language",
        "path": "RelatedPerson.communication.language",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ContactDTO.languagePref"
          }
        ]
      },
      {
        "id": "RelatedPerson.communication:preferredLang.preferred",
        "path": "RelatedPerson.communication.preferred",
        "min": 1,
        "patternBoolean": true
      }
    ]
  }
}