Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
203 changes: 0 additions & 203 deletions GMiguel/Project02.py

This file was deleted.

28 changes: 24 additions & 4 deletions GMiguel/User02_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
import Project02
import user02
import pandas as pd
import sys
import unittest
sys.path.append("C:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\seeds")
sys.path.append("C:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\GMiguel")
sys.path.append("c:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\src")
import user02


class Testuser02(unittest.TestCase):
#all marriages after birth

def test01(self):
x = ""
s = ""
self.assertEquals(s, user02.user02("seeds/test1.ged"))

def test02(self):
s = ""
self.assertEquals(s, user02.user02("seeds/test2.ged"))

def test03(self):
s = ""
self.assertEquals(s, user02.user02("seeds/test3.ged"))
def test04(self):
s = ""
self.assertEquals(s, user02.user02("seeds/test4.ged"))
def test05(self):
s = ""
self.assertEquals(s, user02.user02("seeds/test5.ged"))

if __name__ == '__main__':
unittest.main()
Empty file removed GMiguel/sprint1.2
Empty file.
45 changes: 45 additions & 0 deletions GMiguel/us13test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
'''
Author: Samantha Inneo
Sprint: Sprint 1
Use Case: Birth dates of siblings should be more than 8 months apart or less than 2 days apart
(twins may be born one day apart, e.g. 11:59 PM and 12:02 AM the following calendar day)
'''
import sys
import copy
sys.path.append("C:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\src")
import Project02
sys.path.append("C:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\seeds")
import pandas as pd
import datetime

def siblingsAgeGap(gedcom_name):
# I need to gather all the siblings of each family
# check if their birthdays are more than 8 months apart
# check if their birthdays are less than 2 days apart
#return true if they are valid, false if they are not
eight_months = 240
two_days = 2

individuals = Project02.createIndividualsDataFrame(gedcom_name)
families = Project02.createFamiliesDataFrame(gedcom_name)

child = []
children = copy.deepcopy(families[["Children"]])
indi = copy.deepcopy(individuals[["ID", "Birthday"]])
for index, row in children.iterrows():
#indiv = copy.deepcopy(individuals[["Name", "Birthday", "Dead"]])
if len(row["Children"]) > 1:
for i in row["Children"]:
lst = row["Children"]
for j in lst:
for k, rows in indi.iterrows():
if lst[j] == rows[individuals["ID"]]:
child.append(rows[individuals["Birthday"]])
for m in range(len(child)):
child2 = child[:m] + child[m:]
for l in range(len(child2)):
if ((pd.to_datetime(child[k]) - pd.to_datetime(child2[l])) > two_days) and ((pd.to_datetime(child[k]) - pd.to_datetime(child[l])) < eight_months ):
print("invalid: sibling birthdays")


siblingsAgeGap("seeds/seed.ged")
34 changes: 24 additions & 10 deletions GMiguel/user02.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'''
Author: Grace Miguel
I pledge my honor that I've abided by the the Stevens Honor Code.
'''
import sys
sys.path.append("c:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\src")
sys.path.append("C:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\testFiles")
sys.path.append("C:\\Users\\Stevens User\\Documents\\GitHub\\Team-4-Code\\seeds")
import pandas as pd
import Project02
from datetime import datetime
Expand All @@ -11,22 +15,32 @@ def user02(gedcom_file):
individuals = Project02.createIndividualsDataFrame(gedcom_file)
families = Project02.createFamiliesDataFrame(gedcom_file)
indiv = copy.deepcopy(individuals[["Name", "Birthday"]]) #makes a copy of original inviduals dataframe
print(indiv)
fam = copy.deepcopy(families[["Wife Name", "Husband Name", "Married"]])
print(fam)

lst = []
for i, row in indiv.iterrows():
for k, rows in fam.iterrows():
if row["Name"] == rows["Wife Name"] or row["Name"] == rows["Husband Name"]:
if row["Name"] == rows["Wife Name"]:
if type(rows["Married"]) == float and pd.isna(rows["Married"]):
print("no marriage date")
elif pd.to_datetime(row["Birthday"]) < pd.to_datetime(rows["Married"]:
print("Valid")
pass
elif pd.to_datetime(row["Birthday"]) < pd.to_datetime(rows["Married"]):
pass
else:
print("Invalid")
lst.append(row["Wife Name"])

if row["Name"] == rows["Husband Name"]:
if type(rows["Married"]) == float and pd.isna(rows["Married"]):
pass
elif pd.to_datetime(row["Birthday"]) < pd.to_datetime(rows["Married"]):
pass
else:
lst.append(row["Husband Name"])

if len(lst) > 0:
return "The following people have births after marriage" + str(lst)
else:
return ""

#for k, row in fam.iterrows():


user02("testFiles/test6.ged")

Loading