{
  "resourceType": "StructureDefinition",
  "id": "profile-Coverage-family-base",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Coverage-family-base",
  "name": "CoverageFamilyBase",
  "title": "Coverage - Family Base Profile",
  "status": "active",
  "experimental": false,
  "description": "Profile for 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": true,
  "type": "Coverage",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Coverage",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Coverage.id",
        "path": "Coverage.id",
        "comment": "This will be the application number for the coverage",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:delegate",
        "path": "Coverage.extension",
        "sliceName": "delegate",
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-Delegate"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:withReceipts",
        "path": "Coverage.extension",
        "sliceName": "withReceipts",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-WithReceiptsFlag"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ApplicationDTO.withReceipts"
          }
        ]
      },
      {
        "id": "Coverage.extension:renewal",
        "path": "Coverage.extension",
        "sliceName": "renewal",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-RenewalFlag"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ApplicationDTO.type"
          }
        ]
      },
      {
        "id": "Coverage.extension:registrationDate",
        "path": "Coverage.extension",
        "sliceName": "registrationDate",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-RegistrationDate"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.extension:inYearAdjustment",
        "path": "Coverage.extension",
        "sliceName": "inYearAdjustment",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-InYearAdjustmentFlag"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.status",
        "path": "Coverage.status",
        "short": "draft | active",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-FinancialStatus"
        }
      },
      {
        "id": "Coverage.kind",
        "path": "Coverage.kind",
        "patternCode": "insurance"
      },
      {
        "id": "Coverage.subscriber",
        "path": "Coverage.subscriber",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-rest"
            ],
            "targetProfile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Patient-search"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary",
        "path": "Coverage.beneficiary",
        "definition": "The policyholder ID is the ODB eligibility number of the person who took out the insurance policy. Any given recipient can be the policyholder of more than one insurance policy. This attribute should always be populated.",
        "type": [
          {
            "code": "Reference",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/profile-Reference-group-no-patient"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Coverage.period",
        "path": "Coverage.period",
        "mustSupport": true
      },
      {
        "id": "Coverage.period.start",
        "path": "Coverage.period.start",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ApplicationDTO.proRatedStartDate (if not Aug 1), FamilyDTO.enrollmentEffectiveDate, FamilyHistoryDTO.enrollmentEffDate"
          }
        ]
      },
      {
        "id": "Coverage.period.end",
        "path": "Coverage.period.end",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "FamilyDTO.enrollmentEndDate, FamilyHistoryDTO.enrollmentEndDate"
          }
        ]
      },
      {
        "id": "Coverage.insurer",
        "path": "Coverage.insurer",
        "patternReference": {
          "reference": "Organization/bpcs"
        }
      },
      {
        "id": "Coverage.class",
        "path": "Coverage.class",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "type"
            }
          ],
          "rules": "closed"
        },
        "min": 2,
        "mustSupport": true
      },
      {
        "id": "Coverage.class:program",
        "path": "Coverage.class",
        "sliceName": "program",
        "short": "Coverage plan info",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Coverage.class:program.type",
        "path": "Coverage.class.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/coverage-class",
              "code": "plan"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "Coverage.class:program.value",
        "path": "Coverage.class.value",
        "mustSupport": true
      },
      {
        "id": "Coverage.class:program.value.system",
        "path": "Coverage.class.value.system",
        "min": 1,
        "patternUri": "https://bpcs.exchange/fhir/CodeSystem/cs-ProgramPlan"
      },
      {
        "id": "Coverage.class:program.value.value",
        "path": "Coverage.class.value.value",
        "short": "BPCS Program id",
        "comment": "The binding is extensible to allow for the addition of new codes.  Codes must be found in the current expansion of the value set.",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "extensible",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Program"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "ApplicationDTO.program"
          }
        ]
      },
      {
        "id": "Coverage.class:plan",
        "path": "Coverage.class",
        "sliceName": "plan",
        "short": "BPCS plan info",
        "min": 1,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Coverage.class:plan.type",
        "path": "Coverage.class.type",
        "patternCodeableConcept": {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/coverage-class",
              "code": "subplan"
            }
          ]
        },
        "mustSupport": true
      },
      {
        "id": "Coverage.class:plan.value",
        "path": "Coverage.class.value",
        "mustSupport": true
      },
      {
        "id": "Coverage.class:plan.value.system",
        "path": "Coverage.class.value.system",
        "min": 1,
        "patternUri": "https://bpcs.exchange/fhir/CodeSystem/cs-ProgramPlan"
      },
      {
        "id": "Coverage.class:plan.value.value",
        "path": "Coverage.class.value.value",
        "short": "BPCS plan id",
        "comment": "The binding is extensible to allow for the addition of new codes.  Codes must be found in the current expansion of the value set.",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "extensible",
          "valueSet": "https://bpcs.exchange/fhir/ValueSet/vs-Plan"
        },
        "mapping": [
          {
            "identity": "BPCS",
            "map": "Inferred from ApplicationDTO.program"
          }
        ]
      }
    ]
  }
}