Strip out dynamic postprocessing

This commit is contained in:
Katon Minhas
2026-02-03 01:38:49 -05:00
parent 03fda6013b
commit e8e8f1ba5a
5 changed files with 1 additions and 317 deletions
+1 -26
View File
@@ -760,30 +760,6 @@ def extract_codes_from_service(answer_dict, constants: Constants):
return normalize_answer_dict_codes(answer_dict)
def fill_claim_type(answer_dicts):
"""
Fills in the AARETE_DERIVED_CLAIM_TYPE_CD field in each answer_dict with the mode of the existing values.
If the field is already populated, it remains unchanged.
Args:
answer_dicts (list[dict]): List of dictionaries containing 1:1 and 1:N fields (after merge process)
Returns:
list[dict]: List of dictionaries with AARETE_DERIVED_CLAIM_TYPE
"""
claim_types = [
d.get("AARETE_DERIVED_CLAIM_TYPE_CD")
for d in answer_dicts
if d.get("AARETE_DERIVED_CLAIM_TYPE_CD")
]
if not claim_types:
return answer_dicts
mode_claim_type = max(set(claim_types), key=claim_types.count)
for answer_dict in answer_dicts:
if not answer_dict.get("AARETE_DERIVED_CLAIM_TYPE_CD"):
answer_dict["AARETE_DERIVED_CLAIM_TYPE_CD"] = mode_claim_type
return answer_dicts
def code_breakout(merged_results: pd.DataFrame, constants: Constants):
"""
Processes a list of answer dictionaries to extract and fill in code-related information.
@@ -796,8 +772,7 @@ def code_breakout(merged_results: pd.DataFrame, constants: Constants):
"""
import concurrent.futures
# Fill empty AARETE_DERIVED_CLAIM_TYPE_CD with mode
answer_dicts = fill_claim_type(merged_results.to_dict(orient="records"))
answer_dicts = merged_results.to_dict(orient="records")
# Parallelize code extraction
def process_single_code(answer_dict):