Merged in bugfix/default_ind_postprocess (pull request #887)

Bugfix/default ind postprocess

* Add logic to standardize UNIT_OF_MEASURE for flat-rate reimbursement methods

- Implemented functionality in `standardize_reimb_method_and_fee_schedule` to set UNIT_OF_MEASURE to blank for rows where DEFAULT_IND is 'Y' and AARETE_DERIVED_REIMB_METHOD is 'flat rate'.
- Added unit tests to verify behavior for various scenarios, including case insensitivity and non-default conditions.
- Ensured that UNIT_OF_MEASURE remains unchanged for non-flat rate methods.

* Enhance child rank handling and ensure column consistency in parent-child mapping

- Added initialization for the `child_rank` column in both parents and children DataFrames to prevent KeyError during concatenation when no children exist.
- Updated `cols_to_keep` in `parent_child_mapping` to filter out columns not present in `pc_df`, ensuring robustness in data processing.

* Ran Black

* made a small change in code_last_check, fixed so it returns string and not single char

* Made changes to make sure that default_ind postprocess only happens to the cc output and not dashboard

* Merged DEV into bugfix/default_ind_postprocess

* Restore deleted AARETE_DERIVED_PAYER_NAME functions

Functions were removed during previous commit. Restored from DEV to fix
AttributeError in prompt_calls.py.

* Simplify code_last_check return logic and add error logging

- Simplified return to single line with fallback
- Added error logging for failed LLM response parsing


Approved-by: Siddhant Medar
This commit is contained in:
Praneel Panchigar
2026-02-20 21:19:34 +00:00
committed by Siddhant Medar
parent 7571d3e3b1
commit ddefa2ff30
6 changed files with 123 additions and 8 deletions
@@ -613,6 +613,27 @@ def standardize_reimb_method_and_fee_schedule(
return df
def blank_uom_for_default_flat_rate_cc(df: pd.DataFrame) -> pd.DataFrame:
"""
CC output only: blank UNIT_OF_MEASURE when DEFAULT_IND='Y' and method is flat rate.
Ensures default flat-rate reimbursements are not shown as per-unit in CC output.
Dashboard output is not modified (call this only in contract_config_postprocess).
"""
if not all(
c in df.columns
for c in ("DEFAULT_IND", "AARETE_DERIVED_REIMB_METHOD", "UNIT_OF_MEASURE")
):
return df
default_ind_y = df["DEFAULT_IND"].astype(str).str.strip().str.upper() == "Y"
flat_rate_method = (
df["AARETE_DERIVED_REIMB_METHOD"].astype(str).str.strip().str.lower()
== "flat rate"
)
df.loc[default_ind_y & flat_rate_method, "UNIT_OF_MEASURE"] = ""
return df
def process_patient_age_range(df):
"""
Process the 'PATIENT_AGE_RANGE' column into 'PATIENT_AGE_MIN' and 'PATIENT_AGE_MAX'.