Merged in bugfix/provider_info_tracker_issues (pull request #706)
Bugfix/provider info tracker issues to main * testing TIN AND NPI * print statements added * updated condition for header and footer tin and npi check * tin testing for hyphen format * removed print statements * updated comments Approved-by: Katon Minhas
This commit is contained in:
committed by
Katon Minhas
parent
ffb4e07c89
commit
a9318cf1d2
@@ -658,16 +658,16 @@ def run_provider_info_fields(
|
||||
}
|
||||
]
|
||||
else:
|
||||
# Find pages with TINs or NPIs
|
||||
# Identify relevant pages containing either NPIs or TINs (with or without hyphen formatting, e.g., 68-0640053)
|
||||
relevant_pages = [
|
||||
page_num
|
||||
for page_num, page_text in text_dict.items()
|
||||
if any(tin in page_text for tin in all_tins)
|
||||
if any(tin in page_text or (tin[:2] + "-" + tin[2:]) in page_text for tin in all_tins)
|
||||
or any(npi in page_text for npi in all_npis)
|
||||
]
|
||||
|
||||
# Stopgap for when the TIN is written in the header or footer of every page (or nearly every page)
|
||||
if len(relevant_pages) >= len(text_dict) - 1 and len(all_tins) == 1:
|
||||
if len(relevant_pages) >= len(text_dict) - 1 and (len(all_tins) == 1 or len(all_tins) == 0) and (len(all_npis) == 1 or len(all_npis) == 0):
|
||||
relevant_pages = [relevant_pages[0]]
|
||||
|
||||
# Process each page separately and combine results
|
||||
@@ -678,7 +678,6 @@ def run_provider_info_fields(
|
||||
|
||||
# Clean and standardize results
|
||||
cleaned_provider_info = clean_provider_info(combined_provider_info)
|
||||
|
||||
# Deduplicate providers based on TIN and NPI
|
||||
deduplicated_provider_info = deduplicate_providers(cleaned_provider_info)
|
||||
|
||||
@@ -697,7 +696,6 @@ def run_provider_info_fields(
|
||||
one_to_one_results = merge_provider_info(
|
||||
one_to_one_results, deduplicated_provider_info
|
||||
) # Add Group TIN
|
||||
|
||||
# What if the TIN/NPI regexes don't find anything? Add PROV_GROUP_NAME_FULL to full context
|
||||
if (
|
||||
one_to_one_results.get("PROV_OTHER_NAME_FULL") == "NO_IDENTIFIERS_FOUND"
|
||||
|
||||
Reference in New Issue
Block a user