Merged in feature/grouper_cd_desc (pull request #684)
Feature/grouper cd desc * added grouper cd desc * bugfix * Merge branch 'main' into feature/grouper_cd_desc * Merged main into feature/grouper_cd_desc Approved-by: Alex Galarce
This commit is contained in:
committed by
Alex Galarce
parent
425a8ec86c
commit
611da13d2e
@@ -426,6 +426,40 @@ def fill_bill_type(service, answer_dict, BILL_TYPE_MAPPING, BILL_TYPE_REVERSE_MA
|
||||
return answer_dict
|
||||
|
||||
|
||||
def fill_grouper_cd_desc(answer_dict, constants: Constants):
|
||||
"""
|
||||
Fills the GROUPER_CD_DESC field in the answer dictionary based on the GROUPER_CD.
|
||||
|
||||
Args:
|
||||
answer_dict (dict): The answer dictionary to update.
|
||||
|
||||
Returns:
|
||||
dict: The updated answer dictionary.
|
||||
"""
|
||||
|
||||
grouper_cd = answer_dict.get("GROUPER_CD")
|
||||
if string_utils.is_empty(grouper_cd):
|
||||
return answer_dict
|
||||
grouper_type = answer_dict.get("GROUPER_TYPE")
|
||||
if string_utils.is_empty(grouper_type):
|
||||
return answer_dict
|
||||
|
||||
grouper_descs = []
|
||||
grouper_cd = eval(grouper_cd) if "[" in grouper_cd else grouper_cd
|
||||
|
||||
for code in grouper_cd:
|
||||
code_without_severity = int(code.split("-")[0]) # Remove severity level if present
|
||||
if grouper_type == "APR-DRG" and (code_without_severity in constants.GROUPER_APR_DRG_MAPPING):
|
||||
grouper_descs.append(constants.GROUPER_APR_DRG_MAPPING[code_without_severity])
|
||||
elif grouper_type == "MS-DRG" and (code_without_severity in constants.GROUPER_MS_DRG_MAPPING):
|
||||
grouper_descs.append(constants.GROUPER_MS_DRG_MAPPING[code_without_severity])
|
||||
|
||||
if grouper_descs:
|
||||
answer_dict["GROUPER_CD_DESC"] = "|".join(list(set(grouper_descs)))
|
||||
|
||||
return answer_dict
|
||||
|
||||
|
||||
def get_implicit_runs(answer_dict):
|
||||
"""
|
||||
Determines which code runs should be executed implicitly based on the Claim Type and Bill Type
|
||||
@@ -620,6 +654,11 @@ def code_breakout(merged_results: pd.DataFrame, constants: Constants):
|
||||
answer_dict.update(code_answer_dict)
|
||||
answer_dicts_with_code.append(answer_dict)
|
||||
|
||||
# Fill in GROUPER_CD_DESC based on GROUPER_TYPE and GROUPER_CD
|
||||
answer_dicts_with_code = [
|
||||
fill_grouper_cd_desc(answer_dict, constants) for answer_dict in answer_dicts_with_code
|
||||
]
|
||||
|
||||
return pd.DataFrame(answer_dicts_with_code)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user