Commit e359a787 authored by Alexander Lercher's avatar Alexander Lercher

Corrected hashing

parent ba9da73a
import csv
import hashlib
import sys
import os
......@@ -18,7 +19,7 @@ def upload_transaction(transaction):
"content": {"use_case": "smart-energy", "table": "smart-energy", "id": "dd2c5146c919b046d77a32a5cf553d5133163562f7b7e1298c878c575d516025",
"properties": {"Customer": "297", "Energy_Consumption_kWh": "0.177", "Heating_Consumption_kWh": "0.0", "Latitude": "-33.362679", "Longitude": "151.447302", "Postcode": "2261", "Price_AUD_MWh": "58.05", "Solar_Production_kWh": "0.0", "Timestamp": "2013-06-30 00:00:00", "Total_Demand_MWh": "8154.14", "UniqueID": "dd2c5146c919b046d77a32a5cf553d5133163562f7b7e1298c878c575d516025"}
}}'''
uid = hash(str(transaction['Customer']) + str(transaction['Timestamp']))
uid = hashlib.sha256(f"{transaction['Customer']}{transaction['Timestamp']}".encode("utf-8")).hexdigest()
transaction['UniqueID'] = uid
t = {
'use_case': 'smart-energy',
......@@ -43,6 +44,9 @@ if __name__ == '__main__':
for idx in range(len(row)):
transaction[titles[idx]] = row[idx]
if int(transaction['Customer']) < 20:
continue
if transaction['Customer'] != old_c:
# only upload until 200 for now
old_c = transaction['Customer']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment