Commit 56b9c64e authored by Bogdan's avatar Bogdan

Modified dummyUpload file

parent 9f4db2a6
...@@ -43,6 +43,7 @@ import processing.similarityFiles.dataInput as inputData ...@@ -43,6 +43,7 @@ import processing.similarityFiles.dataInput as inputData
################################## ##################################
def mainViz(): def mainViz():
#procesing data #procesing data
......
...@@ -16,14 +16,14 @@ handler = MessageHandler() ...@@ -16,14 +16,14 @@ handler = MessageHandler()
def upload_transaction(transaction): def upload_transaction(transaction):
'''{"type": "new-trace", '''{"type": "new-trace",
"content": {"use_case": "smart-energy", "table": "smart-energy", "id": "dd2c5146c919b046d77a32a5cf553d5133163562f7b7e1298c878c575d516025", "content": {"use_case": "paper", "table": "paper", "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"} "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 = hashlib.sha256(f"{transaction['Customer']}{transaction['Timestamp']}".encode("utf-8")).hexdigest() uid = hashlib.sha256(f"{transaction['Customer']}{transaction['Timestamp']}".encode("utf-8")).hexdigest()
transaction['UniqueID'] = uid transaction['UniqueID'] = uid
t = { t = {
'use_case': 'smart-energy', 'use_case': 'paper',
'table': 'smart-energy', 'table': 'paper',
'id': uid, 'id': uid,
'properties': transaction 'properties': transaction
} }
...@@ -36,21 +36,34 @@ if __name__ == '__main__': ...@@ -36,21 +36,34 @@ if __name__ == '__main__':
titles = next(reader) titles = next(reader)
#################
maxCustomers = 5
maxRows = 10
##################
old_c = None old_c = None
customersCount = 0
rowCount = 0
for row in reader: for row in reader:
transaction = {} transaction = {}
transaction['ApplicationType'] = 'smart-energy' transaction['ApplicationType'] = 'paper'
transaction['docType'] = 'smart-energy' transaction['docType'] = 'paper'
for idx in range(len(row)): for idx in range(len(row)):
transaction[titles[idx]] = row[idx] transaction[titles[idx]] = row[idx]
if int(transaction['Customer']) < 20:
continue
if transaction['Customer'] != old_c: if transaction['Customer'] != old_c:
# only upload until 200 for now customerCount +=1
rowCount = 0
old_c = transaction['Customer'] old_c = transaction['Customer']
print(f"uploading for {old_c}") print(f"uploading for {old_c}")
if(rowCount<maxRows):
upload_transaction(transaction) upload_transaction(transaction)
rowCount+=1
if (customerCount>maxCustomers-1):
print("\nMAX customers reached")
break
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