Update other lists

This commit is contained in:
Katon Minhas
2026-02-09 18:05:58 -05:00
parent 9b0a344b13
commit ca773bf4b9
@@ -35,8 +35,10 @@ def run_provider_info_fields(
)
relevant_pages = get_relevant_pages(all_tins, all_npis, text_dict, filename)
print("relevant_pages: ", relevant_pages)
prov_info_json = get_prov_info_json(relevant_pages, text_dict, filename, payer_name)
print("prov_info_json: ", prov_info_json)
# Create columns
one_to_one_results["PROV_INFO_JSON"] = prov_info_json
@@ -248,7 +250,7 @@ def deunknown_and_deduplicate(
other_npis = [
v for v in other_npis if v not in group_npis and not string_utils.is_empty(v)
]
group_names = list(dict.fromkeys(group_names))
other_names = list(dict.fromkeys(other_names))
other_names = [
@@ -275,6 +277,7 @@ def merge_provider_info_with_one_to_one(one_to_one_results: dict, filename: str)
other_tins, other_npis, other_names = [], [], []
provider_name = one_to_one_results.get("PROVIDER_NAME") # Can be List or string
print("provider_name (1:1): ", provider_name)
# Normalize provider_name to list: if string, convert to list to avoid character splitting
if isinstance(provider_name, str):
@@ -315,9 +318,12 @@ def merge_provider_info_with_one_to_one(one_to_one_results: dict, filename: str)
group_names.add(name)
else:
provider_dict["IS_GROUP"] = "N"
other_tins.extend(tins)
other_npis.extend(npis)
other_names.extend(names)
for tin in tins:
other_tins.append(tin)
for npi in npis:
other_npis.append(npi)
for name in names:
other_names.append(name)
# If provider_name is not null and no match was found, add a new record
if provider_name and not found_match:
@@ -440,7 +446,7 @@ def flag_missed_prov_info(page_text, providers, page_num, filename):
missed_npis = [npi for npi in regex_npis if npi not in llm_found_npis]
if missed_tins or missed_npis:
# WARN ONLY if there are missed identifiers
logging.warning(
logging.debug(
f"LLM missed identifiers on page {page_num} of {filename}. Missed TINs: {missed_tins}, Missed NPIs: {missed_npis}"
)