Skip to content

Commit

Permalink
Merge pull request #47 from QuanMPhm/41/backup_pi
Browse files Browse the repository at this point in the history
Upload backup of PI file after processing
  • Loading branch information
QuanMPhm authored May 23, 2024
2 parents 18ff61f + 7b96ea9 commit e61e4fd
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 @@ -388,6 +391,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 e61e4fd

Please sign in to comment.