Commit ba7a3462 authored by Lubber's avatar Lubber

Vialog schema update

parent d8826043
import sys
import os
from pathlib import Path
from typing import Dict, Any
import requests
modules_paths = ['.', '../../../modules/']
for modules_path in modules_paths:
if os.path.exists(modules_path):
sys.path.insert(1, modules_path)
from _add_use_case_scripts.vialog.tables import add_user, add_video, add_change
import network_constants as nc
from security.token_manager import TokenManager
def add_use_case(use_case: str):
#use_case = "vialog"
jwt = TokenManager.getInstance().getToken()
url = f"https://articonf1.itec.aau.at:30420/api/use-cases"
response = requests.post(
url,
verify=False,
proxies = { "http":None, "https":None },
headers = { "Authorization": f"Bearer {jwt}"},
json = {"name": use_case}
)
print(url+": "+str(response.content))
if __name__ == "__main__":
use_case = "vialog-new"
# disable ssl warnings :)
requests.packages.urllib3.disable_warnings()
add_use_case(use_case)
add_user.main(use_case)
add_video.main(use_case)
add_change.main(use_case)
\ No newline at end of file
...@@ -13,7 +13,7 @@ def add_table(use_case: str, table_name: str): ...@@ -13,7 +13,7 @@ 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" columns["UniqueID"] = "videoId+changeId"
table = { table = {
"name": table_name, "name": table_name,
...@@ -41,6 +41,8 @@ def add_layers(use_case:str, table_name: str): ...@@ -41,6 +41,8 @@ def add_layers(use_case:str, table_name: str):
"name": "Changedvalue_Layer", "name": "Changedvalue_Layer",
"properties": [ "properties": [
"changedValue", "changedValue",
"previousValue",
"newValue"
], ],
"cluster_properties": [ "cluster_properties": [
"changedValue" "changedValue"
......
...@@ -6,7 +6,7 @@ videoListUrl = "https://dev758755.vialog.app/Videos/Meta/ListAll" ...@@ -6,7 +6,7 @@ videoListUrl = "https://dev758755.vialog.app/Videos/Meta/ListAll"
videoUrl = "https://dev758755.vialog.app/stat/events?type=video&id=" 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.eyJ1c2VybmFtZSI6InJlZ3VsYXJAaXRlYy5hYXUuYXQiLCJjcmVhdGVkX2F0IjoiMjAyMC0xMC0wNiAwOTowNzoyMy44MjEyOTciLCJ2YWxpZF91bnRpbCI6IjIwMjAtMTAtMDcgMDk6MDc6MjMuODIxMjk3In0.orqTjn-3J4qMM0kpreWVPkwUEtUcgoqo6wsUFxKCrwg' JWT_TOKEN = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6InJlZ3VsYXJAaXRlYy5hYXUuYXQiLCJjcmVhdGVkX2F0IjoiMjAyMS0wNC0wNyAxMjo0OTo0MS43MTkzNjQiLCJ2YWxpZF91bnRpbCI6IjIwMjEtMDQtMDggMTI6NDk6NDEuNzE5MzY0In0.FN6qqBQeJSmXtS0-0dBiL-ojz6Ou7E5Tc9macrrhM4A'
def send_transaction_to_rest_gateway(transaction: dict): def send_transaction_to_rest_gateway(transaction: dict):
res = requests.post( res = requests.post(
...@@ -48,8 +48,8 @@ for video in videosRequest.json(): ...@@ -48,8 +48,8 @@ for video in videosRequest.json():
if i == 0: if i == 0:
lastState = eventMap lastState = eventMap
lastState["AppicationType"] = "vialog" lastState["AppicationType"] = "vialog-new"
lastState["docType"] = "vialog-video" lastState["docType"] = "video"
#send_transaction_to_rest_gateway(lastState) #send_transaction_to_rest_gateway(lastState)
print(lastState) print(lastState)
...@@ -77,11 +77,12 @@ for video in videosRequest.json(): ...@@ -77,11 +77,12 @@ for video in videosRequest.json():
change = {"changeType": "CustomLabel", "changedValue": "label", "previousValue": historyList[i+1]["label"], "newValue":eventMap["label"]} change = {"changeType": "CustomLabel", "changedValue": "label", "previousValue": historyList[i+1]["label"], "newValue":eventMap["label"]}
change["videoId"] = id change["videoId"] = id
change["changeId"] = i
change["timestamp"] = eventMap["moderationDate"] change["timestamp"] = eventMap["moderationDate"]
change["ApplicationType"] = "vialog" change["ApplicationType"] = "vialog-new"
change["docType"] = "vialog-change" change["docType"] = "change"
print(change) print(change)
#send_transaction_to_rest_gateway(change) send_transaction_to_rest_gateway(change)
i += 1 i += 1
elif videoRequest.text == "": elif videoRequest.text == "":
empty.add(id) empty.add(id)
......
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