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 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 build_fhir_id_identifier(cls, identifiers, imis_object): if imis_object.id is not None: identifier = cls.build_fhir_identifier( str(imis_object.id), Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_id_type_code()) identifiers.append(identifier)
def build_fhir_code_identifier(cls, identifiers, imis_claim_admin): if imis_claim_admin.code: identifier = cls.build_fhir_identifier( imis_claim_admin.code, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_claim_admin_code_type()) identifiers.append(identifier)
def create_test_fhir_instance(self): fhir_practitioner = Practitioner() name = HumanName() name.family = self._TEST_LAST_NAME name.given = [self._TEST_OTHER_NAME] name.use = NameUse.USUAL.value fhir_practitioner.name = [name] identifiers = [] chf_id = PractitionerConverter.build_fhir_identifier( self._TEST_CODE, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_claim_admin_code_type()) identifiers.append(chf_id) fhir_practitioner.identifier = identifiers fhir_practitioner.birthDate = self._TEST_DOB telecom = [] phone = PractitionerConverter.build_fhir_contact_point( self._TEST_PHONE, ContactPointSystem.PHONE.value, ContactPointUse.HOME.value) telecom.append(phone) email = PractitionerConverter.build_fhir_contact_point( self._TEST_EMAIL, ContactPointSystem.EMAIL.value, ContactPointUse.HOME.value) telecom.append(email) fhir_practitioner.telecom = telecom return fhir_practitioner
def create_test_fhir_instance(self): location = Location() identifier = LocationConverter.build_fhir_identifier( self._TEST_HF_CODE, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_facility_id_type()) location.identifier = [identifier] location.name = self._TEST_HF_NAME location.type = LocationConverter.build_codeable_concept( Stu3LocationConfig.get_fhir_code_for_hospital(), Stu3LocationConfig.get_fhir_location_role_type_system()) location.address = LocationConverter.build_fhir_address( self._TEST_ADDRESS, AddressUse.HOME.value, AddressType.PHYSICAL.value) telecom = [] phone = LocationConverter.build_fhir_contact_point( self._TEST_PHONE, ContactPointSystem.PHONE.value, ContactPointUse.HOME.value) telecom.append(phone) fax = LocationConverter.build_fhir_contact_point( self._TEST_FAX, ContactPointSystem.FAX.value, ContactPointUse.HOME.value) telecom.append(fax) email = LocationConverter.build_fhir_contact_point( self._TEST_EMAIL, ContactPointSystem.EMAIL.value, ContactPointUse.HOME.value) telecom.append(email) location.telecom = telecom return location
def build_fhir_hf_code_identifier(cls, identifiers, imis_hf): if imis_hf is not None: identifier = cls.build_fhir_identifier( imis_hf.code, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_facility_id_type()) identifiers.append(identifier)
def build_fhir_passport_identifier(cls, identifiers, imis_insuree): if hasattr(imis_insuree, "typeofid") and imis_insuree.typeofid is not None: pass # TODO typeofid isn't provided, this section should contain logic used to create passport field based on typeofid elif imis_insuree.passport is not None: identifier = cls.build_fhir_identifier(imis_insuree.passport, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_passport_type_code()) identifiers.append(identifier)
def create_test_fhir_instance(self): fhir_patient = Patient() name = HumanName() name.family = self._TEST_LAST_NAME name.given = [self._TEST_OTHER_NAME] name.use = NameUse.USUAL.value fhir_patient.name = [name] identifiers = [] chf_id = PatientConverter.build_fhir_identifier( self._TEST_CHF_ID, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_chfid_type_code()) identifiers.append(chf_id) passport = PatientConverter.build_fhir_identifier( self._TEST_PASSPORT, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_passport_type_code()) identifiers.append(passport) fhir_patient.identifier = identifiers fhir_patient.birthDate = self._TEST_DOB fhir_patient.gender = AdministrativeGender.MALE.value fhir_patient.maritalStatus = PatientConverter.build_codeable_concept( Stu3MaritalConfig.get_fhir_divorced_code(), Stu3MaritalConfig.get_fhir_marital_status_system()) telecom = [] phone = PatientConverter.build_fhir_contact_point( self._TEST_PHONE, ContactPointSystem.PHONE.value, ContactPointUse.HOME.value) telecom.append(phone) email = PatientConverter.build_fhir_contact_point( self._TEST_EMAIL, ContactPointSystem.EMAIL.value, ContactPointUse.HOME.value) telecom.append(email) fhir_patient.telecom = telecom addresses = [] current_address = PatientConverter.build_fhir_address( self._TEST_ADDRESS, AddressUse.HOME.value, AddressType.PHYSICAL.value) addresses.append(current_address) geolocation = PatientConverter.build_fhir_address( self._TEST_GEOLOCATION, AddressUse.HOME.value, AddressType.BOTH.value) addresses.append(geolocation) fhir_patient.address = addresses return fhir_patient
def get_fhir_identifier_by_code(cls, identifiers, lookup_code): value = None for identifier in identifiers or []: first_coding = cls.get_first_coding_from_codeable_concept(identifier.type) if first_coding.system == Stu3IdentifierConfig.get_fhir_identifier_type_system() \ and first_coding.code == lookup_code: value = identifier.value break return value
def build_fhir_identifiers(cls, fhir_claim, imis_claim): identifiers = [] cls.build_fhir_id_identifier(identifiers, imis_claim) claim_code = cls.build_fhir_identifier( imis_claim.code, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_claim_code_type()) identifiers.append(claim_code) fhir_claim.identifier = identifiers
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_chfid_identifier(cls, identifiers, imis_insuree): if imis_insuree.chf_id is not None: identifier = cls.build_fhir_identifier(imis_insuree.chf_id, Stu3IdentifierConfig.get_fhir_identifier_type_system(), Stu3IdentifierConfig.get_fhir_chfid_type_code()) identifiers.append(identifier)