The Coverage model represents insurance coverage linked to Patients. Coverages are linked to Patient instances, as well as Transactor instances, which represent the issuer for the corresponding coverage.
The Coverage model can be used to find all of the coverages defined in a Canvas instance, whether overall or for a particular patient. For example, to find all of the current coverages for a patient, the Patient.coverages method can be used:
>>>importarrow>>>fromcanvas_sdk.v1.data.patientimportPatient>>>patient_1=Patient.objects.get(id="a74592ae8a6c4d0ebe0799d3fb3713d1")>>>patient_1_current_coverages=patient_1.coverages.filter(coverage_end_date__gt=arrow.now().date().isoformat())>>>print([coverage.issuer.nameforcoverageinpatient_1_current_coverages])['AVALON HEALTHCARE SOLUTIONS CAPITAL BLUE CROSS']
Alternatively, to find all of the Coverage instances issed by a particular issuer/transactor, the Transactor model can be queried:
The filter method can be used to filter by desired attributes. The following examples show commonly used operations to filter coverage data:
Show a Patient’s Coverages in order of Rank (Primary, Secondary, etc.)
>>>fromcanvas_sdk.v1.data.patientimportPatient>>>patient_1=Patient.objects.get(id="aebe4d3f5d18410388dc69c4b5169fc3")>>>patient_coverages=patient_1.coverages.all().order_by("coverage_rank")>>>print([(coverage.issuer.name,coverage.coverage_rank,)forcoverageinpatient_coverages])[('AVALON HEALTHCARE SOLUTIONS CAPITAL BLUE CROSS',1),('Blue Cross Blue Shield of Arizona Advantage',2)]
Find All Expired Coverages
>>>importarrow>>>fromcanvas_sdk.v1.data.coverageimportCoverage>>>expired_coverages=Coverage.objects.filter(coverage_end_date__lt=arrow.now().date().isoformat())>>>print([f"{coverage.issuer.name} expired {coverage.coverage_end_date.isoformat()}"forcoverageinexpired_coverages])['Blue Cross Blue Shield of Arizona Advantage expired 2025-01-10']