Skip to content

Commit

Permalink
fixed double slashes which break newlines and result in unsuable data…
Browse files Browse the repository at this point in the history
… for quicksight
  • Loading branch information
Laurent Domb committed Aug 28, 2019
1 parent 925f838 commit 6105f75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions source/fraud_detection/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ def get_fraud_prediction(data):
return pred

def postprocess_event(event, pred):
millisecond_regex = r'\\.\\d+'
millisecond_regex = r'\.\d+'
timestamp = re.sub(millisecond_regex, '', str(datetime.datetime.now()))
source = random.choice(['Mobile', 'Web', 'Store'])
return [timestamp, 'random_id', source, str(pred)]

def store_data_prediction(data):
firehose_delivery_stream = 'fraud-detection-firehose-stream'
firehose = boto3.client('firehose', region_name=os.environ['AWS_REGION'])
record = ','.join(data) + '\\n'
record = ','.join(data) + '\n'
response = firehose.put_record(DeliveryStreamName=firehose_delivery_stream, Record={'Data': record})
return response

0 comments on commit 6105f75

Please sign in to comment.