black format
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
|
||||
import logging
|
||||
import src.config as config
|
||||
import src.utils.string_utils as string_utils
|
||||
from src.constants.constants import Constants
|
||||
@@ -33,7 +33,7 @@ def fill_na_mapping(answer_dicts):
|
||||
|
||||
# Get existing AARETE_DERIVED_LOB values (if any)
|
||||
existing_lob_list = answer_dict.get("AARETE_DERIVED_LOB", "")
|
||||
|
||||
|
||||
if not string_utils.is_empty(existing_lob_list):
|
||||
for lob_val in existing_lob_list:
|
||||
if "|" in existing_lob_list:
|
||||
@@ -55,7 +55,8 @@ def fill_na_mapping(answer_dicts):
|
||||
"src/constants/mappings/crosswalk_program_lob.json",
|
||||
)
|
||||
if (
|
||||
not string_utils.is_empty(program_filled_value_list) and "N/A" not in program_filled_value_list
|
||||
not string_utils.is_empty(program_filled_value_list)
|
||||
and "N/A" not in program_filled_value_list
|
||||
):
|
||||
for program_lob_val in program_filled_value_list:
|
||||
if "|" in program_lob_val:
|
||||
@@ -64,10 +65,7 @@ def fill_na_mapping(answer_dicts):
|
||||
for v in program_lob_val.split("|")
|
||||
if v.strip() and v.strip() != "N/A"
|
||||
)
|
||||
elif (
|
||||
program_lob_val.strip()
|
||||
and program_lob_val.strip() != "N/A"
|
||||
):
|
||||
elif program_lob_val.strip() and program_lob_val.strip() != "N/A":
|
||||
program_lob_values = {program_lob_val.strip()}
|
||||
all_lob_values.update(program_lob_values)
|
||||
|
||||
@@ -91,16 +89,13 @@ def fill_na_mapping(answer_dicts):
|
||||
for v in product_filled_value_list.split("|")
|
||||
if v.strip() and v.strip() != "N/A"
|
||||
)
|
||||
elif (
|
||||
product_lob_val.strip()
|
||||
and product_lob_val.strip() != "N/A"
|
||||
):
|
||||
elif product_lob_val.strip() and product_lob_val.strip() != "N/A":
|
||||
product_lob_values = {product_lob_val.strip()}
|
||||
all_lob_values.update(product_lob_values)
|
||||
|
||||
# Set the merged, deduplicated value
|
||||
if all_lob_values:
|
||||
answer_dict["AARETE_DERIVED_LOB"] = "|".join(sorted(all_lob_values))
|
||||
answer_dict["AARETE_DERIVED_LOB"] = sorted(all_lob_values)
|
||||
# Set relationship flags if values came from PROGRAM or PRODUCT
|
||||
# Only set if field is empty or "N/A" (preserve LLM-determined Inclusive/Exclusive)
|
||||
if program_lob_values:
|
||||
@@ -145,9 +140,9 @@ def get_crosswalk_fields(answer_dicts: list, constants: Constants):
|
||||
to_field_value = answer_dict.get(to_field_name)
|
||||
from_field_value = answer_dict.get(from_field_name)
|
||||
# If from_field_value is populated and to_field_value is not populated, perform mapping
|
||||
if not string_utils.is_empty(
|
||||
from_field_value
|
||||
) and (string_utils.is_empty(to_field_value) or "N/A" in to_field_value):
|
||||
if not string_utils.is_empty(from_field_value) and (
|
||||
string_utils.is_empty(to_field_value) or "N/A" in to_field_value
|
||||
):
|
||||
if isinstance(from_field_value, list):
|
||||
from_field_value_list = from_field_value
|
||||
else:
|
||||
@@ -176,4 +171,8 @@ def get_crosswalk_fields(answer_dicts: list, constants: Constants):
|
||||
)
|
||||
)
|
||||
answer_dict[to_field_name] = to_field_answer_list
|
||||
# update from field value to list if not already
|
||||
if not isinstance(from_field_value, list):
|
||||
answer_dict[from_field_name] = from_field_value_list
|
||||
|
||||
return answer_dicts
|
||||
|
||||
Reference in New Issue
Block a user