コード例 #1
0
    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
コード例 #2
0
 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)
コード例 #3
0
 def build_imis_hf_identiftier(cls, imis_hf, fhir_location, errors):
     value = cls.get_fhir_identifier_by_code(
         fhir_location.identifier,
         Stu3IdentifierConfig.get_fhir_facility_id_type())
     if value:
         imis_hf.code = value
     cls.valid_condition(imis_hf.code is None, gettext('Missing hf code'),
                         errors)
コード例 #4
0
 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_uuid_type_code():
             self.assertEqual(fhir_obj.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)