{
  "resourceType": "StructureDefinition",
  "id": "profile-Coverage-family",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Coverage-family",
  "name": "CoverageFamily",
  "title": "Coverage - Family",
  "status": "active",
  "experimental": false,
  "description": "Coverage that is enrolled in on a family rather than individual basis",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Coverage",
  "baseDefinition": "https://bpcs.exchange/fhir/StructureDefinition/profile-Coverage-family-base",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Coverage.contained",
        "path": "Coverage.contained",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1
      },
      {
        "id": "Coverage.contained:provenance",
        "path": "Coverage.contained",
        "sliceName": "provenance",
        "short": "Creation/Update/etc. Metadata",
        "definition": "Nested Provenance information referring to this resource that describes the creation, and sometimes the most recent update and/or inactivation of the record, specifically who was responsible and when it occurred",
        "min": 1,
        "type": [
          {
            "code": "Provenance",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Provenance"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:overpaidDeductible",
        "path": "Coverage.extension",
        "sliceName": "overpaidDeductible",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-OverpaidDeductibleStatus"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:privateInsuranceContribution",
        "path": "Coverage.extension",
        "sliceName": "privateInsuranceContribution",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-PrivateInsuranceContribution"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:basePrivateInsuranceCredit",
        "path": "Coverage.extension",
        "sliceName": "basePrivateInsuranceCredit",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-BasePrivateInsuranceCredit"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:baseDeductible",
        "path": "Coverage.extension",
        "sliceName": "baseDeductible",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-BaseDeductible"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:problemCode",
        "path": "Coverage.extension",
        "sliceName": "problemCode",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Resource-ProblemCode"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "FamilyDTO.problemCodes"
          }
        ]
      },
      {
        "id": "Coverage.extension:problemCode.value[x]",
        "path": "Coverage.extension.value[x]",
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Problem-family"
        }
      },
      {
        "id": "Coverage.costToBeneficiary",
        "path": "Coverage.costToBeneficiary",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type"
            }
          ],
          "rules": "open"
        },
        "comment": "This is the application number",
        "min": 4,
        "mustSupport": true
      },
      {
        "id": "Coverage.costToBeneficiary:deductible",
        "path": "Coverage.costToBeneficiary",
        "sliceName": "deductible",
        "min": 4,
        "mustSupport": true
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.extension",
        "path": "Coverage.costToBeneficiary.extension",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.extension:insuranceCredit",
        "path": "Coverage.costToBeneficiary.extension",
        "sliceName": "insuranceCredit",
        "min": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-InsuranceCredit"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.extension:reachedDate",
        "path": "Coverage.costToBeneficiary.extension",
        "sliceName": "reachedDate",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-DeductibleDateReached"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.extension:deductiblePct",
        "path": "Coverage.costToBeneficiary.extension",
        "sliceName": "deductiblePct",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-DeductiblePct"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.type",
        "path": "Coverage.costToBeneficiary.type",
        "min": 1,
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/coverage-copay-type",
              "code": "deductible"
            }
          ]
        }
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.unit",
        "path": "Coverage.costToBeneficiary.unit",
        "min": 1,
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/benefit-unit",
              "code": "family"
            }
          ]
        }
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.term",
        "path": "Coverage.costToBeneficiary.term",
        "min": 1,
        "type": [
          {
            "code": "CodeableConcept",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-CodeableConcept-simple"
            ]
          }
        ],
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Term"
        }
      },
      {
        "id": "Coverage.costToBeneficiary:deductible.value[x]",
        "path": "Coverage.costToBeneficiary.value[x]",
        "min": 1,
        "type": [
          {
            "code": "Money",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Money-CAD"
            ]
          },
          {
            "code": "Quantity",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Quantity-percentage"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "FamilyExpensesDTO.deductLvl1, deductLvl2, deductLvl3, deductLvl4 (based on quarter), FamilyHistoryDTO.dedLvl1Period1Ytd, dedLvl1Period2Ytd, dedLvl1Period3Ytd, dedLvl1Period4Ytd"
          }
        ]
      }
    ]
  }
}