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 = PatientConverter.get_first_coding_from_codeable_concept(identifier.type).code if code == Stu3IdentifierConfig.get_fhir_chfid_type_code(): self.assertEqual(self._TEST_CHF_ID, identifier.value) elif code == Stu3IdentifierConfig.get_fhir_id_type_code(): self.assertEqual(str(self._TEST_ID), identifier.value) elif code == Stu3IdentifierConfig.get_fhir_passport_type_code(): self.assertEqual(self._TEST_PASSPORT, identifier.value) self.assertEqual(self._TEST_DOB, fhir_obj.birthDate) self.assertEqual(AdministrativeGender.MALE.value, fhir_obj.gender) marital_code = PatientConverter.get_first_coding_from_codeable_concept(fhir_obj.maritalStatus).code self.assertEqual(Stu3MaritalConfig.get_fhir_divorced_code(), marital_code) 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) self.assertEqual(2, len(fhir_obj.address)) for adddress in fhir_obj.address: self.assertTrue(isinstance(adddress, Address)) if adddress.type == AddressType.PHYSICAL.value: self.assertEqual(self._TEST_ADDRESS, adddress.text) elif adddress.type == AddressType.BOTH.value: self.assertEqual(self._TEST_GEOLOCATION, adddress.text)
def verify_fhir_instance(self, fhir_obj): for identifier in fhir_obj.identifier: code = LocationConverter.get_first_coding_from_codeable_concept( identifier.type).code if code == Stu3IdentifierConfig.get_fhir_id_type_code(): self.assertEqual(str(self._TEST_ID), identifier.value) elif code == Stu3IdentifierConfig.get_fhir_facility_id_type(): self.assertEqual(self._TEST_HF_CODE, identifier.value) self.assertEqual(self._TEST_HF_NAME, fhir_obj.name) type_code = LocationConverter.get_first_coding_from_codeable_concept( fhir_obj.type).code self.assertEqual(Stu3LocationConfig.get_fhir_code_for_hospital(), type_code) self.assertEqual(self._TEST_ADDRESS, fhir_obj.address.text) self.assertEqual(3, len(fhir_obj.telecom)) for telecom in fhir_obj.telecom: 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) elif telecom.system == ContactPointSystem.FAX.value: self.assertEqual(self._TEST_FAX, telecom.value)
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)