Merged in bugfix/fill_claim_type (pull request #874)

Bugfix/fill claim type

* Handle if AARETE_DERIVED_CLAIM_TYPE_CD comes in as list

* add unit tests

* Black format


Approved-by: Siddhant Medar
This commit is contained in:
Katon Minhas
2026-02-09 19:12:15 +00:00
parent fc178587c8
commit 47472c0f32
2 changed files with 219 additions and 2 deletions
@@ -880,8 +880,15 @@ def fill_claim_type_from_title(df: pd.DataFrame) -> pd.DataFrame:
file_mask = df["FILE_NAME"] == file_name
file_rows = df.loc[file_mask, "AARETE_DERIVED_CLAIM_TYPE_CD"]
# Get non-empty values for this file
non_empty_values = [v for v in file_rows if not string_utils.is_empty(v)]
# Get non-empty values for this file, normalizing lists to strings
non_empty_values = []
for v in file_rows:
if not string_utils.is_empty(v):
# Convert lists to their first element if present
if isinstance(v, list) and len(v) > 0:
non_empty_values.append(v[0])
elif not isinstance(v, list):
non_empty_values.append(v)
if non_empty_values:
# Use mode (most common value) to fill empty rows in this file