{
  "resourceType": "StructureDefinition",
  "id": "profile-Coverage-individual-public-create",
  "url": "https://bpcs.exchange/fhir/StructureDefinition/profile-Coverage-individual-public-create",
  "name": "CoverageIndividualPublicCreate",
  "title": "Coverage Individual Public Creation Profile",
  "status": "active",
  "experimental": false,
  "description": "The set of coverage elements available for population when recording a new bpcs individual coverage",
  "fhirVersion": "5.0.0",
  "mapping": [
    {
      "identity": "BPCS",
      "name": "Internal BPCS API"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Coverage",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Coverage",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Coverage",
        "path": "Coverage",
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientPlanDTO"
          }
        ]
      },
      {
        "id": "Coverage.extension:parent",
        "path": "Coverage.extension",
        "sliceName": "parent",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://bpcs.exchange/fhir/StructureDefinition/ext-Coverage-Parent"
            ]
          }
        ],
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "**NEW** This will be information from the Application associated with this coverage.  Specific syntax will be 'Coverage/' + [applicationNum] + '.' + [odbNum] + '.' + [start date] (no separators in date)"
          }
        ]
      },
      {
        "id": "Coverage.status",
        "path": "Coverage.status",
        "comment": "This will be 'active' or 'cancelled', depending on whether the coverage has an end date, where the current date is less than the end date.",
        "mustSupport": true
      },
      {
        "id": "Coverage.kind",
        "path": "Coverage.kind",
        "patternCode": "insurance",
        "mustSupport": true
      },
      {
        "id": "Coverage.beneficiary",
        "path": "Coverage.beneficiary",
        "definition": "The patient for whom the insurance applies",
        "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": "RecipientPlanDTO.odbNum, RecipientDeductibleDTO.odbNum"
          }
        ]
      },
      {
        "id": "Coverage.period",
        "path": "Coverage.period",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "Coverage.period.start",
        "path": "Coverage.period.start",
        "short": "coverageBegin/enrollmentEffectiveDate/registrationDate/mbrshpStartDate",
        "definition": "The earliest date on which benefits under this policy were available",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientPlanDTO.effDate, RecipientDeductibleDTO.benefitYear (matching), FamilyMemberDTO.startDate, FamilyMemberHistoryDTO.membershipStartDate"
          }
        ]
      },
      {
        "id": "Coverage.period.end",
        "path": "Coverage.period.end",
        "definition": "The last date on which benefits under this policy were/will be available",
        "mustSupport": true,
        "mapping": [
          {
            "identity": "BPCS",
            "map": "RecipientPlanDTO.endDate, RecipientDeductibleDTO.benefitYear (matching), FamilyMemberDTO.startDate, FamilyMemberHistoryDTO.membershipEndDate"
          }
        ]
      },
      {
        "id": "Coverage.insurer",
        "path": "Coverage.insurer",
        "min": 1,
        "patternReference": {
          "reference": "Organization/bpcs"
        },
        "mustSupport": true
      },
      {
        "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": "RecipientPlanDTO.program, RecipientDeductibleDTO.program (matching)"
          }
        ]
      },
      {
        "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": "RecipientPlanDTO.plan"
          }
        ]
      }
    ]
  }
}