Skip to content

Commit

Permalink
Added include_in_NERC_total_invoice field to institute_list.yaml
Browse files Browse the repository at this point in the history
The means the `INCLUDED_INSTITUTIONS` from `NERCTotalInvoice` is
now removed.
  • Loading branch information
QuanMPhm committed Jan 15, 2025
1 parent 5c7290d commit e774581
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions process_report/institute_list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
14 changes: 7 additions & 7 deletions process_report/invoices/NERC_total_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()

0 comments on commit e774581

Please sign in to comment.