def us06(ged): out = [] #search for individuals stored in 'families' for ID in ged['families']: family = ged['families'][ID] #Ensure that each tag is present 'families' if not 'HUSB' in family or not 'WIFE' in family or not 'DIV' in family: continue #Search for HUSB or WIFE tag in family lib for person in ['HUSB','WIFE']: #check if family member is apart of lib for individuals if family[person] in ged['individuals']: individual = ged['individuals'][family[person]] if 'DEAT' in individual: #compare date stored for 'DIV' with date for 'DEAT' compare = compare_dates(family['DIV'], individual['DEAT']) if compare == 1: out.append('Error US06: Divorce date of {} ({}) occurs after Death date' .format(individual['NAME'],family[person])) return out
def us09(ged): out = [] #search for person stored in 'individuals' for ID in ged['individuals']: Ind = ged['individuals'][ID] #ensure death tag is present if not 'DEAT' in Ind: continue #find person with death tag for person in ['DEAT']: #compare date stored for 'BIRT' with date for 'DEAT' compare = compare_dates(Ind['BIRT'], Ind['DEAT']) if compare == 1: out.append('Error US09: Death date of {} ({}) occurs before birth date' .format(Ind['NAME'],Ind[person])) return out
def us04(ged): out = [] for key in ged['families']: fam = ged['families'][key] if not 'DIV' in fam or not 'MARR' in fam or not 'HUSB' in fam or not 'WIFE' in fam: continue if compare_dates(fam['MARR'], fam['DIV']) == 1: husb = ged['individuals'][fam['HUSB']]['NAME'] if fam[ 'HUSB'] in ged['individuals'] and 'NAME' in ged['individuals'][ fam['HUSB']] else '<Husband not found>' wife = ged['individuals'][fam['WIFE']]['NAME'] if fam[ 'WIFE'] in ged['individuals'] and 'NAME' in ged['individuals'][ fam['WIFE']] else '<Wife not found>' out.append( 'Error US04: Divorce date of {} and {} ({}, {}) occurs before marriage date' .format(husb, wife, fam['HUSB'], fam['WIFE'])) return out
def us02(ged): out = [] for key in ged['families']: fam = ged['families'][key] if not 'MARR' in fam or not 'HUSB' in fam or not 'WIFE' in fam: continue for person in ['HUSB', 'WIFE']: if fam[person] in ged['individuals']: indi = ged['individuals'][fam[person]] if 'BIRT' in indi: cmpr = compare_dates(fam['MARR'], indi['BIRT']) if cmpr == -1: out.append( 'Error US02: Birth date of {} ({}) occurs after {} marriage date' .format( indi['NAME'] if 'NAME' in indi else '<name not found>', fam[person], 'his' if person == 'HUSB' else 'her')) return out