Merged in bugfix/reimb_pct_rate_fix (pull request #583)

bugfix/reimb pct rate fix to main

* updated pct rate post process

* postprocess pct rate

* Merged main into bugfix/reimb_pct_rate_fix

* removed comments


Approved-by: Katon Minhas
This commit is contained in:
VenkataKrishna Reddy Avula
2025-06-23 13:11:31 +00:00
committed by Katon Minhas
parent c84decca8d
commit 0e3cd3f6c5
3 changed files with 25 additions and 15 deletions
@@ -486,18 +486,27 @@ def update_lob_for_duals(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'.
Fill 'REIMB_PCT_RATE' based on reimbursement method:
- Set 'REIMB_PCT_RATE' to '100' for rows where:
- 'REIMB_PCT_RATE', 'REIMB_FEE_RATE', and 'REIMB_CONVERSION_FACTOR' are all empty.
- Set 'REIMB_PCT_RATE' to 'N/A' for rows where:
- 'AARETE_DERIVED_REIMB_METHOD' contains specific grouper.
"""
required_cols = ["REIMB_PCT_RATE", "REIMB_FEE_RATE", "AARETE_DERIVED_REIMB_METHOD"]
required_cols = ["REIMB_PCT_RATE", "REIMB_FEE_RATE", "REIMB_CONVERSION_FACTOR", "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
# Fill with '100' when all three rate fields are empty
pct_empty = string_utils.is_empty(df["REIMB_PCT_RATE"])
fee_empty = string_utils.is_empty(df["REIMB_FEE_RATE"])
conversion_empty = string_utils.is_empty(df["REIMB_CONVERSION_FACTOR"])
fill_mask = pct_empty & fee_empty & conversion_empty
df.loc[fill_mask, "REIMB_PCT_RATE"] = "100"
# Set to N/A for specific reimbursement methods
na_methods = ["Grouper", "Per Diem", "Flat Rate", "Per Visit", "Case Rate"]
na_mask = df["AARETE_DERIVED_REIMB_METHOD"].isin(na_methods)
df.loc[na_mask, "REIMB_PCT_RATE"] = "N/A"
return df
@@ -28,9 +28,6 @@ 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:
@@ -56,6 +53,9 @@ def postprocess(df):
# Standardize the 'AARETE_DERIVED_REIMB_METHOD' column and updates the 'AARETE_DERIVED_FEE_SCHEDULE' column based on specific values.
df = investment_postprocessing_funcs.standardize_reimb_method_and_fee_schedule(df)
# update reimb_pct_rate
df = investment_postprocessing_funcs.fill_empty_reimb_pct_rate(df)
df = investment_postprocessing_funcs.update_reimb_prov_name(df)
df = investment_postprocessing_funcs.add_aarete_derived_amendment_num(df)
@@ -545,6 +545,7 @@ For any fields that don't apply to a particular methodology, use "N/A" as the va
- If the methodology includes **additional reimbursement terms** beyond the “lesser of” structure (e.g., administrative fees, per diem charges, or carve-out payments):
- **These must also be extracted as separate JSON dictionaries** in the same list.
- These are often found in follow-on sentences or clauses and may not be part of a comparative limit but are still enforceable and reimbursable.
- For each dictionary, only one of the following fields should be present: REIMB_FEE_RATE, REIMB_PCT_RATE, or REIMB_CONVERSION_FACTOR. The others should be "N/A".
[C: ANALYSIS CONTEXT]
Here is the text to analyze and respond to: