From e774581b0321df4e5c07977a9dac30e777d369ee Mon Sep 17 00:00:00 2001 From: Quan Pham Date: Wed, 15 Jan 2025 10:11:55 -0500 Subject: [PATCH] Added `include_in_NERC_total_invoice` field to `institute_list.yaml` The means the `INCLUDED_INSTITUTIONS` from `NERCTotalInvoice` is now removed. --- process_report/institute_list.yaml | 3 +++ process_report/invoices/NERC_total_invoice.py | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/process_report/institute_list.yaml b/process_report/institute_list.yaml index 9d16e98..5017b23 100644 --- a/process_report/institute_list.yaml +++ b/process_report/institute_list.yaml @@ -6,12 +6,14 @@ domains: - bu.edu mghpcc_partnership_start_date: "2013-06" + include_in_NERC_total_invoice: True - display_name: Bentley domains: - bentley.edu - display_name: University of Rhode Island domains: - uri.edu + include_in_NERC_total_invoice: True - display_name: Red Hat domains: - redhat.com @@ -38,6 +40,7 @@ - harvard.edu - chemistry.harvard.edu mghpcc_partnership_start_date: "2013-06" + include_in_NERC_total_invoice: True - display_name: Worcester Polytechnic Institute domains: - wpi.edu diff --git a/process_report/invoices/NERC_total_invoice.py b/process_report/invoices/NERC_total_invoice.py index e39e49b..e92496c 100644 --- a/process_report/invoices/NERC_total_invoice.py +++ b/process_report/invoices/NERC_total_invoice.py @@ -12,12 +12,6 @@ class NERCTotalInvoice(invoice.Invoice): - NewPICreditProcessor """ - INCLUDED_INSTITUTIONS = [ - "Harvard University", - "Boston University", - "University of Rhode Island", - ] - export_columns_list = [ invoice.INVOICE_DATE_FIELD, invoice.PROJECT_FIELD, @@ -51,9 +45,15 @@ def output_s3_archive_key(self): return f"Invoices/{self.invoice_month}/Archive/NERC-{self.invoice_month}-Total-Invoice {util.get_iso8601_time()}.csv" def _prepare_export(self): + included_institutions = list() + institute_list = util.load_institute_list() + for institute_info in institute_list: + if institute_info.get("include_in_NERC_total_invoice"): + included_institutions.append(institute_info["display_name"]) + self.export_data = self.data[ self.data[invoice.IS_BILLABLE_FIELD] & ~self.data[invoice.MISSING_PI_FIELD] ] self.export_data = self.export_data[ - self.export_data[invoice.INSTITUTION_FIELD].isin(self.INCLUDED_INSTITUTIONS) + self.export_data[invoice.INSTITUTION_FIELD].isin(included_institutions) ].copy()