def test_esquelas(self): ''' Test checking el Esquelas parser ''' profile = gen_profile("José Luis", "García Martín") reader = esquelas_reader() records = reader.profile_is_matched(profile) assert (len(records) > 1)
def execute(self, database, output = None, storage = False, threshold = 360, id_profile = None): ''' This will execute all checkings of data with other sources. Database shall be one instance of a database child of common_database Output is the optional argument to get the result Storage is to store the result in the database ''' if id_profile: profiles = [database.get_profile_by_ID(id_profile)] else: profiles = database.get_all_profiles() self.file = None if output is not None: self.file = open(output, "w") print_out("Total number of profiles = " + str(len(profiles)), self.file) for person in profiles: #Firstly, we need to analyze if we need to add the research log, if does not exist, of course log_loc = get_research_log_id(person, storage = storage) #Check which analysis will be done checks_2_perform = {} overall_check = False for parser in ALL_PARSERS: checks_2_perform[parser] = continue_analysis(person, parser, threshold, log_loc, self.file) if checks_2_perform[parser]: overall_check = True skipping = "" log_level = 20 if not overall_check: skipping = " -- SKIPPED" log_level = 15 #We write in the screen the name of the person print_out(str(person.get_id()) + " = " + person.nameLifespan() + skipping, self.file, log_level = log_level) #Variable for urls in tasks self.urls_task = "" #We accumulate all readers readers_2_use = {} readers_2_use["REMEMORI"] = rememori_reader(language=self.language, name_convention=self.name_convention) readers_2_use["ELNORTEDECASTILLA"] = elnortedecastilla_reader(language=self.language, name_convention=self.name_convention) readers_2_use["ABC"] = abc_reader(language=self.language, name_convention=self.name_convention) readers_2_use["ESQUELAS"] = esquelas_reader(language=self.language, name_convention=self.name_convention) readers_2_use["CEMENTRY VALENCIA"] = valencia_reader(language=self.language, name_convention=self.name_convention) readers_2_use["LAVANGUARDIA"] = vanguardia_reader(language=self.language, name_convention=self.name_convention) for parser in ALL_PARSERS: if checks_2_perform[parser]: records = readers_2_use[parser].profile_is_matched(person) self.result_analyzer(person, records, storage, parser, log_loc) #We add a single task for all URLs in the person if storage and self.urls_task != "": person.set_task("CHECK WEB REFERENCES ", details = self.urls_task) if self.file is not None: self.file.close()