Skip to content

Commit 43ed16a

Browse files
committed
Added Process logic and Updated Values
Updated the ethnicity and race question to give a clear distinction. Also, updated the gender_value method to display DOB information too. Added more logic to the process logic for smaller list.
1 parent d747c0e commit 43ed16a

File tree

3 files changed

+56
-32
lines changed

3 files changed

+56
-32
lines changed

core/process.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -475,10 +475,7 @@ def process_self(self, _list: list) -> list:
475475
_list.insert(2, _list[1][6:])
476476
_list[1] = _list[1][:6]
477477
new_list.append(_list[0])
478-
else:
479-
new_list.append(_list[0])
480-
481-
if len(_list) == 4:
478+
elif len(_list) == 4:
482479
if len(_list[1]) == 5:
483480
new_list.append(_list[1][0])
484481
new_list.append(f"{_list[1][1:3]} Years; {_list[1][3:5]} Months")
@@ -538,7 +535,6 @@ def process_self(self, _list: list) -> list:
538535
new_list.append(f"{_list[3][9:11]} Years {_list[3][11:13]} Months")
539536

540537
elif len(_list) == 5:
541-
542538
if len(_list[1]) == 5:
543539
new_list.append(_list[1][0])
544540
new_list.append(f"{_list[1][1:3]} Years; {_list[1][3:5]} Months")
@@ -573,6 +569,34 @@ def process_self(self, _list: list) -> list:
573569
new_list.append(_list[3][-1])
574570
new_list.append(f"{_list[4][:2]} Years; {_list[4][2:4]} Months")
575571

572+
elif len(_list) == 6:
573+
new_list.append(_list[0])
574+
575+
if len(_list[1]) == 5:
576+
new_list.append(_list[1][0])
577+
new_list.append(f"{_list[1][1:3]} Years; {_list[1][3:]} Months")
578+
new_list.append('Not provided')
579+
580+
if len(_list[2]) == 1:
581+
new_list.append(_list[2])
582+
583+
if len(_list[3]) == 14:
584+
new_list.append(_list[3][1:7])
585+
new_list.append(_list[3][0])
586+
new_list.append(_list[3][7])
587+
588+
if len(_list[4]) == 8:
589+
new_list.append(_list[4][-2])
590+
new_list.append(_list[4][-1])
591+
new_list.append(_list[5][-1])
592+
593+
if len(_list[5]) == 5:
594+
new_list.append(_list[4][:6])
595+
new_list.append(f"{_list[5][:2]} Years; {_list[5][2:4]} Months")
596+
597+
else:
598+
new_list.append(_list[0])
599+
576600

577601
for idx in range(len(new_list)):
578602
for key, value in syntax.items():

core/values.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -252,37 +252,37 @@ def ethnicity_race_value(self, _list: list, key: str) -> str:
252252
target = _list[-1]
253253

254254
hispanic_ = {
255-
"Ethnicity=R;Race=S\\": "Hispanic or Latino. White.",
256-
"Ethnicity=R;Race=T\\": "Hispanic or Latino. American Indian or Alaska Native.",
257-
"Ethnicity=R;Race=Q\\": "Hispanic or Latino. Black or African American.",
258-
"Ethnicity=R;Race=U\\": "Hispanic or Latino. Asian.",
259-
"Ethnicity=R;Race=V\\": "Hispanic or Latino. Native Hawaiian or Other Pacific Islander.",
260-
"Ethnicity=R;Race=QS\\": "Hispanic or Latino. Black or African American or White.",
261-
"Ethnicity=R;Race=US\\": "Hispanic or Latino. Asian or White.",
262-
"Ethnicity=R;Race=UV\\": "Hispanic or Latino. Asian, Native Hawaiian or Other Pacific Islander.",
263-
"Ethnicity=R;Race=TS\\": "Hispanic or Latino. American Indian, Alaska Native or White.",
264-
"Ethnicity=R;Race=ST\\": "Hispanic or Latino. American Indian, Alaska Native or White.",
265-
"Ethnicity=R;Race=UST\\": "Hispanic or Latino. Asian, White, American Indian or Alaska Native.",
255+
"Ethnicity=R;Race=S\\": "Ethnicity=Hispanic or Latino. Race=White.",
256+
"Ethnicity=R;Race=T\\": "Ethnicity=Hispanic or Latino. Race=American Indian or White.",
257+
"Ethnicity=R;Race=Q\\": "Ethnicity=Hispanic or Latino. Race=Black or African American.",
258+
"Ethnicity=R;Race=U\\": "Ethnicity=Hispanic or Latino. Race=Asian.",
259+
"Ethnicity=R;Race=V\\": "Ethnicity=Hispanic or Latino. Race=Native Hawaiian or Other Pacific Islander.",
260+
"Ethnicity=R;Race=QS\\": "Ethnicity=Hispanic or Latino. Race=Black or African American or White.",
261+
"Ethnicity=R;Race=US\\": "Ethnicity=Hispanic or Latino. Race=Asian or White.",
262+
"Ethnicity=R;Race=UV\\": "Ethnicity=Hispanic or Latino. Race=Asian, Native Hawaiian or Other Pacific Islander.",
263+
"Ethnicity=R;Race=TS\\": "Ethnicity=Hispanic or Latino. Race=American Indian, Alaska Native or White.",
264+
"Ethnicity=R;Race=ST\\": "Ethnicity=Hispanic or Latino. Race=American Indian, Alaska Native or White.",
265+
"Ethnicity=R;Race=UST\\": "Ethnicity=Hispanic or Latino. Race=Asian, White, American Indian or Alaska Native.",
266266
}
267267

268268
not_hispanic_ = {
269-
"Ethnicity=W\\": "Not Hispanic or Latino. Ethnicity=N/A.",
270-
"Ethnicity=W;Race=S\\": "Not Hispanic or Latino. White.",
271-
"Ethnicity=W;Race=T\\": "Not Hispanic or Latino. American Indian or Alaska Native.",
272-
"Ethnicity=W;Race=Q\\": "Not Hispanic or Latino. Black or African American.",
273-
"Ethnicity=W;Race=U\\": "Not Hispanic or Latino. Asian.",
274-
"Ethnicity=W;Race=V\\": "Not Hispanic or Latino. Native Hawaiian or Other Pacific Islander.",
275-
"Ethnicity=W;Race=QS\\": "Not Hispanic or Latino. Black, African American or White.",
276-
"Ethnicity=W;Race=US\\": "Not Hispanic or Latino. Asian or White.",
277-
"Ethnicity=W;Race=UV\\": "Not Hispanic or Latino. Asian, Native Hawaiian or Other Pacific Islander.",
278-
"Ethnicity=W;Race=TS\\": "Not Hispanic or Latino. American Indian, Alaska Native or White.",
279-
"Ethnicity=W;Race=ST\\": "Not Hispanic or Latino. American Indian, Alaska Native or White.",
280-
"Ethnicity=W;Race=UST\\": "Not Hispanic or Latino. Asian, White, American Indian or Alaska Native.",
269+
"Ethnicity=W\\": "Ethncity=Non Hispanic or Latino. Ethnicity=N/A.",
270+
"Ethnicity=W;Race=S\\": "Ethncity=Non Hispanic or Latino. Race=White.",
271+
"Ethnicity=W;Race=T\\": "Ethncity=Non Hispanic or Latino. Race=American Indian or White.",
272+
"Ethnicity=W;Race=Q\\": "Ethncity=Non Hispanic or Latino. Race=Black or African American.",
273+
"Ethnicity=W;Race=U\\": "Ethncity=Non Hispanic or Latino. Race=Asian.",
274+
"Ethnicity=W;Race=V\\": "Ethncity=Non Hispanic or Latino. Native Hawaiian or Other Pacific Islander.",
275+
"Ethnicity=W;Race=QS\\": "Ethncity=Non Hispanic or Latino. Black, African American or White.",
276+
"Ethnicity=W;Race=US\\": "Ethncity=Non Hispanic or Latino. Race=Asian or White.",
277+
"Ethnicity=W;Race=UV\\": "Ethncity=Non Hispanic or Latino. Race=Asian, Native Hawaiian or Other Pacific Islander.",
278+
"Ethnicity=W;Race=TS\\": "Ethncity=Non Hispanic or Latino. Race=American Indian, Alaska Native or White.",
279+
"Ethnicity=W;Race=ST\\": "Ethncity=Non Hispanic or Latino. Race=American Indian, Alaska Native or White.",
280+
"Ethnicity=W;Race=UST\\": "Ethncity=Non Hispanic or Latino. Race=Asian, White, American Indian or Alaska Native.",
281281
}
282282

283283
other_ = {
284-
"Ethnicity=\\": "Gender=N/A. Ethnicity=N/A.",
285-
"Ethnicity=R\\": "Hispanic or Latino. Ethnicity=N/A.",
284+
"Ethnicity=\\": "Ethnicity=N/A. Race=N/A.",
285+
"Ethnicity=R\\": "Ethnicity=Hispanic or Latino. Race=N/A.",
286286
}
287287

288288
dictionaries = [hispanic_, not_hispanic_, other_]
@@ -331,7 +331,7 @@ def gender_value(self, _list: list, key: str) -> str:
331331

332332
for key, value in gender_.items():
333333
if key == target:
334-
return value
334+
return f'DOB: {_list[2][:4]}-{_list[2][4:6]}-{_list[2][6:]} {value}'
335335

336336
def extra_value(self, _list: list, key: str) -> str:
337337

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def run(file: str, fileName: str) -> Union[int, int]:
164164
domestic, foreign = run(file, fileName)
165165

166166
# file, fileName = find_spe_file()
167-
# domestic, foreign = run_target(file, fileName, 'foreign', 0)
167+
# domestic, foreign = run_target(file, fileName, 'domestic', 11)
168168

169169
# filePath_list, fileName_list = find_spe_folder_files()
170170
# for idx in range(len(filePath_list)):

0 commit comments

Comments
 (0)