Ejemplo n.º 1
0
 def build_fhir_communication_request_reference(cls, fhir_claim_response,
                                                imis_claim):
     feedback = cls.get_imis_claim_feedback(imis_claim)
     if feedback:
         reference = CommunicationRequestConverter.build_fhir_resource_reference(
             feedback)
         fhir_claim_response.communicationRequest = [reference]
 def create_test_fhir_instance(self):
     fhir_claim_response = ClaimResponse()
     fhir_claim_response.id = self._TEST_CODE
     pk_id = ClaimResponseConverter.build_fhir_identifier(
         self._TEST_ID,
         Stu3IdentifierConfig.get_fhir_identifier_type_system(),
         Stu3IdentifierConfig.get_fhir_id_type_code())
     claim_code = ClaimResponseConverter.build_fhir_identifier(
         self._TEST_CODE,
         Stu3IdentifierConfig.get_fhir_identifier_type_system(),
         Stu3IdentifierConfig.get_fhir_claim_code_type())
     fhir_claim_response.identifier = [pk_id, claim_code]
     display = Stu3ClaimConfig.get_fhir_claim_status_rejected_code()
     fhir_claim_response.outcome = ClaimResponseConverter.build_codeable_concept(
         self._TEST_STATUS, system=None, text=display)
     fhir_payment = ClaimResponsePayment()
     fhir_payment.adjustmentReason = ClaimResponseConverter.build_simple_codeable_concept(
         self._TEST_ADJUSTMENT)
     fhir_payment.date = self._TEST_DATE_PROCESSED
     fhir_claim_response.payment = fhir_payment
     total_approved = Money()
     total_approved.value = self._TEST_APPROVED
     fhir_claim_response.totalBenefit = total_approved
     fhir_error = ClaimResponseError()
     fhir_error.code = ClaimResponseConverter.build_codeable_concept(
         self._TEST_REJECTION_REASON)
     fhir_claim_response.error = [fhir_error]
     feedback = Feedback()
     feedback.id = self._TEST_FEEDBACK_ID
     fhir_claim_response.communicationRequest = \
         [CommunicationRequestConverter.build_fhir_resource_reference(feedback)]
     self.build_response_item(fhir_claim_response)
     self.build_response_service(fhir_claim_response)
     return fhir_claim_response
Ejemplo n.º 3
0
 def verify_fhir_instance(self, fhir_obj):
     self.assertEqual(self._TEST_UUID, fhir_obj.id)
     main_id_check = False
     for identifier in fhir_obj.identifier:
         if identifier.value == fhir_obj.id:
             main_id_check = True
         if identifier.type.coding[0].code == Stu3IdentifierConfig.get_fhir_uuid_type_code():
             self.assertEqual(str(self._TEST_UUID), identifier.value)
         elif identifier.type.coding[0].code == Stu3IdentifierConfig.get_fhir_claim_code_type():
             self.assertEqual(self._TEST_CODE, identifier.value)
     self.assertTrue(main_id_check, "One of the identifiers should match the main ID")
     self.assertEqual(self._TEST_STATUS, fhir_obj.outcome.coding[0].code)
     self.assertEqual(self._TEST_ADJUSTMENT, fhir_obj.payment.adjustmentReason.text)
     self.assertEqual(self._TEST_DATE_PROCESSED, fhir_obj.payment.date)
     self.assertEqual(self._TEST_APPROVED, fhir_obj.totalBenefit.value)
     self.assertEqual(self._TEST_REJECTION_REASON, fhir_obj.error[0].code.coding[0].code)
     self.assertEqual(str(self._TEST_FEEDBACK_UUID), CommunicationRequestConverter.get_resource_id_from_reference(
         fhir_obj.communicationRequest[0]))
     self.assertEqual(str(self._TEST_ITEM_STATUS), fhir_obj.item[0].adjudication[0].reason.coding[0].code)
     self.assertEqual(self._TEST_ITEM_QUANTITY_APPROVED, fhir_obj.item[0].adjudication[0].value)
     self.assertEqual(self._TEST_ITEM_JUSTIFICATION, fhir_obj.processNote[0].text)
     self.assertEqual(str(self._TEST_ITEM_REJECTED_REASON), fhir_obj.item[0].adjudication[1].reason.coding[0].code)
     self.assertEqual(self._TEST_ITEM_LIMITATION_VALUE, fhir_obj.item[0].adjudication[0].amount.value)
     self.assertEqual(str(self._TEST_SERVICE_STATUS), fhir_obj.item[1].adjudication[0].reason.coding[0].code)
     self.assertEqual(self._TEST_SERVICE_QUANTITY_APPROVED, fhir_obj.item[1].adjudication[0].value)
     self.assertEqual(self._TEST_SERVICE_JUSTIFICATION, fhir_obj.processNote[1].text)
     self.assertEqual(str(self._TEST_SERVICE_REJECTED_REASON), fhir_obj.item[1].adjudication[1].reason.coding[0].code)
     self.assertEqual(self._TEST_SERVICE_LIMITATION_VALUE, fhir_obj.item[1].adjudication[0].amount.value)
Ejemplo n.º 4
0
 def create_test_fhir_instance(self):
     fhir_communication_request = CommunicationRequest()
     fhir_communication_request.id = self._TEST_FEEDBACK_ID
     fhir_communication_request.occurrenceDateTime = self._TEST_FEEDBACK_DATE
     identifiers = []
     identifier = Converter.build_fhir_identifier(
         self._TEST_FEEDBACK_ID,
         Stu3IdentifierConfig.get_fhir_identifier_type_system(),
         Stu3IdentifierConfig.get_fhir_id_type_code())
     identifiers.append(identifier)
     fhir_communication_request.identifier = identifiers
     reasons = [
         Converter.build_codeable_concept(
             Config.get_fhir_care_rendered_code(),
             text=str(self._TEST_CARE_RENDERED)),
         Converter.build_codeable_concept(
             Config.get_fhir_payment_asked_code(),
             text=str(self._TEST_PAYMENT_ASKED)),
         Converter.build_codeable_concept(
             Config.get_fhir_drug_prescribed_code(),
             text=str(self._TEST_DRUG_PRESCRIBED)),
         Converter.build_codeable_concept(
             Config.get_fhir_drug_received_code(),
             text=str(self._TEST_DRUG_RECEIVED)),
         Converter.build_codeable_concept(Config.get_fhir_asessment_code(),
                                          text=str(self._TEST_ASESSMENT))
     ]
     fhir_communication_request.reasonCode = reasons
     return fhir_communication_request
 def test_to_fhir_obj(self):
     imis_feedback = self.create_test_imis_instance()
     fhir_communication_request = CommunicationRequestConverter.to_fhir_obj(
         imis_feedback)
     self.verify_fhir_instance(fhir_communication_request)