def build_response_service(self, fhir_claim_response):
     service = ClaimResponseItem()
     service.sequenceLinkId = 2
     service_general_adjudication = ClaimResponseItemAdjudication()
     service_general_adjudication.category = ClaimResponseConverter.build_simple_codeable_concept(
         Stu3ClaimConfig.get_fhir_claim_item_general_adjudication_code())
     item_limitation = Money()
     item_limitation.value = self._TEST_SERVICE_LIMITATION_VALUE
     service_general_adjudication.amount = item_limitation
     service_general_adjudication.reason = ClaimResponseConverter \
         .build_codeable_concept(self._TEST_SERVICE_STATUS, Stu3ClaimConfig.get_fhir_claim_item_status_rejected_code())
     service_general_adjudication.value = self._TEST_SERVICE_QUANTITY_APPROVED
     service.adjudication.append(service_general_adjudication)
     item_rejection_adjudication = ClaimResponseItemAdjudication()
     item_rejection_adjudication.category = ClaimResponseConverter.build_simple_codeable_concept(
         Stu3ClaimConfig.
         get_fhir_claim_item_rejected_reason_adjudication_code())
     item_rejection_adjudication.reason = ClaimResponseConverter.build_codeable_concept(
         self._TEST_SERVICE_REJECTED_REASON)
     service.adjudication.append(item_rejection_adjudication)
     service.noteNumber = [2]
     fhir_claim_response.item.append(service)
     item_note = ClaimResponseProcessNote()
     item_note.number = 2
     item_note.text = self._TEST_SERVICE_JUSTIFICATION
     fhir_claim_response.processNote.append(item_note)
Exemplo n.º 2
0
 def build_contract_valued_item(self, contract, imis_coverage):
     valued_item = ContractValuedItem()
     policy_value = Money()
     policy_value.value = imis_coverage.value
     valued_item.net = policy_value
     contract.valuedItem = [valued_item]
     return contract
 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
 def build_response_item(self, fhir_claim_response):
     item = ClaimResponseItem()
     item.sequenceLinkId = 1
     item_general_adjudication = ClaimResponseItemAdjudication()
     item_general_adjudication.category = ClaimResponseConverter.build_simple_codeable_concept(
         Stu3ClaimConfig.get_fhir_claim_item_general_adjudication_code())
     item_limitation = Money()
     item_limitation.value = self._TEST_ITEM_LIMITATION_VALUE
     item_general_adjudication.amount = item_limitation
     item_general_adjudication.reason = ClaimResponseConverter \
         .build_codeable_concept(self._TEST_ITEM_STATUS, Stu3ClaimConfig.get_fhir_claim_item_status_passed_code())
     item_general_adjudication.value = self._TEST_ITEM_QUANTITY_APPROVED
     item.adjudication.append(item_general_adjudication)
     item_rejection_adjudication = ClaimResponseItemAdjudication()
     item_rejection_adjudication.category = ClaimResponseConverter.build_simple_codeable_concept(
         Stu3ClaimConfig.
         get_fhir_claim_item_rejected_reason_adjudication_code())
     item_rejection_adjudication.reason = ClaimResponseConverter.build_codeable_concept(
         self._TEST_ITEM_REJECTED_REASON)
     item.adjudication.append(item_rejection_adjudication)
     item.noteNumber = [1]
     fhir_claim_response.item.append(item)
     item_note = ClaimResponseProcessNote()
     item_note.number = 1
     item_note.text = self._TEST_ITEM_JUSTIFICATION
     fhir_claim_response.processNote.append(item_note)
 def build_fhir_total(cls, fhir_claim, imis_claim):
     total_claimed = imis_claim.claimed
     if not total_claimed:
         total_claimed = 0
     fhir_total = Money()
     fhir_total.value = total_claimed
     fhir_claim.total = fhir_total
Exemplo n.º 6
0
 def build_fhir_money_benefit_balance_financial(cls, benefit_balance,
                                                value):
     financial = cls.build_fhir_generic_benefit_balance_financial()
     money_value = Money()
     money_value.value = value
     financial.allowedMoney = money_value
     benefit_balance.financial.append(financial)
Exemplo n.º 7
0
 def build_fhir_item_general_adjudication(cls, claim_response_item, item):
     item_adjudication = ClaimResponseItemAdjudication()
     item_adjudication.category = \
         cls.build_simple_codeable_concept(Stu3ClaimConfig.get_fhir_claim_item_general_adjudication_code())
     item_adjudication.reason = cls.build_fhir_adjudication_reason(item)
     item_adjudication.value = item.qty_approved
     limitation_value = Money()
     limitation_value.value = item.limitation_value
     item_adjudication.amount = limitation_value
     claim_response_item.adjudication.append(item_adjudication)
 def create_test_fhir_instance(self):
     fhir_claim = FHIRClaim()
     fhir_claim.id = self._TEST_CODE
     fhir_claim.patient = PatientConverter.build_fhir_resource_reference(
         self._TEST_INSUREE)
     claim_code = ClaimConverter.build_fhir_identifier(
         self._TEST_CODE,
         Stu3IdentifierConfig.get_fhir_identifier_type_system(),
         Stu3IdentifierConfig.get_fhir_claim_code_type())
     fhir_claim.identifier = [claim_code]
     billable_period = Period()
     billable_period.start = self._TEST_DATE_FROM
     billable_period.end = self._TEST_DATE_TO
     fhir_claim.billablePeriod = billable_period
     diagnoses = []
     ClaimConverter.build_fhir_diagnosis(diagnoses,
                                         self._TEST_DIAGNOSIS_CODE.code,
                                         ImisClaimIcdTypes.ICD_0.value)
     fhir_claim.diagnosis = diagnoses
     total = Money()
     total.value = self._TEST_CLAIMED
     fhir_claim.total = total
     fhir_claim.created = self._TEST_DATE_CLAIMED
     fhir_claim.facility = LocationConverter.build_fhir_resource_reference(
         self._TEST_HF)
     information = []
     guarantee_id_code = Stu3ClaimConfig.get_fhir_claim_information_guarantee_id_code(
     )
     ClaimConverter.build_fhir_string_information(information,
                                                  guarantee_id_code,
                                                  self._TEST_GUARANTEE_ID)
     explanation_code = Stu3ClaimConfig.get_fhir_claim_information_explanation_code(
     )
     ClaimConverter.build_fhir_string_information(information,
                                                  explanation_code,
                                                  self._TEST_EXPLANATION)
     fhir_claim.information = information
     fhir_claim.enterer = PractitionerConverter.build_fhir_resource_reference(
         self._TEST_CLAIM_ADMIN)
     fhir_claim.type = ClaimConverter.build_simple_codeable_concept(
         self._TEST_VISIT_TYPE)
     type = Stu3ClaimConfig.get_fhir_claim_item_code()
     ClaimConverter.build_fhir_item(fhir_claim, self._TEST_ITEM_CODE, type,
                                    self._TEST_ITEM)
     type = Stu3ClaimConfig.get_fhir_claim_service_code()
     ClaimConverter.build_fhir_item(fhir_claim, self._TEST_SERVICE_CODE,
                                    type, self._TEST_SERVICE)
     return fhir_claim
 def build_fhir_item(cls, fhir_claim, code, item_type, item):
     fhir_item = FHIRClaimItem()
     fhir_item.sequence = FhirUtils.get_next_array_sequential_id(
         fhir_claim.item)
     unit_price = Money()
     unit_price.value = item.price_asked
     fhir_item.unitPrice = unit_price
     fhir_quantity = Quantity()
     fhir_quantity.value = item.qty_provided
     fhir_item.quantity = fhir_quantity
     fhir_item.service = cls.build_simple_codeable_concept(code)
     fhir_item.category = cls.build_simple_codeable_concept(item_type)
     item_explanation_code = Stu3ClaimConfig.get_fhir_claim_item_explanation_code(
     )
     information = cls.build_fhir_string_information(
         fhir_claim.information, item_explanation_code, item.explanation)
     if information:
         fhir_item.informationLinkId = [information.sequence]
     fhir_claim.item.append(fhir_item)
 def build_fhir_money_benefit_balance_financial(cls, benefit_balance,
                                                allowed_value, used_value):
     financial = cls.build_fhir_generic_benefit_balance_financial()
     allowed_money_value = Money()
     allowed_money_value.value = allowed_value or 0
     financial.allowedMoney = allowed_money_value
     used_money_value = Money()
     used_money_value.value = used_value or 0
     financial.usedMoney = used_money_value
     benefit_balance.financial.append(financial)
Exemplo n.º 11
0
 def build_fhir_total_benefit(cls, fhir_claim_response, imis_claim):
     total_approved = Money()
     total_approved.value = imis_claim.approved
     fhir_claim_response.totalBenefit = total_approved