Skip to content

Commit

Permalink
Merge pull request #88 from QuanMPhm/83/add_URI
Browse files Browse the repository at this point in the history
Renamed HU-BU invoice and added URI
  • Loading branch information
knikolla authored Sep 3, 2024
2 parents 5c4b024 + a89297c commit 983a216
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@


@dataclass
class HUBUInvoice(invoice.Invoice):
class NERCTotalInvoice(invoice.Invoice):
INCLUDED_INSTITUTIONS = [
"Harvard University",
"Boston University",
"University of Rhode Island",
]

@property
def output_path(self) -> str:
return f"NERC-{self.invoice_month}-Total-Invoice.csv"

@property
def output_s3_key(self) -> str:
return (
Expand All @@ -18,6 +28,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()
16 changes: 8 additions & 8 deletions process_report/process_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
lenovo_invoice,
nonbillable_invoice,
billable_invoice,
hu_bu_invoice,
NERC_total_invoice,
)


Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -270,16 +270,16 @@ def main():
billable_inv.process()
billable_inv.export()

hu_bu_inv = hu_bu_invoice.HUBUInvoice(
name=args.HU_BU_invoice_file,
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)

Expand Down

0 comments on commit 983a216

Please sign in to comment.