Merged in feature/cache-field-split (pull request #751)
Cache only for necessary prompts * Cache only for necessary prompts * Merged main into feature/cache-field-split * Merged main into feature/cache-field-split Approved-by: Faizan Mohiuddin
This commit is contained in:
@@ -27,95 +27,104 @@ def get_cacheable_instructions(constants=None):
|
||||
cacheable_instructions = {}
|
||||
|
||||
# REIMBURSEMENT_PRIMARY instruction
|
||||
try:
|
||||
reimbursement_fields = FieldSet(
|
||||
config.FIELD_JSON_PATH, field_type="reimbursement_primary"
|
||||
)
|
||||
if constants:
|
||||
field_prompts = reimbursement_fields.print_prompt_dict(constants)
|
||||
else:
|
||||
field_prompts = reimbursement_fields.print_prompt_dict()
|
||||
if config.FIELDS in ['all', 'one_to_n']:
|
||||
try:
|
||||
reimbursement_fields = FieldSet(
|
||||
config.FIELD_JSON_PATH, field_type="reimbursement_primary"
|
||||
)
|
||||
if constants:
|
||||
field_prompts = reimbursement_fields.print_prompt_dict(constants)
|
||||
else:
|
||||
field_prompts = reimbursement_fields.print_prompt_dict()
|
||||
|
||||
instruction, _ = REIMBURSEMENT_PRIMARY("", field_prompts)
|
||||
cacheable_instructions["REIMBURSEMENT_PRIMARY"] = instruction
|
||||
except Exception as e:
|
||||
pass # Skip if fields not available
|
||||
instruction, _ = REIMBURSEMENT_PRIMARY("", field_prompts)
|
||||
cacheable_instructions["REIMBURSEMENT_PRIMARY"] = instruction
|
||||
except Exception as e:
|
||||
pass # Skip if fields not available
|
||||
|
||||
# SPECIAL_CASE_PRIMARY instruction
|
||||
try:
|
||||
special_case_fields = FieldSet(
|
||||
config.FIELD_JSON_PATH, field_type="special_case_primary"
|
||||
)
|
||||
if constants:
|
||||
field_prompts = special_case_fields.print_prompt_dict(constants)
|
||||
else:
|
||||
field_prompts = special_case_fields.print_prompt_dict()
|
||||
if config.FIELDS in ['all', 'one_to_n']:
|
||||
try:
|
||||
special_case_fields = FieldSet(
|
||||
config.FIELD_JSON_PATH, field_type="special_case_primary"
|
||||
)
|
||||
if constants:
|
||||
field_prompts = special_case_fields.print_prompt_dict(constants)
|
||||
else:
|
||||
field_prompts = special_case_fields.print_prompt_dict()
|
||||
|
||||
instruction, _ = SPECIAL_CASE_PRIMARY("", field_prompts)
|
||||
cacheable_instructions["SPECIAL_CASE_PRIMARY"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
instruction, _ = SPECIAL_CASE_PRIMARY("", field_prompts)
|
||||
cacheable_instructions["SPECIAL_CASE_PRIMARY"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
# METHODOLOGY_BREAKOUT instruction
|
||||
try:
|
||||
methodology_fields = FieldSet(
|
||||
config.FIELD_JSON_PATH, field_type="methodology_breakout"
|
||||
)
|
||||
if constants:
|
||||
field_prompts = methodology_fields.print_prompt_dict(constants)
|
||||
else:
|
||||
field_prompts = methodology_fields.print_prompt_dict()
|
||||
if config.FIELDS in ['all', 'one_to_n']:
|
||||
try:
|
||||
methodology_fields = FieldSet(
|
||||
config.FIELD_JSON_PATH, field_type="methodology_breakout"
|
||||
)
|
||||
if constants:
|
||||
field_prompts = methodology_fields.print_prompt_dict(constants)
|
||||
else:
|
||||
field_prompts = methodology_fields.print_prompt_dict()
|
||||
|
||||
instruction, _ = METHODOLOGY_BREAKOUT("", field_prompts)
|
||||
cacheable_instructions["METHODOLOGY_BREAKOUT"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
instruction, _ = METHODOLOGY_BREAKOUT("", field_prompts)
|
||||
cacheable_instructions["METHODOLOGY_BREAKOUT"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
# OUTLIER_BREAKOUT instruction
|
||||
try:
|
||||
instruction, _ = OUTLIER_BREAKOUT("")
|
||||
cacheable_instructions["OUTLIER_BREAKOUT"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
# TIN_NPI_TEMPLATE instruction
|
||||
try:
|
||||
provider_fields = FieldSet(config.FIELD_JSON_PATH, field_type="provider_info")
|
||||
field_prompts = provider_fields.print_prompt_dict()
|
||||
instruction, _ = TIN_NPI_TEMPLATE("", field_prompts)
|
||||
cacheable_instructions["TIN_NPI_TEMPLATE"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
# ONE_TO_ONE templates (single and multi-field)
|
||||
try:
|
||||
cacheable_instructions["ONE_TO_ONE_SINGLE_FIELD"] = ONE_TO_ONE_SINGLE_FIELD_INSTRUCTION()
|
||||
cacheable_instructions["ONE_TO_ONE_MULTI_FIELD"] = ONE_TO_ONE_MULTI_FIELD_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
if config.FIELDS in ['all', 'one_to_n']:
|
||||
try:
|
||||
instruction, _ = OUTLIER_BREAKOUT("")
|
||||
cacheable_instructions["OUTLIER_BREAKOUT"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
# EXHIBIT_LEVEL + LESSER_OF
|
||||
try:
|
||||
cacheable_instructions["EXHIBIT_LEVEL"] = EXHIBIT_LEVEL_INSTRUCTION()
|
||||
cacheable_instructions["EXHIBIT_LEVEL_LESSER_OF"] = EXHIBIT_LEVEL_LESSER_OF_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
if config.FIELDS in ['all', 'one_to_n']:
|
||||
try:
|
||||
cacheable_instructions["EXHIBIT_LEVEL"] = EXHIBIT_LEVEL_INSTRUCTION()
|
||||
cacheable_instructions["EXHIBIT_LEVEL_LESSER_OF"] = EXHIBIT_LEVEL_LESSER_OF_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Validation / split / checks / relationships
|
||||
try:
|
||||
cacheable_instructions["VALIDATE_REIMBURSEMENTS"] = VALIDATE_REIMBURSEMENTS_INSTRUCTION()
|
||||
cacheable_instructions["SPLIT_REIMBURSEMENTS"] = SPLIT_REIMBURSEMENTS_INSTRUCTION()
|
||||
cacheable_instructions["CHECK_REDUNDANT_LESSER"] = CHECK_REDUNDANT_LESSER_INSTRUCTION()
|
||||
cacheable_instructions["LOB_RELATIONSHIP"] = LOB_RELATIONSHIP_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
if config.FIELDS in ['all', 'one_to_n']:
|
||||
try:
|
||||
cacheable_instructions["VALIDATE_REIMBURSEMENTS"] = VALIDATE_REIMBURSEMENTS_INSTRUCTION()
|
||||
cacheable_instructions["SPLIT_REIMBURSEMENTS"] = SPLIT_REIMBURSEMENTS_INSTRUCTION()
|
||||
cacheable_instructions["CHECK_REDUNDANT_LESSER"] = CHECK_REDUNDANT_LESSER_INSTRUCTION()
|
||||
cacheable_instructions["LOB_RELATIONSHIP"] = LOB_RELATIONSHIP_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Dynamic primary + carveout
|
||||
try:
|
||||
cacheable_instructions["DYNAMIC_PRIMARY"] = DYNAMIC_PRIMARY_INSTRUCTION()
|
||||
cacheable_instructions["CARVEOUT_CHECK"] = CARVEOUT_CHECK_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
if config.FIELDS in ['all', 'one_to_n']:
|
||||
try:
|
||||
cacheable_instructions["DYNAMIC_PRIMARY"] = DYNAMIC_PRIMARY_INSTRUCTION()
|
||||
cacheable_instructions["CARVEOUT_CHECK"] = CARVEOUT_CHECK_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# TIN_NPI_TEMPLATE instruction
|
||||
if config.FIELDS in ['all', 'one_to_one']:
|
||||
try:
|
||||
provider_fields = FieldSet(config.FIELD_JSON_PATH, field_type="provider_info")
|
||||
field_prompts = provider_fields.print_prompt_dict()
|
||||
instruction, _ = TIN_NPI_TEMPLATE("", field_prompts)
|
||||
cacheable_instructions["TIN_NPI_TEMPLATE"] = instruction
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
# ONE_TO_ONE templates (single and multi-field)
|
||||
if config.FIELDS in ['all', 'one_to_one']:
|
||||
try:
|
||||
cacheable_instructions["ONE_TO_ONE_SINGLE_FIELD"] = ONE_TO_ONE_SINGLE_FIELD_INSTRUCTION()
|
||||
cacheable_instructions["ONE_TO_ONE_MULTI_FIELD"] = ONE_TO_ONE_MULTI_FIELD_INSTRUCTION()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
return cacheable_instructions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user