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
e690562c
Commit
e690562c
authored
Apr 06, 2021
by
Manuel Herold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upload script for traces
parent
0f7bfca8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
121 additions
and
10 deletions
+121
-10
add_crowdjournalism_schema.py
...se_scripts/crowd_journalism/add_crowdjournalism_schema.py
+1
-1
add_classification.py
...ase_scripts/crowd_journalism/tables/add_classification.py
+1
-0
add_event.py
...add_use_case_scripts/crowd_journalism/tables/add_event.py
+2
-1
add_purchase.py
..._use_case_scripts/crowd_journalism/tables/add_purchase.py
+4
-0
add_tag.py
.../_add_use_case_scripts/crowd_journalism/tables/add_tag.py
+3
-7
add_video.py
...add_use_case_scripts/crowd_journalism/tables/add_video.py
+4
-1
clone_use_case.py
...ion-hub/business-logic-microservice/app/clone_use_case.py
+106
-0
No files found.
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/add_crowdjournalism_schema.py
View file @
e690562c
...
...
@@ -29,7 +29,7 @@ def add_use_case(use_case: str):
print
(
url
+
": "
+
str
(
response
.
content
))
if
__name__
==
"__main__"
:
use_case
=
"crowd-journalism"
use_case
=
"crowd-journalism
-enum
"
# disable ssl warnings :)
requests
.
packages
.
urllib3
.
disable_warnings
()
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_classification.py
View file @
e690562c
...
...
@@ -18,6 +18,7 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"userid+videoid"
columns
[
"objecttype"
]
=
"enum(objecttype)"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_event.py
View file @
e690562c
...
...
@@ -17,7 +17,8 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"eventid"
columns
[
"firstTag"
]
=
"tags[0]"
columns
[
"firstTag"
]
=
"enum(tags[0])"
columns
[
"objecttype"
]
=
"enum(objecttype)"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_purchase.py
View file @
e690562c
...
...
@@ -17,6 +17,10 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"userid+videoid+ownerid"
columns
[
"objecttype"
]
=
"enum(objecttype)"
columns
[
"userid"
]
=
"enum(userid)"
columns
[
"ownerid"
]
=
"enum(ownerid)"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_tag.py
View file @
e690562c
...
...
@@ -5,13 +5,9 @@ def add_table(use_case: str, table_name: str):
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"objecttype"
,
"tag"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{}
columns
[
"tag"
]
=
"enum(tag)"
columns
[
"objecttype"
]
=
"enum(objecttype)"
columns
[
"UniqueID"
]
=
"objecttype+tag"
table
=
{
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_video.py
View file @
e690562c
...
...
@@ -33,7 +33,10 @@ def add_table(use_case: str, table_name: str):
columns
[
"UniqueID"
]
=
"videoid"
columns
[
"encodedAudio"
]
=
"codec//audio"
columns
[
"encodedVideo"
]
=
"codec//video"
columns
[
"firstTag"
]
=
"tags[0]"
columns
[
"objecttype"
]
=
"enum(objecttype)"
columns
[
"duration"
]
=
"enum(duration)"
columns
[
"firstTag"
]
=
"enum(tags[0])"
table
=
{
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/clone_use_case.py
0 → 100644
View file @
e690562c
import
sys
import
os
import
json
from
pathlib
import
Path
from
typing
import
Dict
,
Any
import
requests
requests
.
packages
.
urllib3
.
disable_warnings
()
modules_paths
=
[
'.'
,
'../../../modules/'
]
for
modules_path
in
modules_paths
:
if
os
.
path
.
exists
(
modules_path
):
sys
.
path
.
insert
(
1
,
modules_path
)
import
network_constants
as
nc
from
security.token_manager
import
TokenManager
use_case_from
=
"crowd-journalism"
use_case_to
=
"crowd-journalism-enum"
# 1. get all tables for the use-case
from
db.entities.table
import
Table
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case_from}/tables"
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
)
tables
=
json
.
loads
(
response
.
content
)
tables
=
[
Table
.
from_serializable_dict
(
row
)
for
row
in
tables
]
print
(
f
"|tables|={len(tables)}"
)
#2. fetch layers for tables
from
db.entities.layer_adapter
import
LayerAdapter
url
=
f
"https://articonf1.itec.aau.at:30420/api/use-cases/{use_case_from}/layers"
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
)
layers
=
json
.
loads
(
response
.
content
)
layers
=
[
LayerAdapter
.
from_serializable_dict
(
row
)
for
row
in
layers
]
print
(
f
"|layers|={len(layers)}"
)
# 3. fetch transactions for use-case
url
=
f
"https://articonf1.itec.aau.at:30001/api/use_cases/{use_case_from}/transactions"
response
=
requests
.
get
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
)
transactions
=
json
.
loads
(
response
.
content
)
print
(
f
"|transactions|={len(transactions)}"
)
ignored_fields
=
[
"ApplicationType"
,
"docType"
,
"UniqueID"
]
for
table
in
tables
:
for
transaction
in
transactions
:
if
transaction
[
"table"
]
!=
table
.
name
:
continue
data
=
{
"ApplicationType"
:
use_case_to
,
"docType"
:
table
.
name
,
}
if
table
.
name
==
"video"
:
data
[
"codec"
]
=
{
"audio"
:
transaction
[
"properties"
][
"encodedAudio"
],
"video"
:
transaction
[
"properties"
][
"encodedVideo"
]
}
data
[
"tags"
]
=
[
transaction
[
"properties"
][
"firstTag"
]]
if
table
.
name
==
"event"
:
data
[
"tags"
]
=
[
transaction
[
"properties"
][
"firstTag"
]]
for
key
,
value
in
transaction
[
"properties"
]
.
items
():
if
key
not
in
ignored_fields
:
data
[
key
]
=
value
# post the new trace
url
=
f
"https://articonf1.itec.aau.at:30401/api/trace"
response
=
requests
.
post
(
url
,
verify
=
False
,
proxies
=
{
"http"
:
None
,
"https"
:
None
},
headers
=
{
"Authorization"
:
f
"Bearer {jwt}"
},
json
=
data
)
print
(
url
+
": "
+
str
(
response
.
status_code
))
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