Skip to content

Commit

Permalink
Merge pull request #2 from ldomb/fix-double-quotes-which-break-newline
Browse files Browse the repository at this point in the history
fixed double slashes which break newlines and result in unsuable data…
  • Loading branch information
sojiadeshina authored Sep 9, 2019
2 parents 925f838 + 6105f75 commit 69c66e0
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 69c66e0

Please sign in to comment.