-
Notifications
You must be signed in to change notification settings - Fork 0
/
US33_listOrphans.py
34 lines (27 loc) · 1018 Bytes
/
US33_listOrphans.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
US33
"""
# import sys
from all_db_operations import *
from print_data import *
connection=MongoClient('localhost',27017)
db=connection['GEDCOMDB']
def getPeopleById(PersonId):
results_for_people=get_people()
for people in results_for_people:
if people['ID'] == PersonId:
return people
def US33_listOrphans():
userStoryName('US33- List of Orphan Children')
output('\t' + 'FAMILY ID' + '\t' + 'INDIVIDUAL ID' + '\t\t' + 'NAME')
results_for_family = get_family()
for family in results_for_family:
if 'CHILDREN' not in family:
continue
husband = getPeopleById(family['HUSBAND'])
wife = getPeopleById(family['WIFE'])
if 'deathDate' in husband and 'deathDate' in wife:
for child in family['CHILDREN']:
child_name = getPeopleById(child)
output('\t' + family['FAMID'] + '\t\t' + child + '\t\t\t' + child_name["NAME"][0] + " " + (child_name["NAME"][1]).strip("/"))
US33_listOrphans()