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
bd115b86
Commit
bd115b86
authored
Nov 24, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added dummy upload for debugging
parent
67bcbc39
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
928618 additions
and
0 deletions
+928618
-0
Energy_Dataset.csv
tools/dummy-upload/Energy_Dataset.csv
+928561
-0
readme.md
tools/dummy-upload/readme.md
+2
-0
upload_data.py
tools/dummy-upload/upload_data.py
+55
-0
No files found.
tools/dummy-upload/Energy_Dataset.csv
0 → 100644
View file @
bd115b86
This diff is collapsed.
Click to expand it.
tools/dummy-upload/readme.md
0 → 100644
View file @
bd115b86
# Dummy Upload
This script pushes all data from the smart energy dataset into our pipeline.
\ No newline at end of file
tools/dummy-upload/upload_data.py
0 → 100644
View file @
bd115b86
''' This script adds all data from BitYoga's csv to our pipeline.'''
import
csv
import
requests
# file to read the data from
CSV_FILE
=
r'Energy_Dataset.csv'
# token from Rest Gateway to authorize
JWT_TOKEN
=
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InJlZ3VsYXJAaXRlYy5hYXUuYXQiLCJjcmVhdGVkX2F0IjoiMjAyMC0xMC0wNiAwOTowNzoyMy44MjEyOTciLCJ2YWxpZF91bnRpbCI6IjIwMjAtMTAtMDcgMDk6MDc6MjMuODIxMjk3In0.orqTjn-3J4qMM0kpreWVPkwUEtUcgoqo6wsUFxKCrwg'
def
send_transaction_to_rest_gateway
(
transaction
:
dict
):
res
=
requests
.
post
(
url
=
'https://articonf1.itec.aau.at:30401/api/trace'
,
json
=
transaction
,
headers
=
{
"Authorization"
:
f
"Bearer {JWT_TOKEN}"
},
verify
=
False
# ignore ssl error
)
print
(
res
)
if
__name__
==
'__main__'
:
with
open
(
CSV_FILE
,
'r'
)
as
file
:
reader
=
csv
.
reader
(
file
)
titles
=
next
(
reader
)
summ
=
{}
for
row
in
reader
:
transaction
=
{}
transaction
[
'ApplicationType'
]
=
'smart-energy-luca'
transaction
[
'docType'
]
=
'smart-energy-luca'
for
idx
in
range
(
len
(
row
)):
transaction
[
titles
[
idx
]]
=
row
[
idx
]
# if int(transaction['Customer']) < 176:
# # only upload until 200 for now
# continue
send_transaction_to_rest_gateway
(
transaction
)
# 17520 per customer
cid
=
transaction
[
"Customer"
]
if
cid
not
in
summ
:
summ
[
cid
]
=
0
summ
[
cid
]
+=
1
sum2
=
list
(
summ
)
sum2
.
sort
()
print
([(
k
,
summ
[
k
])
for
k
in
sum2
])
# print(sum([v for v in summ.values()]))
\ No newline at end of file
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