From 09cf90d50cb79c39f10cf36a26bca2558d33c856 Mon Sep 17 00:00:00 2001 From: Khavin Shankar Date: Thu, 12 Sep 2024 12:44:00 +0530 Subject: [PATCH] fixed incoming fhir data parsing --- care/hcx/utils/fhir.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/care/hcx/utils/fhir.py b/care/hcx/utils/fhir.py index 46ee5326c6..93df49ba82 100644 --- a/care/hcx/utils/fhir.py +++ b/care/hcx/utils/fhir.py @@ -1017,8 +1017,10 @@ def process_coverage_elibility_check_response(self, response): coverageeligibilityresponse.CoverageEligibilityResponse( **list( filter( - lambda entry: entry.resource - is coverageeligibilityresponse.CoverageEligibilityResponse, + lambda entry: isinstance( + entry.resource, + coverageeligibilityresponse.CoverageEligibilityResponse, + ), coverage_eligibility_check_bundle.entry, ) )[0].resource.dict() @@ -1027,7 +1029,7 @@ def process_coverage_elibility_check_response(self, response): coverage_request = coverage.Coverage( **list( filter( - lambda entry: entry.resource is coverage.Coverage, + lambda entry: isinstance(entry.resource, coverage.Coverage), coverage_eligibility_check_bundle.entry, ) )[0].resource.dict() @@ -1057,7 +1059,9 @@ def process_claim_response(self, response): claim_response = claimresponse.ClaimResponse( **list( filter( - lambda entry: entry.resource is claimresponse.ClaimResponse, + lambda entry: isinstance( + entry.resource, claimresponse.ClaimResponse + ), claim_bundle.entry, ) )[0].resource.dict()