From 6deea0071e82a227889766956eda7db502ba0628 Mon Sep 17 00:00:00 2001 From: Katon Minhas Date: Mon, 17 Jun 2024 21:36:48 -0700 Subject: [PATCH] Updated primary prompt for examples --- src/file_processing.py | 2 +- src/prompts.py | 2 +- src/test.py | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/file_processing.py b/src/file_processing.py index 79f2c23..d6d7438 100644 --- a/src/file_processing.py +++ b/src/file_processing.py @@ -68,7 +68,7 @@ def process_file(file_object): combined_df.to_csv(os.path.join(output_dir, config.UNPROCESSED_RESULTS_NAME), index=False) ################## RUN POSTPROCESSING ################## - #combined_df = combined_df.applymap(postprocessingfuncs.sanitize_value) # Deprecated + # combined_df = combined_df.applymap(postprocessingfuncs.sanitize_value) # Deprecated combined_df = combined_df.apply(lambda x: x.map(postprocessingfuncs.sanitize_value)) post_processed_combined_df = postprocess.postprocess_results(combined_df) diff --git a/src/prompts.py b/src/prompts.py index 94a19f0..2ada485 100644 --- a/src/prompts.py +++ b/src/prompts.py @@ -38,7 +38,7 @@ def BOTTOM_UP_PRIMARY(page, payer): The preceding text is one page of a contract between Payer {payer} and a provider in their network. Your job is to extract attributes related to the reimbursement of different services and specialties. -The reimbursement values will be identified with >>> <<< indicators (e.g. >>>105%<<<). Make sure there is at least one dictionary object for EVERY reimbursement value seen (either % or $). +The reimbursement values will be identified with >>> <<< indicators (e.g. >>>105%<<<). Make sure there is at least one dictionary object for EVERY reimbursement value seen (either % or $). Some values are found in sections identified as examples - these must be omitted from output. If any of the attributes are not found, return N/A. For all attributes, only write what is written on the page. Do not make up new phrases or words. diff --git a/src/test.py b/src/test.py index 8a770c3..0d04e64 100644 --- a/src/test.py +++ b/src/test.py @@ -29,9 +29,16 @@ import claude_funcs # final_df = pd.concat(all_dfs, ignore_index=True) # final_df.to_excel('output_consolidated/test_20240610_batch1.xlsx') -combined_df = pd.read_csv('output/2017-07-01 Cedars-Sinai Medical Center CSMF CDM AMD MU/combined_results_unprocessed.csv') -combined_df = combined_df.apply(lambda x: x.map(postprocessingfuncs.sanitize_value)) +input_dict = utils.read_input() -post_processed_combined_df = postprocess.postprocess_results(combined_df) +(filename, contract_text) = list(input_dict.items())[0] +contract_text = preprocess.clean_newlines(contract_text) +text_dict = preprocess.split_text(contract_text) +text_dict = table_funcs.align_and_format_tables(text_dict) +text_dict = preprocess.highlight_rates(text_dict) + +bu_results = prompt_funcs.run_bottom_up_primary({'5' : text_dict['5']}, 4000) # Returns list of dictionaries +print(bu_results) +