Merged in feature/configure_carveout_breakouts (pull request #468)

add new configurations for carveouts

* add new configurations for carveouts

* formatting, isort, and remove a couple unused imports


Approved-by: Katon Minhas
This commit is contained in:
Alex Galarce
2025-04-08 17:17:58 +00:00
parent 04cb261831
commit 807155fe49
2 changed files with 161 additions and 22 deletions
@@ -1,23 +1,53 @@
import src.prompts.investment_prompts as investment_prompts
from src import config
from src.prompts.investment_prompts import FieldSet
import src.prompts.investment_prompts as investment_prompts
METHODOLOGY_BREAKOUT_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="methodology_breakout"
).print_prompt_dict()
FS_BREAKOUT_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="fee_schedule_breakout"
).print_prompt_dict()
## Carveout questions
MULTIPLE_PROCEDURE_REDUCTION_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="multiple_procedure_reductions"
).print_prompt_dict()
NEVER_EVENT_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="never_event"
).print_prompt_dict()
EXPERIMENTAL_INVESTIGATIONAL_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="experimental_investigational"
).print_prompt_dict()
# no questions for not_medically_necessary, global_services, bundled_codes, midlevels,
# technical_component, professional_component, diagnostic_procedures, preadmission,
# post_discharge, or readmissions
METHODOLOGY_BREAKOUT_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="methodology_breakout").print_prompt_dict()
FS_BREAKOUT_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="fee_schedule_breakout").print_prompt_dict()
# These don't need to be declared as constants.
# we can use questions = FieldSet(file_path=config.FIELD_JSON_PATH, field_type=field_type).get_prompt_dict()
MULTIPLE_PROCEDURE_REDUCTION_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="multiple_procedure_reductions").print_prompt_dict()
STOP_LOSS_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="stop_loss").print_prompt_dict()
OUTLIER_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="outlier").print_prompt_dict()
SEQUESTRATION_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="sequestration").print_prompt_dict()
DISCOUNT_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="discount").print_prompt_dict()
PREMIUM_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="premium").print_prompt_dict()
ADDITION_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="addition").print_prompt_dict()
TRIGGER_CAP_QUESTIONS = FieldSet(file_path=config.FIELD_JSON_PATH, field_type="trigger_cap").print_prompt_dict()
## Special case questions
STOP_LOSS_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="stop_loss"
).print_prompt_dict()
OUTLIER_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="outlier"
).print_prompt_dict()
SEQUESTRATION_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="sequestration"
).print_prompt_dict()
DISCOUNT_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="discount"
).print_prompt_dict()
PREMIUM_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="premium"
).print_prompt_dict()
ADDITION_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="addition"
).print_prompt_dict()
TRIGGER_CAP_QUESTIONS = FieldSet(
file_path=config.FIELD_JSON_PATH, field_type="trigger_cap"
).print_prompt_dict()
SPECIAL_CASE_CONFIGS = {
# Carveouts
"DEFAULT_TERM": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
@@ -26,7 +56,7 @@ SPECIAL_CASE_CONFIGS = {
"carveout_ind": False,
"default_ind": True,
"term_key": False,
},
},
"UNLISTED_CODE": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
@@ -35,9 +65,9 @@ SPECIAL_CASE_CONFIGS = {
"carveout_ind": True,
"default_ind": True,
"term_key": False,
},
"MULTIPLE_PROCEDURE_REDUCTIONS": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS + MULTIPLE_PROCEDURE_REDUCTION_QUESTIONS,
},
"NEVER_EVENT": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
@@ -45,6 +75,117 @@ SPECIAL_CASE_CONFIGS = {
"default_ind": False,
"term_key": False,
},
"EXPERIMENTAL_INVESTIGATIONAL": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS
+ EXPERIMENTAL_INVESTIGATIONAL_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"NOT_MEDICALLY_NECESSARY": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"GLOBAL_SERVICES": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"BUNDLED_CODES": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"MULTIPLE_PROCEDURE_REDUCTIONS": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS
+ MULTIPLE_PROCEDURE_REDUCTION_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"MIDLEVELS": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"TECHNICAL_COMPONENT": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"PROFESSIONAL_COMPONENT": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"DIAGNOSTIC_PROCEDURES": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"PREADMISSION": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"POST_DISCHARGE": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
"READMISSIONS": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
"methodology_prompt_template": investment_prompts.REIMB_TERM_BREAKOUT,
"fee_schedule_prompt_template": investment_prompts.FEE_SCHEDULE_BREAKOUT,
"carveout_ind": True,
"default_ind": False,
"term_key": False,
},
# Special Cases
"STOP_LOSS": {
"questions": METHODOLOGY_BREAKOUT_QUESTIONS + STOP_LOSS_QUESTIONS,
"fs_questions": FS_BREAKOUT_QUESTIONS,
@@ -108,5 +249,4 @@ SPECIAL_CASE_CONFIGS = {
"default_ind": False,
"term_key": True,
},
# Add more special cases here as needed
}
}
@@ -1,14 +1,13 @@
import re
import hashlib
import re
from typing import Callable
import src.constants.investment_values as investment_values
import src.constants.valid as valid
import src.investment.code_funcs as code_funcs
import src.prompts.investment_prompts as investment_prompts
import src.utils.llm_utils as llm_utils
import src.utils.string_utils as string_utils
from src import config, postprocessing_funcs
from src import config
from src.constants.special_case_configs import SPECIAL_CASE_CONFIGS
from src.enums.delimiters import Delimiter
from src.prompts.investment_prompts import Field, FieldSet