Commit d17dc5ab authored by Lubber's avatar Lubber

Merge branch 'feature/pull-video-data' into develop

parents c67bbdff b8ebdf2a
...@@ -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
...@@ -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,
......
...@@ -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",
"ModifiedDate", "moderationDate",
"ModeratedBy", "moderatedBy",
"Video_State", "video_state",
"Video_Type" "video_type"
], ],
"cluster_properties": [ "cluster_properties": [
"ModeratedBy", "moderatedBy",
"Video_State" "video_state"
] ]
}, },
{ {
...@@ -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",
"Label", "label",
"Created", "created",
"Views", "views",
"Rewards", "rewards",
"Video_State", "video_state",
"Video_Type" "video_type"
], ],
"cluster_properties": [ "cluster_properties": [
"Views", "views",
"Video_Type" "video_type"
] ]
}, },
{ {
...@@ -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",
"Label", "label",
"Created", "created",
"Views", "views",
"Rewards", "rewards",
"Video_State", "video_state",
"Video_Type" "video_type"
], ],
"cluster_properties": [ "cluster_properties": [
"Created" "created"
] ]
}, },
{ {
...@@ -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",
"Label", "label",
"Created", "created",
"Views", "views",
"Rewards", "rewards",
"Video_State", "video_state",
"Video_Type" "video_type"
], ],
"cluster_properties": [ "cluster_properties": [
"Rewards" "rewards"
] ]
}, },
{ {
...@@ -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",
"Created", "created",
"Views", "views",
"Duration", "duration",
"Video_State", "video_state",
"Video_Type" "video_type"
], ],
"cluster_properties": [ "cluster_properties": [
"Duration" "duration"
] ]
}, },
{ {
...@@ -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",
"Created", "created",
"Views", "views",
"videoResolution", "videoResolution",
"Video_State", "video_state",
"Video_Type" "video_type"
], ],
"cluster_properties": [ "cluster_properties": [
"videoResolution" "videoResolution"
......
...@@ -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["AppicationType"] = "vialog-new" lastState["ApplicationType"] = 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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment