Esempio n. 1
0
 def execute(self, output=None):
     '''
     This will execute all checkings of data with other sources.
     '''
     self.file = None
     if not output == None: self.file = open(output, "w")
     for person in self.profiles:
         #We write in the screen the name of the person
         print_out(person.nameLifespan(), self.file)
         #REMEMORI
         reader = rememori_reader(language=self.language,
                                  name_convention=self.name_convention)
         records = reader.profile_is_matched(person)
         for obtained in records:
             print_out(
                 "  -  " + obtained.nameLifespan() + "  " +
                 obtained.gen_data["web_ref"][0], self.file)
         #EL NORTE DE CASTILLA
         reader2 = elnortedecastilla_reader(
             language=self.language, name_convention=self.name_convention)
         records2 = reader2.profile_is_matched(person)
         for obtained in records2:
             print_out(
                 "  -  " + obtained.nameLifespan() + "  " +
                 obtained.gen_data["web_ref"][0], self.file)
         #ABC
         reader3 = abc_reader(language=self.language,
                              name_convention=self.name_convention)
         records3 = reader3.profile_is_matched(person)
         for obtained in records3:
             print_out(
                 "  -  " + obtained.nameLifespan() + "  " +
                 obtained.gen_data["web_ref"][0], self.file)
     if not self.file == None: self.file.close()
 def test_avoiding_analysis(self):
     '''
     Test confirming no analysis if antique record
     '''
     profile = gen_profile("Julián", "Gómez Gómez")
     profile.setCheckedDate("baptism", 1870, 4, 2, "EXACT")
     reader = rememori_reader()
     records = reader.profile_is_matched(profile)
     assert (len(records) == 0)
 def test_reading_an_input(self):
     profile = gen_profile("José", "García Martín")
     reader = rememori_reader()
     records = reader.profile_is_matched(profile)
     date1 = date(2016, 4, 2)
     date2 = date(2014, 12, 28)
     date1_found = False
     date2_found = False
     for profile in records:
         if (profile.gen_data["death_date"] == date1): date1_found = True
         if (profile.gen_data["death_date"] == date2): date2_found = True
     assert (date1_found)
     assert (date2_found)
 def test_simplifying_list(self):
     '''
     Test confirming list will be simplified
     '''
     profile = gen_profile("Julián", "Gómez Gómez")
     profile.setCheckedDate("baptism", 1970, 4, 2, "EXACT")
     reader = rememori_reader()
     records = reader.profile_is_matched(profile)
     date_found = False
     for deceased in records:
         if (deceased.gen_data["death"].get_date() == date(2017, 2, 13)):
             date_found = True
     assert (date_found)
Esempio n. 5
0
 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()
 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 not output == None: self.file = open(output, "w")
     print_out("Total number of profiles = " + str(len(profiles)), self.file)
     for person in profiles:
         #Check which analysis will be done
         check_rememori = continue_analysis(person, "REMEMORI", threshold)
         check_norte = continue_analysis(person, "ELNORTEDECASTILLA", threshold)
         check_abc = continue_analysis(person, "ABC", threshold)
         skipping = ""
         if (not check_rememori) and (not check_norte) and (not check_abc): skipping = " -- SKIPPED"
         #Variable for urls in tasks
         self.urls_task = ""
         #We write in the screen the name of the person
         print_out(str(person.get_id()) + " = "  + person.nameLifespan() + skipping, self.file)
         #REMEMORI
         if check_rememori:
             reader = rememori_reader(language=self.language, name_convention=self.name_convention)
             records = reader.profile_is_matched(person)
             self.result_analyzer(person, records, storage, "REMEMORI")
         #EL NORTE DE CASTILLA
         if check_norte:
             reader2 = elnortedecastilla_reader(language=self.language, name_convention=self.name_convention)
             records2 = reader2.profile_is_matched(person)
             self.result_analyzer(person, records2, storage, "ELNORTEDECASTILLA")
         #ABC
         if check_abc:
             reader3 = abc_reader(language=self.language, name_convention=self.name_convention)
             records3 = reader3.profile_is_matched(person)
             self.result_analyzer(person, records3, storage, "ABC")
         #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 not self.file == None: self.file.close()