예제 #1
0
def birthdayBeforeCurrentDate_us01(birthday):
    global outputValues
    outputValues = OutputValues("ERROR", "INDIVIDUAL", "US01",
                                "Birth day " + birthday + " is after today")
    if birthday == 'NA':
        outputValues.description = "Birthdate is not specified"
        return False
    today = date.today().strftime("%Y-%m-%d")
    return checkDate(birthday, today)
예제 #2
0
def checkMarriageBeforeDivorce_us04(family):
    global outputValues
    outputValues = OutputValues(
        "ERROR", "family", "US04",
        "marriage " + family.marriage + " is after divorce " + family.divorce)
    if family.marriage == 'NA':
        outputValues.description = "marriage not specified"
        return False
    if family.divorce == 'NA':
        return True
    return checkDate(family.marriage, family.divorce)
def birthBeforeDeath_us03(individual):
    global outputValues
    outputValues = OutputValues(
        "ERROR", "INDIVIDUAL", "US03", "death " + individual.death +
        " is before birthdate " + individual.birthday)
    if individual.death == 'NA' and individual.birthday != 'NA':
        return True
    if individual.birthday == 'NA':
        outputValues.description = "birthdate not specified"
        return False
    return checkDate(individual.birthday, individual.death)
def birthBeforeMarriage_us02(individual):
    global outputValues
    outputValues = OutputValues(
        "ERROR", "INDIVIDUAL", "US02", "marriage " + individual.marriage +
        " is before birthdate " + individual.birthday)
    if individual.marriage == 'NA' and individual.birthday != 'NA':
        return True
    if individual.birthday == 'NA':
        outputValues.description = "birthdate not specified"
        return False
    return checkDate(individual.birthday, individual.marriage)
def checkBirthBeforeMarriageOfParents_us08(family, individual):
    global outputValues
    outputValues = OutputValues(
        "ERROR", "family", "US08", "birth of child " + individual.birthday +
        " is before marriage " + family.marriage + " of parents ")
    if family.marriage == 'NA':
        outputValues.description = "marriage date not specified"
        return False
    if individual.birthday == 'NA':
        outputValues.description = "birth date not specified"
        return False
    return checkDate(family.marriage, individual.birthday)
예제 #6
0
def checkMarriageBeforeDeath_us05(family, individual):
    global outputValues
    outputValues = OutputValues(
        "ERROR", "family", "US05", "marriage " + family.marriage +
        " is after death " + individual.death + " of individual ")
    if family.marriage == 'NA':
        outputValues.description = "marriage date not specified"
        return False
    if individual.birthday == 'NA':
        outputValues.description = "birth date not specified"
        return False
    if individual.death == 'NA':
        return True
    return checkDate(family.marriage, individual.death)
def checkBigamy_us11(individual, individualList, familyList):
    """ US11 : No bigamy """
    global outputValues
    error = False
    if (individual.spouseFamily != 'NA'):  # Exclude the un-married people
        for fam in familyList:
            family = familyList[fam]
            # Enter only if the person is a spouse in any other family apart from the one he/ she is currently a spouse in.
            if (fam != individual.spouseFamily and
                ((family.husband and individual.ID == family.husband) or
                 (family.wife and individual.ID == family.wife))):
                if (familyList[individual.spouseFamily].marriage and
                        family.marriage):  # If both marriage dates available
                    firstMarriage, secondMarriage = determineMarriageOrder(
                        familyList[individual.spouseFamily], family)
                    spouseID = determineSpouse(individual, firstMarriage)
                    outputValues = OutputValues(
                        "ERROR", "INDIVIDUAL", "US11",
                        "Bigamy has been detected", firstMarriage.ID + "," +
                        secondMarriage.ID + " - " + individual.ID)
                    # Check if the person got married 2nd time even when he/ she has not yet been divorced from the 1st marriage
                    if (firstMarriage.divorce == 'NA'):
                        # Then check if the spouse from the 1st marriage is still alive
                        if (isAlive(individualList[spouseID])):
                            error = True
                        # Otherwise check if the spouse died after the second marrriage
                        else:
                            if (checkDate(secondMarriage.marriage,
                                          individualList[spouseID].death)):
                                error = True
                    else:
                        # If the person got divorced from 1st marriage after marrying the 2nd time
                        if (checkDate(secondMarriage.marriage,
                                      firstMarriage.divorce)):
                            error = True
    return error
def checkBirthNotAfter9MonthsDivorce_us08(family, individual):
    global outputValues
    outputValues = OutputValues(
        "ERROR", "family", "US08", "birth of child " + individual.birthday +
        " is after nine months of divorce " + family.divorce + " of parents ")
    if family.marriage == 'NA':
        outputValues.description = "marriage date not specified"
        return False
    if individual.birthday == 'NA':
        outputValues.description = "birth date not specified"
        return False
    if family.divorce == 'NA':
        return True
    if checkDate(individual.birthday, family.divorce) is True:
        return True
    return dates_within(family.divorce, individual.birthday, 9, 'months')
def determineMarriageOrder(marriage1, marriage2):
    """ Not a user story """
    if checkDate(marriage1.marriage, marriage2.marriage):
        return marriage1, marriage2
    else:
        return marriage2, marriage1
예제 #10
0
def divorceBeforCurrentDate_us01(divorce):
    global outputValues
    outputValues = OutputValues("ERROR", "INDIVIDUAL", "US01",
                                "Divorce day " + divorce + " is after today")
    today = date.today().strftime("%Y-%m-%d")
    return checkDate(divorce, today)
예제 #11
0
def marriageBeforCurrentDate_us01(marriage):
    global outputValues
    outputValues = OutputValues("ERROR", "INDIVIDUAL", "US01",
                                "Marriage day " + marriage + " is after today")
    today = date.today().strftime("%Y-%m-%d")
    return checkDate(marriage, today)
예제 #12
0
def deathBeforCurrentDate_us01(death):
    global outputValues
    outputValues = OutputValues("ERROR", "INDIVIDUAL", "US01",
                                "Death day " + death + " is after today")
    today = date.today().strftime("%Y-%m-%d")
    return checkDate(death, today)