Skip to content

Commit

Permalink
Upload backup of PI file after processing
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanMPhm committed May 20, 2024
1 parent f64762c commit 7b96ea9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions process_report/process_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ def main():

billable_projects = remove_non_billables(merged_dataframe, pi, projects)
billable_projects = validate_pi_names(billable_projects)

if args.upload_to_s3:
backup_to_s3_old_pi_file(old_pi_file)
credited_projects = apply_credits_new_pi(billable_projects, old_pi_file)

export_billables(credited_projects, args.output_file)
Expand Down Expand Up @@ -387,6 +390,11 @@ def upload_to_s3_old_pi_file(old_pi_file):
invoice_bucket.upload_file(old_pi_file, PI_S3_FILEPATH)


def backup_to_s3_old_pi_file(old_pi_file):
invoice_bucket = get_invoice_bucket()
invoice_bucket.upload_file(old_pi_file, f"PIs/Archive/PI {get_iso8601_time()}.csv")


def add_institution(dataframe: pandas.DataFrame):
"""Determine every PI's institution name, logging any PI whose institution cannot be determined
This is performed by `get_institution_from_pi()`, which tries to match the PI's username to
Expand Down

0 comments on commit 7b96ea9

Please sign in to comment.