Skip to content

Commit

Permalink
Initialized processor for Lenovo processing
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanMPhm committed Oct 21, 2024
1 parent 6276e84 commit 7812e4a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions process_report/processors/lenovo_processor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from dataclasses import dataclass


from process_report.invoices import invoice
from process_report.processors import processor


@dataclass
class LenovoProcessor(processor.Processor):
LENOVO_SU_TYPES = ["OpenShift GPUA100SXM4", "OpenStack GPUA100SXM4"]
SU_CHARGE_MULTIPLIER = 1

def _prepare(self):
self.data = self.data[
self.data[invoice.SU_TYPE_FIELD].isin(self.LENOVO_SU_TYPES)
][
[
invoice.INVOICE_DATE_FIELD,
invoice.PROJECT_FIELD,
invoice.INSTITUTION_FIELD,
invoice.SU_HOURS_FIELD,
invoice.SU_TYPE_FIELD,
]
].copy()

self.data.rename(columns={invoice.SU_HOURS_FIELD: "SU Hours"}, inplace=True)
self.data.insert(len(self.data.columns), "SU Charge", self.SU_CHARGE_MULTIPLIER)

def _process(self):
self.data["Charge"] = self.data["SU Hours"] * self.data["SU Charge"]

0 comments on commit 7812e4a

Please sign in to comment.