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 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 build_imis_identifiers(cls, imis_claim_admin, fhir_practitioner, errors): value = cls.get_fhir_identifier_by_code( fhir_practitioner.identifier, Stu3IdentifierConfig.get_fhir_claim_admin_code_type()) if value: imis_claim_admin.code = value cls.valid_condition(imis_claim_admin.code is None, gettext('Missing the claim admin code'), errors)
def verify_fhir_instance(self, fhir_obj): self.assertEqual(1, len(fhir_obj.name)) human_name = fhir_obj.name[0] self.assertTrue(isinstance(human_name, HumanName)) self.assertEqual(self._TEST_OTHER_NAME, human_name.given[0]) self.assertEqual(self._TEST_LAST_NAME, human_name.family) self.assertEqual(NameUse.USUAL.value, human_name.use) for identifier in fhir_obj.identifier: self.assertTrue(isinstance(identifier, Identifier)) code = PractitionerConverter.get_first_coding_from_codeable_concept( identifier.type).code if code == Stu3IdentifierConfig.get_fhir_claim_admin_code_type(): self.assertEqual(self._TEST_CODE, identifier.value) elif code == Stu3IdentifierConfig.get_fhir_id_type_code(): self.assertEqual(str(self._TEST_ID), identifier.value) self.assertEqual(self._TEST_DOB, fhir_obj.birthDate) self.assertEqual(2, len(fhir_obj.telecom)) for telecom in fhir_obj.telecom: self.assertTrue(isinstance(telecom, ContactPoint)) if telecom.system == ContactPointSystem.PHONE.value: self.assertEqual(self._TEST_PHONE, telecom.value) elif telecom.system == ContactPointSystem.EMAIL.value: self.assertEqual(self._TEST_EMAIL, telecom.value)