def build_imis_location_type(cls, imis_location, fhir_location, errors): if code == R4LocationConfig.get_fhir_code_for_region(): imis_location.type = ImisLocationType.REGION.value elif code == R4LocationConfig.get_fhir_code_for_district(): imis_location.type = ImisLocationType.DISTRICT.value elif code == R4LocationConfig.get_fhir_code_for_ward(): imis_location.type = ImisLocationType.WARD.value elif code == R4LocationConfig.get_fhir_code_for_village(): imis_location.type = ImisLocationType.VILLAGE.value cls.valid_condition(imis_location.type is None, gettext('Missing location type'), errors)
def build_fhir_type(cls, fhir_location, imis_location): code = "" text = "" if imis_location.type == ImisLocationType.REGION.value: code = R4LocationConfig.get_fhir_code_for_region() text = "region" elif imis_location.type == ImisLocationType.DISTRICT.value: code = R4LocationConfig.get_fhir_code_for_district() text = "district" elif imis_location.type == ImisLocationType.WARD.value: code = R4LocationConfig.get_fhir_code_for_ward() text = "ward" elif imis_location.type == ImisLocationType.VILLAGE.value: code = R4LocationConfig.get_fhir_code_for_village() text = "village" fhir_location.type = \ [cls.build_codeable_concept(code, R4LocationConfig.get_fhir_location_area_type_system(), text=text)]