Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SMART
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UNI-KLU
SMART
Commits
e359a787
Commit
e359a787
authored
Oct 08, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Corrected hashing
parent
ba9da73a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
dummy_upload.py
...ata-hub/semantic-linking-microservice/app/dummy_upload.py
+5
-1
No files found.
src/data-hub/semantic-linking-microservice/app/dummy_upload.py
View file @
e359a787
import
csv
import
csv
import
hashlib
import
sys
import
sys
import
os
import
os
...
@@ -18,7 +19,7 @@ def upload_transaction(transaction):
...
@@ -18,7 +19,7 @@ def upload_transaction(transaction):
"content": {"use_case": "smart-energy", "table": "smart-energy", "id": "dd2c5146c919b046d77a32a5cf553d5133163562f7b7e1298c878c575d516025",
"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"}
"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
=
hash
lib
.
sha256
(
f
"{transaction['Customer']}{transaction['Timestamp']}"
.
encode
(
"utf-8"
))
.
hexdigest
(
)
transaction
[
'UniqueID'
]
=
uid
transaction
[
'UniqueID'
]
=
uid
t
=
{
t
=
{
'use_case'
:
'smart-energy'
,
'use_case'
:
'smart-energy'
,
...
@@ -43,6 +44,9 @@ if __name__ == '__main__':
...
@@ -43,6 +44,9 @@ if __name__ == '__main__':
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
# only upload until 200 for now
old_c
=
transaction
[
'Customer'
]
old_c
=
transaction
[
'Customer'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment