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_using_elnortedecastilla(self):
        '''
        Test checking el Norte de Castilla parser
        '''
        profile = gen_profile("José Luis", "García Martín")
        profile.setCheckedDateWithDates("birth", date(1931, 4, 2), "EXACT")
        reader = elnortedecastilla_reader()
        records = reader.profile_is_matched(profile)
        assert (len(records) > 0)

        pass
Esempio n. 3
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()