From da362dcedb811aa503d8e84ba995683799ad6a9f Mon Sep 17 00:00:00 2001 From: Alex Galarce Date: Tue, 8 Jul 2025 17:19:34 +0000 Subject: [PATCH] Merged in feature/script-add-lesser-of-id-to-testbed (pull request #603) Add script to generate and save reimbursement IDs in testbed * Add script to generate and save reimbursement IDs in testbed * Merged main into feature/script-add-lesser-of-id-to-testbed Approved-by: Katon Minhas --- .../src/testbed/add_reimb_id_to_testbed.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 fieldExtraction/src/testbed/add_reimb_id_to_testbed.py diff --git a/fieldExtraction/src/testbed/add_reimb_id_to_testbed.py b/fieldExtraction/src/testbed/add_reimb_id_to_testbed.py new file mode 100644 index 0000000..d35ac44 --- /dev/null +++ b/fieldExtraction/src/testbed/add_reimb_id_to_testbed.py @@ -0,0 +1,23 @@ +"""This script reads the testbed file, generates reimbursement IDs, +and saves the updated testbed with the new IDs. + +It should be run from the `fieldExtraction` directory, with the testbed file co-located in the same directory. +The output will be saved as `Doczy-Testbed-with-Reimb-IDs.xlsx`. + +Run it with `poetry run python -m src.testbed.add_reimb_id_to_testbed` +""" + +# Imports +import pandas as pd +from src.postprocessing_funcs import generate_reimb_ids +from src.constants.investment_columns import COLUMN_ORDER +from src.investment.investment_postprocessing_funcs import reorder_columns + +# Read the testbed file +testbed = pd.read_excel("Doczy-Testbed.xlsx") + +# Generate reimbursement IDs and reorder columns +testbed_w_ids = reorder_columns(generate_reimb_ids(testbed), COLUMN_ORDER) + +# Save the updated testbed with reimbursement IDs +testbed_w_ids.to_excel("Doczy-Testbed-with-Reimb-IDs.xlsx", index=False) \ No newline at end of file