{
  "resourceType": "StructureDefinition",
  "id": "profile-Group",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Group",
  "name": "GroupFamily",
  "title": "GroupFamily",
  "status": "active",
  "experimental": false,
  "description": "A record reflecting a family that is associated with an insurance application",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Group",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Group",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Group.id",
        "path": "Group.id",
        "comment": "This will be the same as the associated coverage id",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Group.extension:contact",
        "path": "Group.extension",
        "sliceName": "contact",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Group-Contact"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Group.extension:useDelegate",
        "path": "Group.extension",
        "sliceName": "useDelegate",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Group-UseDelegate"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ApplicationDTO.useDelegate, FamilyHistoryDTO.useDelegateInd"
          }
        ]
      },
      {
        "id": "Group.type",
        "path": "Group.type",
        "patternCode": "person"
      },
      {
        "id": "Group.membership",
        "path": "Group.membership",
        "patternCode": "enumerated"
      },
      {
        "id": "Group.quantity",
        "path": "Group.quantity",
        "definition": "This is the number of family members on application",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ApplicationDTO.familyMembersCount, FamilyHistoryDTO.hsldMbrCnt"
          }
        ]
      },
      {
        "id": "Group.managingEntity",
        "path": "Group.managingEntity",
        "mustSupport": true
      },
      {
        "id": "Group.member",
        "path": "Group.member",
        "mustSupport": true
      },
      {
        "id": "Group.member.entity",
        "path": "Group.member.entity",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "FamilyDTO.familyMembers"
          }
        ]
      },
      {
        "id": "Group.member.inactive",
        "path": "Group.member.inactive",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "FamilyMemberDTO.inactiveFlag"
          }
        ]
      }
    ]
  }
}