From 1b23b853163870122efe8358fb8d57e97ed6330d Mon Sep 17 00:00:00 2001 From: Quan Pham Date: Tue, 20 Aug 2024 10:44:14 -0400 Subject: [PATCH 1/2] Renamed HU-BU invoice to NERC Total Invoice, and added `INCLUDED_INSTITUTIONS` to invoice class `hu_bu_invoice.py` is now renamed to `NERC_total_invoice.py` because of our billing requirements. A constant list `INCLUDED_INSTITUTIONS` is added to the NERC Total invoice class, containing institutions whose projects will be exported to the invoice. --- .../{hu_bu_invoice.py => NERC_total_invoice.py} | 14 +++++++++++--- process_report/process_report.py | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) rename process_report/invoices/{hu_bu_invoice.py => NERC_total_invoice.py} (62%) diff --git a/process_report/invoices/hu_bu_invoice.py b/process_report/invoices/NERC_total_invoice.py similarity index 62% rename from process_report/invoices/hu_bu_invoice.py rename to process_report/invoices/NERC_total_invoice.py index 96817aa..983f175 100644 --- a/process_report/invoices/hu_bu_invoice.py +++ b/process_report/invoices/NERC_total_invoice.py @@ -5,7 +5,16 @@ @dataclass -class HUBUInvoice(invoice.Invoice): +class NERCTotalInvoice(invoice.Invoice): + INCLUDED_INSTITUTIONS = [ + "Harvard University", + "Boston University", + ] + + @property + def output_path(self) -> str: + return f"NERC-{self.invoice_month}-Total-Invoice.csv" + @property def output_s3_key(self) -> str: return ( @@ -18,6 +27,5 @@ def output_s3_archive_key(self): def _prepare_export(self): self.data = self.data[ - (self.data[invoice.INSTITUTION_FIELD] == "Harvard University") - | (self.data[invoice.INSTITUTION_FIELD] == "Boston University") + self.data[invoice.INSTITUTION_FIELD].isin(self.INCLUDED_INSTITUTIONS) ].copy() diff --git a/process_report/process_report.py b/process_report/process_report.py index 8af2545..ea18139 100644 --- a/process_report/process_report.py +++ b/process_report/process_report.py @@ -173,9 +173,9 @@ def main(): help="Name of output csv for BU invoices", ) parser.add_argument( - "--HU-BU-invoice-file", + "--NERC-total-invoice-file", required=False, - default="HU_BU", + default="NERC", help="Name of output csv for HU and BU invoice", ) parser.add_argument( @@ -271,7 +271,7 @@ def main(): billable_inv.export() hu_bu_inv = hu_bu_invoice.HUBUInvoice( - name=args.HU_BU_invoice_file, + name=args.NERC_total_invoice_file, invoice_month=invoice_month, data=billable_inv.data, ) From a89297c9f5589491c78db47775e21534b60adceb Mon Sep 17 00:00:00 2001 From: Quan Pham Date: Mon, 2 Sep 2024 12:13:29 -0400 Subject: [PATCH 2/2] Added URI NERC Total Invoice --- process_report/invoices/NERC_total_invoice.py | 1 + process_report/process_report.py | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/process_report/invoices/NERC_total_invoice.py b/process_report/invoices/NERC_total_invoice.py index 983f175..9133333 100644 --- a/process_report/invoices/NERC_total_invoice.py +++ b/process_report/invoices/NERC_total_invoice.py @@ -9,6 +9,7 @@ class NERCTotalInvoice(invoice.Invoice): INCLUDED_INSTITUTIONS = [ "Harvard University", "Boston University", + "University of Rhode Island", ] @property diff --git a/process_report/process_report.py b/process_report/process_report.py index ea18139..8797b53 100644 --- a/process_report/process_report.py +++ b/process_report/process_report.py @@ -14,7 +14,7 @@ lenovo_invoice, nonbillable_invoice, billable_invoice, - hu_bu_invoice, + NERC_total_invoice, ) @@ -270,16 +270,16 @@ def main(): billable_inv.process() billable_inv.export() - hu_bu_inv = hu_bu_invoice.HUBUInvoice( + nerc_total_inv = NERC_total_invoice.NERCTotalInvoice( name=args.NERC_total_invoice_file, invoice_month=invoice_month, data=billable_inv.data, ) - hu_bu_inv.process() - hu_bu_inv.export() + nerc_total_inv.process() + nerc_total_inv.export() if args.upload_to_s3: - for invoice in [billable_inv, hu_bu_inv]: + for invoice in [billable_inv, nerc_total_inv]: bucket = get_invoice_bucket() invoice.export_s3(bucket)