Merged in bugfix/reimb_pct_rate (pull request #548)

fixed reimb_pct_rate empty values

* fixed reimb_pct_rate empty values

* updated lesser of prompt

* rolled back lesser_of_ind prompt

* updated REIMB_PCT_RATE prompt

* updated fill_empty_reimb_pct_rate

* fixed Value Error

* Merged main into bugfix/reimb_pct_rate


Approved-by: Katon Minhas
This commit is contained in:
VenkataKrishna Reddy Avula
2025-06-03 13:50:46 +00:00
committed by Katon Minhas
parent e096d03fba
commit 4c1b85a2e8
3 changed files with 22 additions and 1 deletions
@@ -491,3 +491,21 @@ def update_lob_for_duals(answer_dicts):
answer_dict["AARETE_DERIVED_LOB"] = claude_answer_extracted
final_answer_dicts.append(answer_dict)
return final_answer_dicts
def fill_empty_reimb_pct_rate(df):
"""
Fill 'REIMB_PCT_RATE' with '100' for rows where:
- 'REIMB_PCT_RATE' is empty,
- 'REIMB_FEE_RATE' is empty,
- and 'AARETE_DERIVED_REIMB_METHOD' is either 'Fee Schedule' or 'Grouper'.
"""
required_cols = ["REIMB_PCT_RATE", "REIMB_FEE_RATE", "AARETE_DERIVED_REIMB_METHOD"]
if all(col in df.columns for col in required_cols):
pct_empty = string_utils.is_empty(df["REIMB_PCT_RATE"]) # Series mask
fee_empty = string_utils.is_empty(df["REIMB_FEE_RATE"]) # Series mask
method_mask = df["AARETE_DERIVED_REIMB_METHOD"].isin(["Fee Schedule", "Grouper"])
mask = pct_empty & fee_empty & method_mask # Final combined mask
df.loc[mask, "REIMB_PCT_RATE"] = "100" # Apply change
return df
@@ -18,6 +18,9 @@ def postprocess(df):
df['REIMB_FEE_RATE'] = df['REIMB_FEE_RATE'].apply(investment_postprocessing_funcs.format_rate_fields_with_commas)
if "REIMB_PCT_RATE" in df.columns:
df['REIMB_PCT_RATE'] = df['REIMB_PCT_RATE'].apply(investment_postprocessing_funcs.format_rate_fields_with_commas)
# default reimb_pct_rate to 100 when both reimb_pct_rate and reimb_fee_rate are empty
df = investment_postprocessing_funcs.fill_empty_reimb_pct_rate(df)
for col in df.columns:
if "_IND" in col:
@@ -46,7 +46,7 @@
"field_name": "REIMB_PCT_RATE",
"relationship": "one_to_n",
"field_type": "methodology_breakout",
"prompt": "If the rate of reimbursement is a percentage of something, what is that percentage rate of reimbursement? Extract only the final percentage value from the text. If no specific percentage is explicitly mentioned and no dollar amount is mentioned either, return 100 as the default value."
"prompt": "What is the percentage rate of reimbursement? Extract only the numeric percentage value (without % symbol). If a percentage is explicitly stated, return that number. If no percentage is found AND no specific dollar amount is mentioned in the text, return 100 as default. If a specific dollar amount is mentioned, return 'N/A'."
},
{
"field_name": "REIMB_EFFECTIVE_DT",