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
20247ffe
Commit
20247ffe
authored
Dec 21, 2020
by
Alexander Lercher
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/schema-mapping' into 'develop'
Feature/schema mapping See merge request
!21
parents
4644e420
20a6aea9
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
877 additions
and
9 deletions
+877
-9
add_car.py
...e/app/_add_use_case_scripts/car_sharing/tables/add_car.py
+1
-1
add_hash.py
.../app/_add_use_case_scripts/car_sharing/tables/add_hash.py
+1
-1
add_offer.py
...app/_add_use_case_scripts/car_sharing/tables/add_offer.py
+1
-1
add_publication.py
...dd_use_case_scripts/car_sharing/tables/add_publication.py
+1
-1
add_travel.py
...pp/_add_use_case_scripts/car_sharing/tables/add_travel.py
+1
-1
add_user.py
.../app/_add_use_case_scripts/car_sharing/tables/add_user.py
+1
-2
add_crowdjournalism_schema.py
...se_scripts/crowd_journalism/add_crowdjournalism_schema.py
+43
-0
add_classification.py
...ase_scripts/crowd_journalism/tables/add_classification.py
+111
-0
add_event.py
...add_use_case_scripts/crowd_journalism/tables/add_event.py
+87
-0
add_purchase.py
..._use_case_scripts/crowd_journalism/tables/add_purchase.py
+106
-0
add_tag.py
.../_add_use_case_scripts/crowd_journalism/tables/add_tag.py
+60
-0
add_video.py
...add_use_case_scripts/crowd_journalism/tables/add_video.py
+213
-0
requestPost.py
...gic-microservice/app/_add_use_case_scripts/requestPost.py
+3
-2
add_vialog_schema.py
...ice/app/_add_use_case_scripts/vialog/add_vialog_schema.py
+41
-0
add_user.py
...rvice/app/_add_use_case_scripts/vialog/tables/add_user.py
+59
-0
add_video.py
...vice/app/_add_use_case_scripts/vialog/tables/add_video.py
+148
-0
No files found.
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_car.py
View file @
20247ffe
from
_add_use_case_scripts.
car_sharing.tables.
requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_hash.py
View file @
20247ffe
from
_add_use_case_scripts.
car_sharing.tables.
requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_offer.py
View file @
20247ffe
from
_add_use_case_scripts.
car_sharing.tables.
requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_publication.py
View file @
20247ffe
from
_add_use_case_scripts.
car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
_add_use_case_scripts.
requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_travel.py
View file @
20247ffe
from
_add_use_case_scripts.
car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
_add_use_case_scripts.
requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/car_sharing/tables/add_user.py
View file @
20247ffe
from
_add_use_case_scripts.car_sharing.tables.requestPost
import
postLayersToSwagger
,
postTableToSwagger
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
...
...
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/add_crowdjournalism_schema.py
0 → 100644
View file @
20247ffe
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.crowd_journalism.tables
import
add_video
,
add_tag
,
add_purchase
,
add_event
,
add_classification
import
network_constants
as
nc
from
security.token_manager
import
TokenManager
def
add_use_case
(
use_case
:
str
):
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
=
"crowd-journalism"
# disable ssl warnings :)
requests
.
packages
.
urllib3
.
disable_warnings
()
add_use_case
(
use_case
)
add_video
.
main
(
use_case
)
add_tag
.
main
(
use_case
)
add_classification
.
main
(
use_case
)
add_event
.
main
(
use_case
)
add_purchase
.
main
(
use_case
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_classification.py
0 → 100644
View file @
20247ffe
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"objecttype"
,
"userid"
,
"videoid"
,
"informative"
,
"impact"
,
"trustiness"
,
"lastupdate"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"userid+videoid"
table
=
{
"name"
:
table_name
,
"mappings"
:
columns
}
postTableToSwagger
(
use_case
,
table
)
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
{
#Useless as all objects aree Classification?
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Object_Type_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"userid"
,
"videoid"
,
"informative"
,
"impact"
,
"trustiness"
,
"lastupdate"
],
"cluster_properties"
:
[
"objecttype"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Informative_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"userid"
,
"videoid"
,
"informative"
,
"impact"
,
"trustiness"
,
"lastupdate"
],
"cluster_properties"
:
[
"informative"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Impact_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"userid"
,
"videoid"
,
"informative"
,
"impact"
,
"trustiness"
,
"lastupdate"
],
"cluster_properties"
:
[
"impact"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Trust_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"userid"
,
"videoid"
,
"informative"
,
"impact"
,
"trustiness"
,
"lastupdate"
],
"cluster_properties"
:
[
"trustiness"
]
}
]
postLayersToSwagger
(
use_case
,
layers
)
def
main
(
use_case
:
str
):
print
(
"Classification"
)
table_name
=
"classification"
add_table
(
use_case
,
table_name
)
add_layers
(
use_case
,
table_name
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_event.py
0 → 100644
View file @
20247ffe
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
'''
#TODO: split eventEpicenter
#TODO: tags is an array, deal with arrays
columns
=
[
# "docType",
"objecttype"
,
"eventid"
,
#"tags",
"eventEpicenter"
,
#TODO
"range"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"eventid"
columns
[
"firstTag"
]
=
"tags[0]"
table
=
{
"name"
:
table_name
,
"mappings"
:
columns
}
postTableToSwagger
(
use_case
,
table
)
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
{
#Useless as all objects are of the same type???
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Object_Type_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"eventid"
,
"eventEpicenter"
,
"range"
,
"firstTag"
],
"cluster_properties"
:
[
"objecttype"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Tag_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"eventid"
,
"evenEpicenter"
,
"range"
,
"firstTag"
],
"cluster_properties"
:
[
"firstTag"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Event_Epicenter_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"eventid"
,
"evenEpicenter"
,
"range"
,
"firstTag"
],
"cluster_properties"
:
[
"eventEpicenter"
]
}
]
postLayersToSwagger
(
use_case
,
layers
)
def
main
(
use_case
:
str
):
print
(
"event"
)
table_name
=
"event"
add_table
(
use_case
,
table_name
)
add_layers
(
use_case
,
table_name
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_purchase.py
0 → 100644
View file @
20247ffe
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"objecttype"
,
"timestamp"
,
"userid"
,
"videoid"
,
"price"
,
"ownerid"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"userid+videoid+ownerid"
table
=
{
"name"
:
table_name
,
"mappings"
:
columns
}
postTableToSwagger
(
use_case
,
table
)
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
{
#Useless as all objects aree Classification?
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Object_Type_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"timestamp"
,
"userid"
,
"videoid"
,
"price"
,
"ownerid"
],
"cluster_properties"
:
[
"objecttype"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Price_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"timestamp"
,
"userid"
,
"videoid"
,
"price"
,
"ownerid"
],
"cluster_properties"
:
[
"price"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Owner_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"timestamp"
,
"userid"
,
"videoid"
,
"price"
,
"ownerid"
],
"cluster_properties"
:
[
"ownerid"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Buyer_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"timestamp"
,
"userid"
,
"videoid"
,
"price"
,
"ownerid"
],
"cluster_properties"
:
[
"userid"
]
}
]
postLayersToSwagger
(
use_case
,
layers
)
def
main
(
use_case
:
str
):
print
(
"purchase"
)
table_name
=
"purchase"
add_table
(
use_case
,
table_name
)
add_layers
(
use_case
,
table_name
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_tag.py
0 → 100644
View file @
20247ffe
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"objecttype"
,
"tag"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"objecttype+tag"
table
=
{
"name"
:
table_name
,
"mappings"
:
columns
}
postTableToSwagger
(
use_case
,
table
)
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
{
#Useless as all objects aree the same type??
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Object_Type_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"tag"
],
"cluster_properties"
:
[
"objecttype"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Tag_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"tag"
],
"cluster_properties"
:
[
"tag"
]
}
]
postLayersToSwagger
(
use_case
,
layers
)
def
main
(
use_case
:
str
):
print
(
"tag"
)
table_name
=
"tag"
add_table
(
use_case
,
table_name
)
add_layers
(
use_case
,
table_name
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/crowd_journalism/tables/add_video.py
0 → 100644
View file @
20247ffe
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"objecttype"
,
"videoid"
,
"duration"
,
"price"
,
"creator"
,
"creationTimestamp"
,
#"tags",
"geolocation"
,
"eventid"
,
"lastupdate"
,
"md5"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"ready"
,
"path"
,
"preview"
,
#"thumbnails" #not important?
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"videoid"
columns
[
"encodedAudio"
]
=
"codec//audio"
columns
[
"encodedVideo"
]
=
"codec//video"
columns
[
"firstTag"
]
=
"tags[0]"
table
=
{
"name"
:
table_name
,
"mappings"
:
columns
}
postTableToSwagger
(
use_case
,
table
)
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
{
#Useless as all objects are Classification?
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Object_Type_Layer"
,
"properties"
:
[
"objecttype"
,
"videoid"
,
"duration"
,
"price"
,
"creator"
,
"creationTimestamp"
,
"lastupdate"
,
"firstTag"
],
"cluster_properties"
:
[
"objecttype"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Price_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"creationTimestamp"
,
"geolocation"
,
"videoid"
,
"price"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"firstTag"
],
"cluster_properties"
:
[
"price"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Tag_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"creationTimestamp"
,
"geolocation"
,
"videoid"
,
"price"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"firstTag"
],
"cluster_properties"
:
[
"firstTag"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Informative_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"creationTimestamp"
,
"geolocation"
,
"videoid"
,
"price"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"firstTag"
],
"cluster_properties"
:
[
"informativeRating"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Impact_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"creationTimestamp"
,
"geolocation"
,
"videoid"
,
"price"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"firstTag"
],
"cluster_properties"
:
[
"impactRating"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Trust_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"creationTimestamp"
,
"geolocation"
,
"videoid"
,
"price"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"firstTag"
],
"cluster_properties"
:
[
"trustinessRating"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Location_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"creationTimestamp"
,
"geolocation"
,
"videoid"
,
"price"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"firstTag"
],
"cluster_properties"
:
[
"geolocation"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Video_Age_Layer"
,
"properties"
:
[
"UniqueID"
,
"objecttype"
,
"creationTimestamp"
,
"geolocation"
,
"videoid"
,
"price"
,
"informativeRating"
,
"impactRating"
,
"trustinessRating"
,
"firstTag"
],
"cluster_properties"
:
[
"creationTimestamp"
]
}
]
postLayersToSwagger
(
use_case
,
layers
)
def
main
(
use_case
:
str
):
print
(
"video"
)
table_name
=
"video"
add_table
(
use_case
,
table_name
)
add_layers
(
use_case
,
table_name
)
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/
car_sharing/tables/
requestPost.py
→
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/requestPost.py
View file @
20247ffe
...
...
@@ -2,6 +2,7 @@
import
network_constants
as
nc
from
security.token_manager
import
TokenManager
import
requests
from
typing
import
List
def
postTableToSwagger
(
use_case
:
str
,
table
:
dict
):
...
...
@@ -20,7 +21,7 @@ def postTableToSwagger(use_case:str, table:dict ):
print
(
url
+
": "
+
str
(
response
.
status_code
)
+
" MSG:"
+
str
(
response
.
content
))
def
postLayersToSwagger
(
use_case
:
str
,
layers
:
dict
):
def
postLayersToSwagger
(
use_case
:
str
,
layers
:
List
[
dict
]
):
jwt
=
TokenManager
.
getInstance
()
.
getToken
()
...
...
@@ -35,4 +36,4 @@ def postLayersToSwagger(use_case:str, layers:dict):
json
=
layer
)
print
(
url
+
": "
+
str
(
response
.
status_code
)
+
" MSG:"
+
str
(
response
.
content
))
\ No newline at end of file
print
(
url
+
": "
+
str
(
response
.
status_code
)
+
" MSG:"
+
str
(
response
.
content
))
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/vialog/add_vialog_schema.py
0 → 100644
View file @
20247ffe
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
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"
# disable ssl warnings :)
requests
.
packages
.
urllib3
.
disable_warnings
()
add_use_case
(
use_case
)
add_user
.
main
(
use_case
)
add_video
.
main
(
use_case
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/vialog/tables/add_user.py
0 → 100644
View file @
20247ffe
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"userId"
,
"rewardBalance"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"userId"
table
=
{
"name"
:
table_name
,
"mappings"
:
columns
}
postTableToSwagger
(
use_case
,
table
)
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"User_Layer"
,
"properties"
:
[
"UniqueID"
,
"rewardBalance"
],
"cluster_properties"
:
[
"UniqueID"
,
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"User_Balance_Layer"
,
"properties"
:
[
"UniqueID"
,
"rewardBalance"
],
"cluster_properties"
:
[
"rewardBalance"
]
}
]
postLayersToSwagger
(
use_case
,
layers
)
def
main
(
use_case
:
str
):
print
(
"user"
)
table_name
=
"user"
add_table
(
use_case
,
table_name
)
add_layers
(
use_case
,
table_name
)
\ No newline at end of file
src/participation-hub/business-logic-microservice/app/_add_use_case_scripts/vialog/tables/add_video.py
0 → 100644
View file @
20247ffe
from
_add_use_case_scripts.requestPost
import
postLayersToSwagger
,
postTableToSwagger
def
add_table
(
use_case
:
str
,
table_name
:
str
):
'''
take the columns and add the mappings at the server
replace all "/"'s in the internal representation with a "_"
'''
columns
=
[
# "docType",
"videoId"
,
"Video_Token"
,
"replyTo"
,
"Created"
,
"Duration"
,
"videoResolution"
,
"Label"
,
"ThreadId"
,
"Position"
,
"ModifiedDate"
,
"Views"
,
"ModeratedBy"
,
"CommunityManagerNotes"
,
"Rewards"
,
"Video_State"
,
"Video_Type"
]
columns
=
{
c
:
c
for
c
in
columns
}
columns
[
"UniqueID"
]
=
"videoId"
table
=
{
"name"
:
table_name
,
"mappings"
:
columns
}
postTableToSwagger
(
use_case
,
table
)
def
add_layers
(
use_case
:
str
,
table_name
:
str
):
layers
=
[
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Manager_Layer"
,
"properties"
:
[
"UniqueID"
,
"ModifiedDate"
,
"ModeratedBy"
,
"Video_State"
,
"Video_Type"
],
"cluster_properties"
:
[
"ModeratedBy"
,
"Video_State"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Video_Popularity_Layer"
,
"properties"
:
[
"UniqueID"
,
"Label"
,
"Created"
,
"Views"
,
"Rewards"
,
"Video_State"
,
"Video_Type"
],
"cluster_properties"
:
[
"Views"
,
"Video_Type"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Video_Age_Layer"
,
"properties"
:
[
"UniqueID"
,
"Label"
,
"Created"
,
"Views"
,
"Rewards"
,
"Video_State"
,
"Video_Type"
],
"cluster_properties"
:
[
"Created"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Rewards_Layer"
,
"properties"
:
[
"UniqueID"
,
"Label"
,
"Created"
,
"Views"
,
"Rewards"
,
"Video_State"
,
"Video_Type"
],
"cluster_properties"
:
[
"Rewards"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Video_Lenght_Layer"
,
"properties"
:
[
"UniqueID"
,
"Created"
,
"Views"
,
"Duration"
,
"Video_State"
,
"Video_Type"
],
"cluster_properties"
:
[
"Duration"
]
},
{
"use_case"
:
use_case
,
"table"
:
table_name
,
"name"
:
"Video_Resolution_Layer"
,
"properties"
:
[
"UniqueID"
,
"Created"
,
"Views"
,
"videoResolution"
,
"Video_State"
,
"Video_Type"
],
"cluster_properties"
:
[
"videoResolution"
]
}
]
postLayersToSwagger
(
use_case
,
layers
)
def
main
(
use_case
:
str
):
print
(
"Video"
)
table_name
=
"video"
add_table
(
use_case
,
table_name
)
add_layers
(
use_case
,
table_name
)
\ No newline at end of file
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