-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUS03_birth_before_death.py
More file actions
28 lines (23 loc) · 895 Bytes
/
US03_birth_before_death.py
File metadata and controls
28 lines (23 loc) · 895 Bytes
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
"""
Sprint 1
Developed By : Abhilash Ugaonkar
User Story: US-03 Birth Before Date
"""
from dateutil.relativedelta import relativedelta
from print_data import *
def birth_before_death():
userStoryName('US03')
return_flag=False
results_for_people = get_people()
for res in results_for_people:
if "deathDate" in res and "birthday" in res and res["deathDate"] is not None and res["birthday"] is not None:
death_date= datetime.strptime(res["deathDate"],"%Y-%m-%d %H:%M:%S")
birthday= datetime.strptime(res["birthday"],"%Y-%m-%d %H:%M:%S")
difference_in_years = relativedelta(death_date, birthday).years
difference= death_date.year - birthday.year
if(difference > 0):
return_flag=True
else:
return_flag=False
message = "Birth Date is invalid for " + res["ID"] + " Please validate the birth Date."
save_invalid_people_for_print(res["ID"], "US03", message)