コード例 #1
0
def us02_birth_b4_marr(file):
    indDict, famDict = parse_main(file)
    error_list = list()
    for famID in famDict:
        if famDict[famID].Marriage != "NA" and famDict[famID].Marriage != "":
            # Search through individuals to get husband and wife
            husband = None
            wife = None
            for iD in indDict:
                if indDict[iD].indID == famDict[famID].Husband:
                    husband = indDict[iD]

                if indDict[iD].indID == famDict[famID].Wife:
                    wife = indDict[iD]

            if wife.Birthday is not None and wife.Birthday > famDict[
                    famID].Marriage:
                error_string = f"ERROR: INDIVIDUAL: US02: {wife.indID}: Birth Date OF Wife:{wife.Birthday} is after Marriage Date:{famDict[famID].Marriage}"
                error_list.append(error_string)

            if husband.Birthday is not None and husband.Birthday > famDict[
                    famID].Marriage:
                error_string = f"ERROR: INDIVIDUAL: US02: {husband.indID}: Birth Date OF Husband:{husband.Birthday} is after Marriage Date:{famDict[famID].Marriage}"
                error_list.append(error_string)
    return error_list
コード例 #2
0
def us12_parents_not_too_old(file):
    error_list = list()
    #printTables(file)
    indDict,famDict = parse_main(file)
    
    for famID in famDict:
        if famDict[famID].multChild !=[]:
            mother=famDict[famID].Wife;
            father=famDict[famID].Husband;
            for iD in indDict:
                if indDict[iD].indID==mother:
                    age_moth=indDict[iD].Age
                if indDict[iD].indID==father:
                    age_fath=indDict[iD].Age
            for child in famDict[famID].multChild:
                for iD in indDict:
                    if indDict[iD].indID==child:
                        if age_moth-indDict[iD].Age>=60:
                            error_string = f"ERROR: INDIVIDUAL: US12: The age difference of child:{indDict[iD].indID} and mother:{mother} is greater than or equal to 60"
                            error_list.append(error_string)
                        if age_fath-indDict[iD].Age>=80:
                            error_string = f"ERROR: INDIVIDUAL: US12: The age difference of child:{indDict[iD].indID} and father:{father} is greater than or equal to 80"
                            error_list.append(error_string)
                            
    return error_list
コード例 #3
0
def us14_multiple_births(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)

    totalSpouses = []

    numSpouse = 0

    countSameSiblings = 1

    listChild = []

    lenChild = 0

    for famId in famDict:
        if (famDict[famId].multChild):
            lenChild = len(famDict[famId].multChild)
            if lenChild > 5:
                listChild = famDict[famId].multChild
                birthCheck = indDict[listChild[0]].Birthday
                #print(birthCheck)
                #print(indDict[listChild[i]].Birthday)
                for i in range(1, lenChild):
                    #print(indDict[listChild[i]].Birthday)
                    if indDict[listChild[i]].Birthday == birthCheck:
                        countSameSiblings += 1

                if countSameSiblings > 5:
                    #print(countSameSiblings)
                    error_string = f"ERROR: FAMILY: US14 Family {famDict[famId].famID} has more than 5 siblings born at the same time"
                    error_list.append(error_string)

    return error_list
コード例 #4
0
def us13_siblings_spacing(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)

    for famID in famDict:
        birthdays = []
        if famDict[famID].multChild != []:
            for child in famDict[famID].multChild:
                for iD in indDict:
                    if indDict[iD].indID == child:
                        birthdays.append(indDict[iD].Birthday)

            cnt = len(birthdays)
            i = 0
            while i <= cnt - 1:
                n = 0
                while n <= cnt - 1:
                    diff = checkDiffInDays(birthdays[i], birthdays[n])
                    if diff > 1 and diff < 244:
                        error_string = f"ERROR: FAMILY: US13: The spacing between sibling1:{famDict[famID].multChild[i]} and sibling2:{famDict[famID].multChild[n]} of family:{famDict[famID].famID} is not valid"
                        error_list.append(error_string)
                    n = n + 1
                i = i + 1

    return error_list
コード例 #5
0
def printTables(fileName):
    indDict, famDict = parse_main(fileName);
    indTable = PrettyTable()
    famTable = PrettyTable()
    
    indTable.field_names = ['ID', 'Name', 'Gender', 'Birthday', 'Age', 'Alive', 'Death', 'Child', 'Spouse']
    #print(famDict)
    
    for iD in indDict:
        ind = indDict[iD]
        indTable.add_row(ind.details())
    
    #print(famDict)
    #print(famDict)
    print('\n\nIndividuals Information----------------------->\n')
    
    print (indTable)

    famTable.field_names = ['ID', 'Married', 'Divorced', 'Husband ID', 'Husband Name', 'Wife ID', 'Wife Name', 'Children']
    #print(famDict)
    
    for famID in famDict:
        famObj= famDict[famID]
        childrenarr=[];
        for lin in famObj.multChild:
            childrenarr.append(lin.strip("@"))
        famObj.multChild=childrenarr
        famTable.add_row(famObj.details(indDict))
    
    #print(famDict)
    #print(famDict)
    print('\n\nFamily Information----------------------->\n')
    print (famTable)
    return indTable,famTable
コード例 #6
0
def us08_birth_b4_marr_parents(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)

    for famId, famObject in famDict.items():
        marriedDate = famObject.Marriage
        divorcedDate = famObject.Divorce
        if famObject.multChild != "NA":
            for eachchild in famObject.multChild:
                indObj = indDict[eachchild]
                birthday = indObj.Birthday
                #print(f"{birthday} > {marriedDate} is {birthday > marriedDate} ")
                if birthday < marriedDate:
                    error_list.append(
                        f"ANOMALY: FAMILY: US08: {indObj.indID}: born {indObj.Birthday} before marriage on {marriedDate}"
                    )
                if birthday > divorcedDate:
                    if checkDiffInMonths(birthday, divorcedDate) > 9:
                        error_list.append(
                            f"ANOMALY: FAMILY: US08: {indObj.indID}: born {indObj.Birthday} after divorce on {marriedDate}"
                        )
                '''
                elif birthday < divorcedDate and checkDiffInMonths(birthday,divorcedDate) < 9 :
                    error_list.append(f"ANOMALY: FAMILY: US08: {indObj.indID}: born {indObj.Birthday} after divorce on {marriedDate}")
                '''
    return error_list
    '''
コード例 #7
0
def us01_dates_b4_curr_date(file):
    indDict, famDict, errorList = parse_main(file)
    error_list = list()
    for iD in indDict:
        if indDict[iD].Birthday != "NA" and indDict[iD].Birthday != "":
            if compare_date_to_todays_date(indDict[iD].Birthday) == 1:
                error_string = f"ERROR: INDIVIDUAL: US01: {indDict[iD].indID}: Birthday {indDict[iD].Birthday} is after todays date"
                error_list.append(error_string)

        if indDict[iD].Death != "NA" and indDict[iD].Death != "":
            if compare_date_to_todays_date(indDict[iD].Death) == 1:
                error_string = f"ERROR: INDIVIDUAL: US01: {indDict[iD].indID}: Death Date {indDict[iD].Death} is after todays date"
                error_list.append(error_string)

    for famID in famDict:
        if famDict[famID].Marriage != "NA" and famDict[famID].Marriage != "":
            if compare_date_to_todays_date(famDict[famID].Marriage) == 1:
                error_string = f"ERROR: FAMILY: US01: {famDict[famID].famID}: Marriage Date {famDict[famID].Marriage}  is after todays date"
                error_list.append(error_string)

        if famDict[famID].Divorce != "NA" and famDict[famID].Divorce != "":
            if compare_date_to_todays_date(famDict[famID].Divorce) == 1:
                error_string = f"ERROR: FAMILY: US01: {famDict[famID].famID}: Divorce Date {famDict[famID].Divorce}  is after todays date"
                error_list.append(error_string)
    return error_list
コード例 #8
0
def us10_marr_after_14(file):
    indDict, famDict, errorList = parse_main(file)
    error_list = list()

    for famID in famDict:
        if famDict[famID].Husband != 'NA':  #check husb age

            husband = famDict[famID].Husband
            if (husband in indDict):
                age = 0
                if (famDict[famID].Marriage != 'NA'):
                    age = getAgeAt(indDict[husband].Birthday,
                                   famDict[famID].Marriage)
                if (age <= 14):
                    error_string = f"ERROR: US10 - The individual {husband} was married before 14, this is not valid"
                    error_list.append(error_string)

        if famDict[famID].Wife != 'NA':  #check wife age
            wife = famDict[famID].Wife
            if (wife in indDict):
                age = 0
                if (famDict[famID].Marriage != 'NA'):
                    age = getAgeAt(indDict[wife].Birthday,
                                   famDict[famID].Marriage)
                if (age <= 14):
                    error_string = f"ERROR: US10 - The individual {wife} was married before 14, this is not valid"
                    error_list.append(error_string)

    return error_list
コード例 #9
0
def us24_unique_fam_by_spouses(file):
    indDict, famDict, errorList = parse_main(file)

    error_list = list()

    mDate = []
    hName = []
    wName = []

    for fam in famDict:
        mDate.append(famDict[fam].Marriage)
        hName.append(indDict[famDict[fam].Husband].Name)
        wName.append(indDict[famDict[fam].Wife].Name)

    if len(mDate) != len(set(mDate)):
        error_string = f"ERROR: US24 : husband, wife names or marriage date is occurring twice in Gedcom "
        error_list.append(error_string)

    if len(hName) != len(set(hName)):
        error_string = f"ERROR: US24 : husband, wife names or marriage date is occurring twice in Gedcom "
        error_list.append(error_string)

    if len(wName) != len(set(wName)):
        error_string = f"ERROR: US24 : husband, wife names or marriage date is occurring twice in Gedcom "
        error_list.append(error_string)

    return error_list
コード例 #10
0
def us05_marr_b4_death(file):
    indDict, famDict, errorList = parse_main(file)

    error_list = list()
    for famID in famDict:
        if famDict[famID].Marriage != "NA" and famDict[famID].Marriage != "":
            # Search through individuals to get husband and wife
            husband = None
            wife = None
            for iD in indDict:
                if indDict[iD].indID == famDict[famID].Husband:
                    husband = indDict[iD]
                    #print(husband)
                if indDict[iD].indID == famDict[famID].Wife:
                    wife = indDict[iD]
                    #print(wife)
            if wife.Death is not None and famDict[famID].Marriage > wife.Death:
                error_string = f"ERROR: FAMILY: US05: {famDict[famID].famID} : Marriage of wife:{wife.indID} occurs after death"
                error_list.append(error_string)
            if husband.Death is not None and famDict[
                    famID].Marriage > husband.Death:
                error_string = f"ERROR: FAMILY: US05: {famDict[famID].famID} : Marriage of husband:{husband.indID} occurs after death"
                error_list.append(error_string)

    return error_list
コード例 #11
0
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
コード例 #12
0
def us11_no_bigamy(file):
    error_list = list()
    #printTables(file)
    indDict,famDict = parse_main(file)
    totalSpouses = []
    numSpouse = 0
    
    for iD in indDict:
        an_Indi = indDict[iD]
        
        if an_Indi.Spouse == 'NA':
            continue
        else:
            for famID in famDict:
                id_Fam = famDict[famID]
                
                if (famID != an_Indi.Spouse and ((id_Fam.Husband and an_Indi.indID == id_Fam.Husband) 
                   or (id_Fam.Wife and an_Indi.indID == id_Fam.Wife))):
                    
                    if (famDict[an_Indi.Spouse].Marriage and id_Fam.Marriage):

                        if date_Check(famDict[an_Indi.Spouse].Marriage, id_Fam.Marriage):
                            marriage1 = famDict[an_Indi.Spouse]
                            marriage2 = id_Fam
                        else:
                            marriage1 = id_Fam
                            marriage2 = famDict[an_Indi.Spouse]


                        if(an_Indi.indID == marriage1.Husband):
                            id_Spouse = marriage1.Wife
                        else:
                            id_Spouse = marriage1.Husband

                        


                        if (marriage1.Divorce == 'NA'):                                         
                                                       

                            if(indDict[id_Spouse].Death == 'NA'):
                                error_string = f"ERROR: INDIVIDUAL: US11: {an_Indi.indID}:Married2 {marriage1.famID} & {marriage2.famID}"
                                error_list.append(error_string)                                    
                            
                            else:
                                if (date_Check(marriage2.Marriage, indDict[id_Spouse].Death)):
                                    error_string =f"ERROR: INDIVIDUAL: US11: {an_Indi.indID}:Married2 {marriage1.famID} & {marriage2.famID}"
                                    error_list.append(error_string)
                        else:
                            
                            if (date_Check(marriage2.Marriage, marriage1.Divorce)):
                                error_string = f"ERROR: INDIVIDUAL: US11: {an_Indi.indID}:Married2 {marriage1.famID} & {marriage2.famID}"
                                error_list.append(error_string)
            
            
                
    return error_list
コード例 #13
0
def us29_list_deceased(file):
    indDict, famDict, errorList = parse_main(file)

    error_list = list()

    for iD in indDict:
        if indDict[iD].Death != 'NA':
            error_string = f"ERROR: INDIVIDUAL: US29: The individual {indDict[iD].indID} is dead"
            error_list.append(error_string)

    return error_list
コード例 #14
0
def us22_unique_IDs(file):
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)
    error_list = list()
    errorList = list(errorList)
    errorList.sort(key=natural_keys)

    if errorList:
        error_string = f"ERROR: US22 : The ids:{errorList} are repeated"
        error_list.append(error_string)
    return error_list
コード例 #15
0
def us04_marr_b4_divo(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)

    for key, familyData in famDict.items():
        #print(f"key is {key} and data is {familyData}")
        if familyData.Divorce < familyData.Marriage:
            error_string = f"ERROR: FAMILY: US04: {familyData.famID}: Divorced {familyData.Divorce} before married {familyData.Marriage} "
            error_list.append(error_string)
    return error_list
コード例 #16
0
def us15_fewer_than_15_siblings(file):

    indDict, famDict, errorList = parse_main(file)
    error_list = list()
    for famID in famDict:

        if famDict[famID].multChild != 'NA':
            if len(famDict[famID].multChild) > 15:
                error_string = f"ERROR: FAMILY: US15: Family has more than 15 siblings {famDict[famID].famID}"
                error_list.append(error_string)
    return error_list
コード例 #17
0
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
コード例 #18
0
def us27_individual_ages(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)
    agedict = {}
    for iD in indDict:
        if indDict[iD].Age != 'NA':
            agedict[indDict[iD].indID] = indDict[iD].Age
    error_string = f"US27: The list of individuals along with their ages are:{agedict}"
    error_list.append(error_string)

    return error_list
コード例 #19
0
def us36_list_recent_deaths(file):
    error_list = list()
    #printTables(file)
    indDict,famDict,errorList = parse_main(file)
    for iD in indDict:
         if indDict[iD].Death != 'NA':
             diff=checkDiffInDaysCompTodays(indDict[iD].Death)
             if diff>=0 and diff<31:
                 error_string = f"ERROR: INDIVIDUAL: US36: The individual {indDict[iD].indID} died recently on {indDict[iD].Death}"
                 error_list.append(error_string)
    
    return error_list
コード例 #20
0
def us07_less_than_150years(file):
    indDict, famDict = parse_main(file)
    error_list = list()
    for iD in indDict:
        if indDict[iD].Age > 150:
            if indDict[iD].Alive == True:
                error_string = f"ERROR: INDIVIDUAL: US07: {indDict[iD].indID}: Birth Date OF Individual:{indDict[iD].Birthday} Age is more than 150 years"
                error_list.append(error_string)

            if indDict[iD].Alive == False:
                error_string = f"ERROR: INDIVIDUAL: US07: {indDict[iD].indID}: Birth Date OF Deceased Individual:{indDict[iD].Birthday} and Death Date OF Deceased Individual:{indDict[iD].Death} Age is more than 150 years"
                error_list.append(error_string)

    return error_list
コード例 #21
0
def us30_list_living_married(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)
    newindDict = dict()
    for key, indData in indDict.items():
        indId = key
        if indData.Alive == True and indData.Spouse != 'NA':
            newindDict[key] = indData
    #print('\n\nAfter filtering Individuals Information with condition living married people ----------------------->\n')
    error_string = f"US30: The list of individuals along with their ages are:{newindDict.keys()}"
    error_list.append(error_string)
    #printTables_indData(newindDict)
    return error_list
コード例 #22
0
def us06_divo_b4_death(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)

    for famID in famDict:

        an_Indi = indDict[famDict[famID].Husband]

        an_Indi1 = indDict[famDict[famID].Wife]

        id_Fam = famDict[famID]

        if id_Fam.Marriage == 'NA':
            error_string = f"ANOMALY: FAMILY: US06: {id_Fam.famID}: Marriage date is not Found ! "
            error_list.append(error_string)

        elif an_Indi.Birthday == 'NA':
            error_string = f"ANOMALY: FAMILY: US06: {an_Indi.indID}: Birthday not Found ! "
            error_list.append(error_string)

        elif an_Indi1.Birthday == 'NA':
            error_string = f"ANOMALY: FAMILY: US06: {an_Indi1.indID}: Birthday not Found ! "
            error_list.append(error_string)

        elif an_Indi.Death == 'NA':
            continue

        elif an_Indi1.Death == 'NA':
            continue

        elif id_Fam.Divorce == 'NA':
            #error_string = f"ANOMALY: INDIVIDUAL: US06: {an_Indi.indID}: Divorce not Found ! "
            #error_list.append(error_string)
            continue

        else:
            finalOutput = date_Check(id_Fam.Divorce, an_Indi.Death)
            #print(an_Indi.Death)
            #print(an_Indi1.Death)
            finalOutput1 = date_Check(id_Fam.Divorce, an_Indi1.Death)
            if finalOutput == False:
                error_string = f"ERROR: FAMILY: US06: {id_Fam.famID} : Divorce {id_Fam.Divorce} is after death {an_Indi.Death}"
                error_list.append(error_string)
            if finalOutput1 == False:
                error_string = f"ERROR: FAMILY: US06: {id_Fam.famID} : Divorce {id_Fam.Divorce} is after death {an_Indi1.Death}"
                error_list.append(error_string)

    return error_list
コード例 #23
0
def us32_list_multiple_births(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)

    birthList = []

    for iD in indDict:
        if indDict[iD].Birthday != 'NA':
            for indID in indDict:
                checkBirth = indDict[indID].Birthday
                if iD != indID:
                    if indDict[iD].Birthday == checkBirth:
                        error_string = f"ERROR: INDIVIDUAL: US32: The individual {indDict[iD].indID} has multiple births"
                        error_list.append(error_string)

    return error_list
コード例 #24
0
def us21_husb_male_wife_female(file):
    error_list = list()
    #printTables(file)
    indDict,famDict,errorList = parse_main(file)
    
    for key,familyData in famDict.items():
        husband_gender = indDict[familyData.Husband].Sex
        husband_name = indDict[familyData.Husband].Name
        wife_gender = indDict[familyData.Wife].Sex
        wife_name = indDict[familyData.Wife].Name
        if husband_gender != "M":
            error_string= f"ERROR: FAMILY: US21 : Husband Id:{familyData.Husband},name:{husband_name} is not male"
            error_list.append(error_string)
        if wife_gender !="F":
            error_string= f"ERROR: FAMILY: US21 : Wife Id:{familyData.Wife},name:{wife_name} is not female"
            error_list.append(error_string)
    return error_list
コード例 #25
0
def us35_list_recent_births(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)
    for iD in indDict:
        if indDict[iD].Birthday != 'NA':
            indBirthday = indDict[iD].Birthday

            todaysDate = date.today().strftime("%Y-%m-%d")

            indBCheck = datetime.strptime(indBirthday, "%Y-%m-%d")

            todaysCheck = datetime.strptime(todaysDate, "%Y-%m-%d")

            if (todaysCheck - indBCheck).days < 30:
                error_string = f"ERROR: INDIVIDUAL: US35: The individual {indDict[iD].indID} was born within the last 30 days"
                error_list.append(error_string)

    return error_list
コード例 #26
0
def us23_unique_name_and_birth(file):

    indDict, famDict, errorList = parse_main(file)
    error_list = list()
    indNames = []
    indBirthdates = []
    
    for iD in indDict:
        indNames.append(indDict[iD].Name)
        indBirthdates.append(indDict[iD].Birthday)
 
    if len(indNames) != len(set(indNames)):
        error_string = f"ERROR: INDIVIDUAL: US23: No more than one individual with the same name and birth date should appear in GEDCOM file"
        error_list.append(error_string)
    
    if len(indBirthdates) != len(set(indBirthdates)):
        error_string = f"ERROR: INDIVIDUAL: US23: No more than one individual with the same name and birth date should appear in GEDCOM file"
        error_list.append(error_string)
      
    return error_list
コード例 #27
0
def us03_birth_b4_death(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)

    for iD in indDict:
        an_Indi = indDict[iD]
        if an_Indi.Death == 'NA' and an_Indi.Birthday != 'NA':
            continue

        if an_Indi.Birthday == 'NA':
            error_string = f"ANOMALY: INDIVIDUAL: US03: {an_Indi.indID}: Birthdate not Found "
            error_list.append(error_string)

        else:
            finalOutput = date_Check(an_Indi.Birthday, an_Indi.Death)
            if finalOutput == False:
                error_string = f"ERROR: INDIVIDUAL: US03: {an_Indi.indID} : Died {an_Indi.Death} before born {an_Indi.Birthday} "
                error_list.append(error_string)

    return error_list
コード例 #28
0
def us28_order_sibilings_by_age(file):
    error_list = list()
    indDict, famDict, errorList = parse_main(file)
    for key, familyData in famDict.items():
        children = familyData.multChild
        id_age_dict = dict()
        for eachchild in children:
            child_id = eachchild
            age = indDict[child_id].Age
            id_age_dict[child_id] = age
        sorted_x = sorted(id_age_dict.items(),
                          key=operator.itemgetter(1),
                          reverse=True)
        keys = collections.OrderedDict(sorted_x).keys()
        familyData.multChild = keys
    famData = list(famDict.values())[0]
    multiChild = famData.multChild
    error_string = f"US28: The list of sibilings in sorting order according to their age are {list(multiChild)}"
    error_list.append(error_string)
    #print('\n\n After sorting sibilings in Descending order\n')
    #printTables_custom(indDict,famDict)
    return error_list
コード例 #29
0
def us18_sibilings_no_marriage(file):
    error_list = list()
    #printTables(file)
    indDict, famDict, errorList = parse_main(file)
    '''
    loop over family records
    a) for each of the family record, get all the children 
       => for each children, get the individual record's spouse
            => for each record get column Spouse and store it in variable
    '''
    for key, familyData in famDict.items():
        children = familyData.multChild
        for eachchild in children:
            child_id = eachchild
            spouse_id = indDict[child_id].Spouse
            siblings = children[children.index(child_id) + 1:]
            for eachsibiling in siblings:
                if (spouse_id != "NA" and indDict[eachsibiling].Spouse != "NA"
                    ) and spouse_id == indDict[eachsibiling].Spouse:
                    error_string = f"ERROR: FAMILY: US18 : Sibiings Id:{indDict[eachsibiling].indID},name:{indDict[eachsibiling].Name} and  Id:{indDict[child_id].indID},name:{indDict[child_id].Name} are married"
                    error_list.append(error_string)
    return error_list
コード例 #30
0
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