Merged in feature/split-and-filter-reimbursements (pull request #587)

Feature/filter reimbursements

* First-pass implementation for reimbursement filtering

* Enhance reimbursement level processing by filtering out services without reimbursement terms and logging when no valid pairs are found.

* Update mock return values in reimbursement level tests to reflect new reimbursement terms

* Merge remote-tracking branch 'origin/main' into feature/split-and-filter-reimbursements

* Refine reimbursement filtering by adding 'billed' to indicators and ensuring REIMB_TERM is a string before processing.

* Refactor is_empty function signature to support multiple input types and clarify return values

* adding LLM review for ambiguous reimbursement methodology cases

* more stringent keywords for stage 1 of reimbursement filtering

* refining rate and cost patterns for reimbursement filtering

* Enhance LLM response handling in reimbursement methodology check to improve accuracy and logging for ambiguous cases.

* Merge remote-tracking branch 'origin/main' into feature/split-and-filter-reimbursements

* Update reimbursement test cases to reflect accurate reimbursement terms and improve deduplication logic

* move VALIDATE_REIMBURSEMENTS_PROMPT to investment_prompts.py

* black, isort formatting

* Remove IDENTIFY_REIMBURSEMENT_EXHIBITS_PROMPT function (unused)

* Add MODEL_ID_CLAUDE4_SONNET for new model integration (doesn't work right now)

* pipe delimited-output and parsing

* Merge remote-tracking branch 'origin/main' into feature/split-and-filter-reimbursements

* Refactor reimbursement filtering by moving clear indicators to constants


Approved-by: Katon Minhas
This commit is contained in:
Alex Galarce
2025-06-26 21:26:27 +00:00
parent 1531ad6bac
commit 724e31b15d
7 changed files with 267 additions and 78 deletions
+7 -2
View File
@@ -341,7 +341,7 @@ def count_reimbursements_in_exhibit(exhibit_text: str) -> int: #JUST by regex
"""
return len(re.findall(reimb_regex, exhibit_text))
def is_empty(value, pd_mask=True):
def is_empty(value: str | list | pd.Series, pd_mask: bool=True) -> bool | pd.Series:
"""
Checks if a value is considered empty or invalid.
@@ -353,7 +353,12 @@ def is_empty(value, pd_mask=True):
Otherwise, the function returns True iff the entire Series is empty.
Returns:
bool: True if the value is empty or invalid, False otherwise.
bool | pd.Series:
- When the input is a string, returns True if the value is empty or invalid, False otherwise.
- When the input is a list, returns True if the list is empty or all elements are empty/invalid.
- When the input is a pandas Series:
- If `pd_mask` is True, returns a boolean mask indicating which elements are empty or invalid.
- If `pd_mask` is False, returns True iff all elements are empty/invalid, or if the entire Series is empty.
"""
empty_values = [None, "", "N/A", "NA", "null", "none", "NaN", np.nan, "nan", "None"]