in tax-processing-pipeline-python/tax_pipeline.py [0:0]
def get_personal_info(forms: List[Dict]) -> Tuple[str, str, str]:
"""
Extract Name, SSN, and address from forms.
Checks each form to see if it has the information.
"""
# pylint: disable=line-too-long
full_name, ssn, address = "", "", ""
for form in forms:
if full_name and ssn and address:
break
if not form:
continue
if not full_name:
full_name = form.get("EmployeeName", "") or form.get("RecipientName", "")
if not ssn:
ssn = form.get("SSN", "") or form.get("RecipientTIN", "")
if not address:
# Get Address as a single string
address = (
form.get("EmployeeAddress", "")
or form.get("RecipientAddress", "")
or f'{form.get("RecipientAddressLine1", "")} {form.get("RecipientAddressLine2", "")}'
or f'{form.get("RecipientStreetAddress", "")} {form.get("RecipientCityStateCountry", "")}'
)
return full_name, ssn, address