def update_timeline()

in functions/source/loop/loop_lambda.py [0:0]


def update_timeline(mrn, status, previously_reviewed):

    '''
    removes MRN that are completed from the timeline

    '''
    mrn = int(mrn)
    key = os.environ['CREATIONTIME_JOBS']
    bucket = os.environ['FEEDBACK_BUCKET']
    s3_client = boto3.client('s3')
    csv_obj = s3_client.get_object(Bucket=bucket, Key=key)
    body = csv_obj['Body']
    csv_string = body.read().decode('utf-8')
    dataframe = pd.read_csv(StringIO(csv_string))
    print('update time line')
    indexes = dataframe.loc[dataframe['MRN'] == mrn].index
    dataframe.loc[indexes, 'status'] = status
    dataframe.loc[indexes, 'PR'] = previously_reviewed
    current_time = time.localtime(time.time())
    timestamp = time.mktime(current_time)
    currenttime = date.fromtimestamp(timestamp)
    dataframe.loc[indexes, 'CreationTime'] = currenttime
    dataframe = dataframe.drop_duplicates()

    write_dataframe_to_csv_on_s3(dataframe, key, bucket)