def us09_birth_b4_parents_death(file): error_list = list() printTables(file) indDict, famDict = parse_main(file) ''' loop over family records for each family a) get the husband death and wife death from individuals for each children => check if child is born before (wife death) a) if yes add to error_list => difference of (death of father - birth of child) < 9 a) if yes add to error_list ''' for key, familyData in famDict.items(): #print(f"key is {key} and data is {familyData}") husband_death_date = indDict[familyData.Husband].Death wife_death_date = indDict[familyData.Wife].Death wife_name = indDict[familyData.Wife].Name husband_name = indDict[familyData.Husband].Name for eachchild in familyData.multChild: child_birth_date = indDict[eachchild].Birthday child_full_name = indDict[eachchild].Name if child_birth_date > wife_death_date: error_string = f"ERROR: FAMILY: US09 : Individual {eachchild} Name: {child_full_name} born after death of mother {familyData.Wife} {wife_name}" error_list.append(error_string) if child_birth_date > husband_death_date and not ( checkDiffInMonths(child_birth_date, husband_death_date) < 9): error_string = f"ERROR: FAMILY: US09 : Individual {eachchild} Name: {child_full_name} born 9 months after death of father {familyData.Husband} {husband_name}" error_list.append(error_string) return error_list
def us31_list_living_single(file): indDict,famDict,errorList = parse_main(file) printTables(file) error_list = list() for iD in indDict: if indDict[iD].Age > 30 and indDict[iD].Spouse == 'NA': error_string = f"ERROR: INDIVIDUAL: US31: The individual {indDict[iD].indID} is single and above 30" error_list.append(error_string) return error_list
def sprint_1_user_stories(): master_file_name = "gedfilestest/sprint01-testdata_1.ged" indTable, famTable = printTables(master_file_name) error_list = [] error_list.extend(us01_dates_b4_curr_date(master_file_name)) error_list.extend(us02_birth_b4_marr(master_file_name)) error_list.extend(us03_birth_b4_death(master_file_name)) error_list.extend(us04_marr_b4_divo(master_file_name)) error_list.extend(us05_marr_b4_death(master_file_name)) error_list.extend(us06_divo_b4_death(master_file_name)) error_list.extend(us07_less_than_150years(master_file_name)) error_list.extend(us08_birth_b4_marr_parents(master_file_name)) for each_error in error_list: print(each_error) with open('sprint1output.txt', 'w') as file: file.write('\n\nIndividuals Information----------------------->\n') file.write(indTable.get_string()) file.write("\n") file.write('\n\nFamily Information----------------------->\n') file.write(famTable.get_string()) file.write("\n") for each_error in error_list: file.write(each_error + "\n")
def sprint_2_user_stories(): master_file_name = "gedfilestest/sprint02-testdata_2.ged" indTable, famTable = printTables(master_file_name) error_list = [] error_list.extend(us09_birth_b4_parents_death(master_file_name)) error_list.extend(us10_marr_after_14(master_file_name)) error_list.extend(us11_no_bigamy(master_file_name)) error_list.extend(us12_parents_not_too_old(master_file_name)) error_list.extend(us13_siblings_spacing(master_file_name)) error_list.extend(us14_siblings_spacing(master_file_name)) error_list.extend(us15_fewer_than_15_siblings(master_file_name)) error_list.extend(us16_male_last_names(master_file_name)) for each_error in error_list: print(each_error) with open('sprint2output.txt', 'w') as file: file.write('\n\nIndividuals Information----------------------->\n') file.write(indTable.get_string()) file.write("\n") file.write('\n\nFamily Information----------------------->\n') file.write(famTable.get_string()) file.write("\n") for each_error in error_list: file.write(each_error + "\n")
def sprint_4_user_stories(): master_file_name = "gedfilestest/sprint04-testdata.ged" indTable, famTable = printTables(master_file_name) error_list = [] #sprint1 error_list.extend(us01_dates_b4_curr_date(master_file_name)) error_list.extend(us02_birth_b4_marr(master_file_name)) error_list.extend(us03_birth_b4_death(master_file_name)) error_list.extend(us04_marr_b4_divo(master_file_name)) error_list.extend(us05_marr_b4_death(master_file_name)) error_list.extend(us06_divo_b4_death(master_file_name)) error_list.extend(us07_less_than_150years(master_file_name)) error_list.extend(us08_birth_b4_marr_parents(master_file_name)) #sprint2 error_list.extend(us09_birth_b4_parents_death(master_file_name)) error_list.extend(us10_marr_after_14(master_file_name)) error_list.extend(us11_no_bigamy(master_file_name)) error_list.extend(us12_parents_not_too_old(master_file_name)) error_list.extend(us13_siblings_spacing(master_file_name)) error_list.extend(us14_multiple_births(master_file_name)) error_list.extend(us15_fewer_than_15_siblings(master_file_name)) error_list.extend(us16_male_last_names(master_file_name)) #sprint3 error_list.extend(us17_no_marr_2_children(master_file_name)) error_list.extend(us18_sibilings_no_marriage(master_file_name)) error_list.extend(us19_no_1st_cousin_marr(master_file_name)) error_list.extend(us20_aunts_and_uncles(master_file_name)) error_list.extend(us21_husb_male_wife_female(master_file_name)) error_list.extend(us22_unique_IDs(master_file_name)) error_list.extend(us23_unique_name_and_birth(master_file_name)) error_list.extend(us24_unique_fam_by_spouses(master_file_name)) #sprint4 error_list.extend(us27_individual_ages(master_file_name)) error_list.extend(us28_order_sibilings_by_age(master_file_name)) error_list.extend(us29_list_deceased(master_file_name)) error_list.extend(us30_list_living_married(master_file_name)) error_list.extend(us31_list_living_single(master_file_name)) error_list.extend(us32_list_multiple_births(master_file_name)) error_list.extend(us35_list_recent_births(master_file_name)) error_list.extend(us36_list_recent_deaths(master_file_name)) for each_error in error_list: print(each_error) with open('sprint4output.txt', 'w') as file: file.write('\n\nIndividuals Information----------------------->\n') file.write(indTable.get_string()) file.write("\n") file.write('\n\nFamily Information----------------------->\n') file.write(famTable.get_string()) file.write("\n") for each_error in error_list: file.write(each_error + "\n")
def us16_male_last_names(file): error_list = list() printTables(file) ''' loop over family records for each family a) get the husband first name 1. see wife name and if wife first name and husband name is not same a) add that individual Id error to wife Name 2. for each children a) get ind formation and see if the first name of ind is matching with husband firstname b) if does not match if yes add to error_list ''' indDict,famDict = parse_main(file) for key,familyData in famDict.items(): husband_first_name = get_first_name(indDict[familyData.Husband].Name) for eachchild in familyData.multChild: child_full_name= indDict[eachchild].Name child_first_name= get_first_name(child_full_name) if child_first_name != husband_first_name: error_string= f"ERROR: FAMILY: US16: Individual {eachchild} Name: {child_full_name} not matched with family first name: {husband_first_name}" error_list.append(error_string); return error_list