From 8087693b0844cc0d16fdd65472d1789149e2b560 Mon Sep 17 00:00:00 2001 From: Mayank Aamseek Date: Thu, 31 Jul 2025 17:04:33 +0000 Subject: [PATCH] Merged in bugfix/unit_of_measure (pull request #641) Bugfix/unit of measure * unit of measure prompt updated * handled null unit of measure for flat rate cases * Merged main into bugfix/unit_of_measure Approved-by: Alex Galarce --- .../src/investment/investment_postprocessing_funcs.py | 4 ++++ fieldExtraction/src/prompts/investment_prompts.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fieldExtraction/src/investment/investment_postprocessing_funcs.py b/fieldExtraction/src/investment/investment_postprocessing_funcs.py index e46e378..d17212a 100644 --- a/fieldExtraction/src/investment/investment_postprocessing_funcs.py +++ b/fieldExtraction/src/investment/investment_postprocessing_funcs.py @@ -392,6 +392,10 @@ def standardize_reimb_method_and_fee_schedule(df: pd.DataFrame) -> pd.DataFrame: # remove cases of Per Member Per Month (PMPM) df = df[~df['UNIT_OF_MEASURE'].isin(['Per Member Per Month (PMPM)'])] + # Set UNIT_OF_MEASURE as 'Per Unit' for Flat Rate reimbursement method with empty UNIT_OF_MEASURE + df.loc[(df['AARETE_DERIVED_REIMB_METHOD'] == 'Flat Rate') & \ + (df['UNIT_OF_MEASURE'].apply(string_utils.is_empty)), 'UNIT_OF_MEASURE'] = 'Per Unit' + # Ensure UNIT_OF_MEASURE is one of the valid values df['UNIT_OF_MEASURE'] = df['UNIT_OF_MEASURE'].apply(lambda x: x if x in investment_values.VALID_UNIT_OF_MEASURE else "") diff --git a/fieldExtraction/src/prompts/investment_prompts.json b/fieldExtraction/src/prompts/investment_prompts.json index 7446d6c..7cbb232 100644 --- a/fieldExtraction/src/prompts/investment_prompts.json +++ b/fieldExtraction/src/prompts/investment_prompts.json @@ -52,7 +52,7 @@ "field_name": "UNIT_OF_MEASURE", "relationship": "one_to_n", "field_type": "methodology_breakout", - "prompt": "If the reimbursement method is a flat rate or follows certain fee schedules (e.g., ASA), extract the unit of measure. Otherwise, return 'N/A'. If the unit of measure is not explicitly mentioned, return 'N/A'. If a unit of measure is explicitly mentioned but not included in the list of provided valid values, return 'per unit'. Valid values are: {valid_values}", + "prompt": "If the reimbursement method is a flat rate or follows certain fee schedules (e.g., ASA), extract the unit of measure. Otherwise, return 'N/A'. If a unit of measure is explicitly mentioned but not included in the list of provided valid values, return 'per unit'. Valid values are: {valid_values}", "valid_values": "VALID_UNIT_OF_MEASURE" }, {