in functions/source/Keep-job-alive/keepjobalive.py [0:0]
def removerow_creationtime(mrn, previously_reviewed):
'''
Given an MRN and PR it will remove
those rows from from os.environ['CREATIONTIME_JOBS'] file.
'''
key = os.environ['CREATIONTIME_JOBS']
bucket = os.environ['FEEDBACK_BUCKET']
s3_client = boto3.client('s3')
mrn = int(float(mrn))
# getting file object
csv_obj = s3_client.get_object(Bucket=bucket, Key=key)
# extracting the csv
body = csv_obj['Body']
# reading and decodying the csv by utf-8
csv_string = body.read().decode('utf-8')
# converting csv to stringIO and pandaslayer dataframe
dataframe = pd.read_csv(StringIO(csv_string))
# finding the rows tha have matching MRN and PR
indexnames = dataframe[
(dataframe['MRN'] == mrn) & (
dataframe['PR'] == previously_reviewed)].index
print('indexnames', indexnames)
# removing rows in the indexnames
dataframe.drop(indexnames, inplace=True)
# rewritng the dataframe to s3
write_dataframe_to_csv_on_s3(dataframe, key, bucket)
print('removed fileTime')