diff --git a/fieldExtraction/src/constants/special_case_configs.py b/fieldExtraction/src/constants/special_case_configs.py index d31978f..11d990e 100644 --- a/fieldExtraction/src/constants/special_case_configs.py +++ b/fieldExtraction/src/constants/special_case_configs.py @@ -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 -} \ No newline at end of file +} diff --git a/fieldExtraction/src/investment/one_to_n_funcs.py b/fieldExtraction/src/investment/one_to_n_funcs.py index 12a437f..da7bc1b 100644 --- a/fieldExtraction/src/investment/one_to_n_funcs.py +++ b/fieldExtraction/src/investment/one_to_n_funcs.py @@ -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