Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed HU-BU invoice and added URI #88

Merged
merged 2 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading