Merged in feature/daip2-101 (pull request #399)

Feature/daip2 101

* missing group tin fixed

* use tin prompt in full context when N/A

* fixed N/A TIN and applied same to NPI

* null tin fixed

* Merged main into feature/daip2-101

* if PROV_GROUP_TIN is still N/A, pick first value from tin_other

* Merge branch 'feature/daip2-101' of https://bitbucket.org/aarete/doczy.ai into feature/daip2-101
pulled latest changes from main


Approved-by: Katon Minhas
This commit is contained in:
Mayank Aamseek
2025-02-17 19:43:55 +00:00
committed by Katon Minhas
parent b0c1730a0a
commit 722d8aa14a
2 changed files with 11 additions and 2 deletions
@@ -19,6 +19,11 @@ def run_regex_fields(one_to_one_fields: FieldSet,
# One to One TIN Fields
tin_answers = get_tin_fields(filename, text_dict, top_sheet_dict)
if tin_answers['PROV_GROUP_TIN_SIGNATORY'] != 'N/A':
if tin_answers['PROV_TIN_OTHER'] != 'N/A':
tin_answers['PROV_TIN_OTHER'] = tin_answers['PROV_GROUP_TIN_SIGNATORY'] + ', ' + tin_answers['PROV_TIN_OTHER']
else:
tin_answers['PROV_TIN_OTHER'] = tin_answers['PROV_GROUP_TIN_SIGNATORY']
tin_answers = {k:v for k, v in tin_answers.items() if k in ['PROV_GROUP_TIN', 'PROV_TIN_OTHER']}
tin_answers['PROV_GROUP_TIN'] = str(tin_answers['PROV_GROUP_TIN']).replace("-","")
tin_answers['PROV_TIN_OTHER'] = str(tin_answers['PROV_TIN_OTHER']).replace("-","")
+6 -2
View File
@@ -752,10 +752,14 @@ def clean_tin_npi_other(final_df: pd.DataFrame) -> pd.DataFrame:
pd.DataFrame: The cleaned DataFrame with square brackets removed from the specified columns.
"""
if "PROV_TIN_OTHER" in final_df and "PROV_GROUP_TIN" in final_df:
final_df["PROV_TIN_OTHER"] = final_df.apply(lambda row: row.PROV_TIN_OTHER.replace(row.PROV_GROUP_TIN+', ','').replace(row.PROV_GROUP_TIN,''), axis=1)
# if PROV_GROUP_TIN is still N/A, pick first value from tin_other
final_df["PROV_GROUP_TIN"] = final_df.apply(lambda row: row.PROV_TIN_OTHER[:9] if row.PROV_GROUP_TIN == 'N/A' and len(row.PROV_TIN_OTHER) >= 9 else row.PROV_GROUP_TIN, axis=1)
final_df["PROV_TIN_OTHER"] = final_df.apply(lambda row: row.PROV_TIN_OTHER.replace(row.PROV_GROUP_TIN+', ','').replace(', '+row.PROV_GROUP_TIN,'').replace(row.PROV_GROUP_TIN,''), axis=1)
if "PROV_NPI_OTHER" in final_df and "PROV_GROUP_NPI" in final_df:
final_df["PROV_NPI_OTHER"] = final_df.apply(lambda row: row.PROV_NPI_OTHER.replace(row.PROV_GROUP_NPI+', ','').replace(row.PROV_GROUP_NPI,''), axis=1)
# if PROV_GROUP_NPI is still N/A, pick first value from npi_other
final_df["PROV_GROUP_NPI"] = final_df.apply(lambda row: row.PROV_NPI_OTHER[:10] if row.PROV_GROUP_NPI == 'N/A' and len(row.PROV_NPI_OTHER) >= 10 else row.PROV_GROUP_NPI, axis=1)
final_df["PROV_NPI_OTHER"] = final_df.apply(lambda row: row.PROV_NPI_OTHER.replace(row.PROV_GROUP_NPI+', ','').replace(', '+row.PROV_GROUP_NPI,'').replace(row.PROV_GROUP_NPI,''), axis=1)
if "PROV_TIN_OTHER" in final_df:
final_df["PROV_TIN_OTHER"] = (