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
259e6339
Commit
259e6339
authored
Oct 27, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created direct upload for bank-app data
parent
935c80f7
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25056 additions
and
3 deletions
+25056
-3
bank_data.csv
...king-microservice/app/dummy_upload/bank_app/bank_data.csv
+25001
-0
dummy_upload.py
...ng-microservice/app/dummy_upload/bank_app/dummy_upload.py
+51
-0
Energy_Dataset.csv
...oservice/app/dummy_upload/smart_energy/Energy_Dataset.csv
+0
-0
dummy_upload.py
...icroservice/app/dummy_upload/smart_energy/dummy_upload.py
+4
-3
No files found.
src/data-hub/semantic-linking-microservice/app/dummy_upload/bank_app/bank_data.csv
0 → 100644
View file @
259e6339
This diff is collapsed.
Click to expand it.
src/data-hub/semantic-linking-microservice/app/dummy_upload/bank_app/dummy_upload.py
0 → 100644
View file @
259e6339
import
csv
import
hashlib
import
sys
import
os
modules_paths
=
[
'.'
,
'../../../modules/'
]
for
modules_path
in
modules_paths
:
if
os
.
path
.
exists
(
modules_path
):
sys
.
path
.
insert
(
1
,
modules_path
)
from
messaging.MessageHandler
import
MessageHandler
# file to read the data from
CSV_FILE
=
r'dummy_upload/bank_app/bank_data.csv'
handler
=
MessageHandler
()
def
upload_transaction
(
transaction
):
uid
=
hashlib
.
sha256
(
f
"{transaction['Transaction_ID']}{transaction['Timestamp']}"
.
encode
(
"utf-8"
))
.
hexdigest
()
transaction
[
'UniqueID'
]
=
uid
transaction
[
'ApplicationType'
]
=
'bank-app'
transaction
[
'docType'
]
=
'bank-app'
t
=
{
'use_case'
:
transaction
[
'ApplicationType'
],
'table'
:
transaction
[
'docType'
],
'id'
:
uid
,
'properties'
:
transaction
,
}
handler
.
handle_new_trace
(
t
)
type_mapping
=
{
'House Rent'
:
1
,
'Payback Loan'
:
2
,
'Initial Credit'
:
3
,
'Emergency Help'
:
4
,
'Friendly Help'
:
5
}
if
__name__
==
'__main__'
:
with
open
(
CSV_FILE
,
'r'
)
as
file
:
reader
=
csv
.
reader
(
file
)
titles
=
next
(
reader
)
for
row
in
reader
:
transaction
=
{}
for
idx
in
range
(
len
(
row
)):
transaction
[
titles
[
idx
]]
=
row
[
idx
]
transaction
[
'Transaction_Type'
]
=
type_mapping
[
transaction
[
'Transaction_Type'
]]
upload_transaction
(
transaction
)
src/data-hub/semantic-linking-microservice/app/Energy_Dataset.csv
→
src/data-hub/semantic-linking-microservice/app/
dummy_upload/smart_energy/
Energy_Dataset.csv
View file @
259e6339
File moved
src/data-hub/semantic-linking-microservice/app/dummy_upload.py
→
src/data-hub/semantic-linking-microservice/app/dummy_upload
/smart_energy/dummy_upload
.py
View file @
259e6339
...
...
@@ -3,9 +3,10 @@ import hashlib
import
sys
import
os
modules_path
=
'../../../modules/'
if
os
.
path
.
exists
(
modules_path
):
sys
.
path
.
insert
(
1
,
modules_path
)
modules_paths
=
[
'.'
,
'../../../modules/'
]
for
modules_path
in
modules_paths
:
if
os
.
path
.
exists
(
modules_path
):
sys
.
path
.
insert
(
1
,
modules_path
)
from
messaging.MessageHandler
import
MessageHandler
...
...
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