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
d17dc5ab
Commit
d17dc5ab
authored
Apr 13, 2021
by
Lubber
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/pull-video-data' into develop
parents
c67bbdff
b8ebdf2a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
62 deletions
+70
-62
add_vialog_schema_new_enum.py
...add_use_case_scripts/vialog/add_vialog_schema_new_enum.py
+1
-2
add_change.py
...ice/app/_add_use_case_scripts/vialog/tables/add_change.py
+2
-0
add_video.py
...vice/app/_add_use_case_scripts/vialog/tables/add_video.py
+60
-55
pull_video_data.py
src/rest-gateway/app/pull_video_data.py
+7
-5
No files found.
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/vialog/add_vialog_schema_new.py
→
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/vialog/add_vialog_schema_new
_enum
.py
View file @
d17dc5ab
...
@@ -30,12 +30,11 @@ def add_use_case(use_case: str):
...
@@ -30,12 +30,11 @@ def add_use_case(use_case: str):
print
(
url
+
": "
+
str
(
response
.
content
))
print
(
url
+
": "
+
str
(
response
.
content
))
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
use_case
=
"vialog-new"
use_case
=
"vialog-new
-enum
"
# disable ssl warnings :)
# disable ssl warnings :)
requests
.
packages
.
urllib3
.
disable_warnings
()
requests
.
packages
.
urllib3
.
disable_warnings
()
add_use_case
(
use_case
)
add_use_case
(
use_case
)
add_user
.
main
(
use_case
)
add_video
.
main
(
use_case
)
add_video
.
main
(
use_case
)
add_change
.
main
(
use_case
)
add_change
.
main
(
use_case
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/vialog/tables/add_change.py
View file @
d17dc5ab
...
@@ -14,6 +14,8 @@ def add_table(use_case: str, table_name: str):
...
@@ -14,6 +14,8 @@ def add_table(use_case: str, table_name: str):
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"videoId+changeId"
columns
[
"UniqueID"
]
=
"videoId+changeId"
columns
[
"changeType"
]
=
"enum(changeType)"
columns
[
"changedValue"
]
=
"enum(changedValue)"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/vialog/tables/add_video.py
View file @
d17dc5ab
...
@@ -6,27 +6,32 @@ def add_table(use_case: str, table_name: str):
...
@@ -6,27 +6,32 @@ def add_table(use_case: str, table_name: str):
'''
'''
columns
=
[
columns
=
[
# "docType",
'videoId'
,
"videoId"
,
'objType'
,
"Video_Token"
,
'eventName'
,
"replyTo"
,
'video_token'
,
"Created"
,
'replyTo'
,
"Duration"
,
'created'
,
"videoResolution"
,
'duration'
,
"Label"
,
'videoResolution'
,
"ThreadId"
,
'label'
,
"Position"
,
'threadId'
,
"ModifiedDate"
,
'position'
,
"Views"
,
'views'
,
"ModeratedBy"
,
'moderatedBy'
,
"CommunityManagerNotes"
,
'moderationDate'
,
"Rewards"
,
'communityManagerNotes'
,
"Video_State"
,
'rewards'
,
"Video_Type"
'video_state'
,
'video_type'
]
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"videoId"
columns
[
"UniqueID"
]
=
"videoId"
columns
[
"moderatedBy"
]
=
"enum(moderatedBy)"
columns
[
"video_state"
]
=
"enum(video_state)"
columns
[
"video_type"
]
=
"enum(video_type)"
columns
[
"videoResolution"
]
=
"enum(videoResolution)"
table
=
{
table
=
{
"name"
:
table_name
,
"name"
:
table_name
,
...
@@ -43,14 +48,14 @@ def add_layers(use_case:str, table_name: str):
...
@@ -43,14 +48,14 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"Manager_Layer"
,
"name"
:
"Manager_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"
Modified
Date"
,
"
moderation
Date"
,
"
M
oderatedBy"
,
"
m
oderatedBy"
,
"
Video_S
tate"
,
"
video_s
tate"
,
"
Video_T
ype"
"
video_t
ype"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"
M
oderatedBy"
,
"
m
oderatedBy"
,
"
Video_S
tate"
"
video_s
tate"
]
]
},
},
{
{
...
@@ -59,16 +64,16 @@ def add_layers(use_case:str, table_name: str):
...
@@ -59,16 +64,16 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"Video_Popularity_Layer"
,
"name"
:
"Video_Popularity_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"
L
abel"
,
"
l
abel"
,
"
C
reated"
,
"
c
reated"
,
"
V
iews"
,
"
v
iews"
,
"
R
ewards"
,
"
r
ewards"
,
"
Video_S
tate"
,
"
video_s
tate"
,
"
Video_T
ype"
"
video_t
ype"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"
V
iews"
,
"
v
iews"
,
"
Video_T
ype"
"
video_t
ype"
]
]
},
},
{
{
...
@@ -77,15 +82,15 @@ def add_layers(use_case:str, table_name: str):
...
@@ -77,15 +82,15 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"Video_Age_Layer"
,
"name"
:
"Video_Age_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"
L
abel"
,
"
l
abel"
,
"
C
reated"
,
"
c
reated"
,
"
V
iews"
,
"
v
iews"
,
"
R
ewards"
,
"
r
ewards"
,
"
Video_S
tate"
,
"
video_s
tate"
,
"
Video_T
ype"
"
video_t
ype"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"
C
reated"
"
c
reated"
]
]
},
},
{
{
...
@@ -94,15 +99,15 @@ def add_layers(use_case:str, table_name: str):
...
@@ -94,15 +99,15 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"Rewards_Layer"
,
"name"
:
"Rewards_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"
L
abel"
,
"
l
abel"
,
"
C
reated"
,
"
c
reated"
,
"
V
iews"
,
"
v
iews"
,
"
R
ewards"
,
"
r
ewards"
,
"
Video_S
tate"
,
"
video_s
tate"
,
"
Video_T
ype"
"
video_t
ype"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"
R
ewards"
"
r
ewards"
]
]
},
},
{
{
...
@@ -111,14 +116,14 @@ def add_layers(use_case:str, table_name: str):
...
@@ -111,14 +116,14 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"Video_Lenght_Layer"
,
"name"
:
"Video_Lenght_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"
C
reated"
,
"
c
reated"
,
"
V
iews"
,
"
v
iews"
,
"
D
uration"
,
"
d
uration"
,
"
Video_S
tate"
,
"
video_s
tate"
,
"
Video_T
ype"
"
video_t
ype"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"
D
uration"
"
d
uration"
]
]
},
},
{
{
...
@@ -127,11 +132,11 @@ def add_layers(use_case:str, table_name: str):
...
@@ -127,11 +132,11 @@ def add_layers(use_case:str, table_name: str):
"name"
:
"Video_Resolution_Layer"
,
"name"
:
"Video_Resolution_Layer"
,
"properties"
:
[
"properties"
:
[
"UniqueID"
,
"UniqueID"
,
"
C
reated"
,
"
c
reated"
,
"
V
iews"
,
"
v
iews"
,
"videoResolution"
,
"videoResolution"
,
"
Video_S
tate"
,
"
video_s
tate"
,
"
Video_T
ype"
"
video_t
ype"
],
],
"cluster_properties"
:
[
"cluster_properties"
:
[
"videoResolution"
"videoResolution"
...
...
src/rest-gateway/app/pull_video_data.py
View file @
d17dc5ab
...
@@ -8,6 +8,8 @@ videoUrl = "https://dev758755.vialog.app/stat/events?type=video&id="
...
@@ -8,6 +8,8 @@ videoUrl = "https://dev758755.vialog.app/stat/events?type=video&id="
# token from Rest Gateway to authorize
# token from Rest Gateway to authorize
JWT_TOKEN
=
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InJlZ3VsYXJAaXRlYy5hYXUuYXQiLCJjcmVhdGVkX2F0IjoiMjAyMS0wNC0wNyAxMjo0OTo0MS43MTkzNjQiLCJ2YWxpZF91bnRpbCI6IjIwMjEtMDQtMDggMTI6NDk6NDEuNzE5MzY0In0.FN6qqBQeJSmXtS0-0dBiL-ojz6Ou7E5Tc9macrrhM4A'
JWT_TOKEN
=
'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InJlZ3VsYXJAaXRlYy5hYXUuYXQiLCJjcmVhdGVkX2F0IjoiMjAyMS0wNC0wNyAxMjo0OTo0MS43MTkzNjQiLCJ2YWxpZF91bnRpbCI6IjIwMjEtMDQtMDggMTI6NDk6NDEuNzE5MzY0In0.FN6qqBQeJSmXtS0-0dBiL-ojz6Ou7E5Tc9macrrhM4A'
useCase
=
"vialog-new-enum"
def
send_transaction_to_rest_gateway
(
transaction
:
dict
):
def
send_transaction_to_rest_gateway
(
transaction
:
dict
):
res
=
requests
.
post
(
res
=
requests
.
post
(
url
=
'https://articonf1.itec.aau.at:30401/api/trace'
,
url
=
'https://articonf1.itec.aau.at:30401/api/trace'
,
...
@@ -36,7 +38,7 @@ for video in videosRequest.json():
...
@@ -36,7 +38,7 @@ for video in videosRequest.json():
print
(
f
"Status: {videoRequest.status_code}"
)
print
(
f
"Status: {videoRequest.status_code}"
)
if
videoRequest
.
text
!=
""
and
not
videoRequest
.
text
.
startswith
(
"<!DOCTYPE html>"
):
if
videoRequest
.
text
!=
""
and
not
videoRequest
.
text
.
startswith
(
"<!DOCTYPE html>"
):
print
(
f
"
\n\n
{videoUrl}{id}
\n
{videoRequest.text}
"
)
print
(
f
"
\n\n
{videoUrl}{id}"
)
historyList
=
sorted
(
videoRequest
.
json
()[
0
][
"History"
],
key
=
lambda
k
:
k
[
'moderationDate'
],
reverse
=
True
)
historyList
=
sorted
(
videoRequest
.
json
()[
0
][
"History"
],
key
=
lambda
k
:
k
[
'moderationDate'
],
reverse
=
True
)
historyList
.
append
(
empty
)
historyList
.
append
(
empty
)
...
@@ -48,10 +50,10 @@ for video in videosRequest.json():
...
@@ -48,10 +50,10 @@ for video in videosRequest.json():
if
i
==
0
:
if
i
==
0
:
lastState
=
eventMap
lastState
=
eventMap
lastState
[
"App
icationType"
]
=
"vialog-new"
lastState
[
"App
licationType"
]
=
useCase
lastState
[
"docType"
]
=
"video"
lastState
[
"docType"
]
=
"video"
#send_transaction_to_rest_gateway(lastState
)
print
(
f
"{lastState}
\n\n\n
"
)
print
(
lastState
)
send_transaction_to_rest_gateway
(
lastState
)
if
eventMap
[
"eventName"
]
==
'r1eabcbdc8f5378b2ba71a1b6fe2038b Created'
or
eventMap
[
"eventName"
]
==
'Created'
:
if
eventMap
[
"eventName"
]
==
'r1eabcbdc8f5378b2ba71a1b6fe2038b Created'
or
eventMap
[
"eventName"
]
==
'Created'
:
change
=
{
"changeType"
:
"Created"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
""
,
"newValue"
:
"Created"
}
change
=
{
"changeType"
:
"Created"
,
"changedValue"
:
"video_state"
,
"previousValue"
:
""
,
"newValue"
:
"Created"
}
...
@@ -79,7 +81,7 @@ for video in videosRequest.json():
...
@@ -79,7 +81,7 @@ for video in videosRequest.json():
change
[
"videoId"
]
=
id
change
[
"videoId"
]
=
id
change
[
"changeId"
]
=
i
change
[
"changeId"
]
=
i
change
[
"timestamp"
]
=
eventMap
[
"moderationDate"
]
change
[
"timestamp"
]
=
eventMap
[
"moderationDate"
]
change
[
"ApplicationType"
]
=
"vialog-new"
change
[
"ApplicationType"
]
=
useCase
change
[
"docType"
]
=
"change"
change
[
"docType"
]
=
"change"
print
(
change
)
print
(
change
)
send_transaction_to_rest_gateway
(
change
)
send_transaction_to_rest_gateway
(
change
)
...
...
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