Commit 20f6b9b2 authored by Alfonso Orta's avatar Alfonso Orta

Merge branch 'develop' into 'staging'

Develop

See merge request !42
parents 44c482cf f8162f4d
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Manuel Herold"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
RUN pip install connexion[swagger-ui] RUN pip install connexion[swagger-ui]
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Manuel Herold"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
EXPOSE 5000 EXPOSE 5000
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
EXPOSE 5000 EXPOSE 5000
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
EXPOSE 5000 EXPOSE 5000
......
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)
# import _add_use_case_scripts.car_sharing.tables.add_user as user
from _add_use_case_scripts.car_sharing_official.tables import add_car, add_hash, add_media, add_offer, add_offerEndPlaces, add_publication, add_travel, add_travelCancelledBy
from _add_use_case_scripts.car_sharing_official.tables import add_travelFinishedBy, add_travelStartedBy, add_travelSuggestedEndPlaces, add_travelUsers, add_user
import network_constants as nc
from security.token_manager import TokenManager
def add_use_case(use_case: str):
use_case = "car-sharing-official"
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 = "car-sharing-official"
# disable ssl warnings :)
requests.packages.urllib3.disable_warnings()
add_use_case(use_case)
add_car.main(use_case)
add_hash.main(use_case)
add_media.main(use_case)
add_offer.main(use_case)
add_offerEndPlaces.main(use_case)
add_publication.main(use_case)
add_travel.main(use_case)
add_travelCancelledBy.main(use_case)
add_travelFinishedBy.main(use_case)
add_travelStartedBy.main(use_case)
add_travelSuggestedEndPlaces.main(use_case)
add_travelUsers.main(use_case)
add_user.main(use_case)
\ No newline at end of file
from _add_use_case_scripts.car_sharing_official.tables import add_car
from _add_use_case_scripts.car_sharing_official.tables import add_hash
from _add_use_case_scripts.car_sharing_official.tables import add_offer
from _add_use_case_scripts.car_sharing_official.tables import add_offerEndPlaces
from _add_use_case_scripts.car_sharing_official.tables import add_publication
from _add_use_case_scripts.car_sharing_official.tables import add_travel
from _add_use_case_scripts.car_sharing_official.tables import add_travelCancelledBy
from _add_use_case_scripts.car_sharing_official.tables import add_travelFinishedBy
from _add_use_case_scripts.car_sharing_official.tables import add_travelStartedBy
from _add_use_case_scripts.car_sharing_official.tables import add_travelSuggestedEndPlaces
from _add_use_case_scripts.car_sharing_official.tables import add_travelUsers
from _add_use_case_scripts.car_sharing_official.tables import add_user
from _add_use_case_scripts.car_sharing_official.tables import requestPost
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 = [
"brand",
"carLicensePlate",
"colour",
"deleted",
"model",
"numberOfEvaluations",
"observations",
"ownerId",
"seats",
"state",
"sumOfEvaluations"
"year"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "carLicensePlate"
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": "GeneralCar_layer",
"properties": [
"UniqueID",
"brand",
"carLicensePlate",
"colour",
"deleted",
"model",
"numberOfEvaluations",
"observations",
"ownerId",
"seats",
"state",
"sumOfEvaluations"
"year"
],
"cluster_properties": [
"brand",
"model",
"seats",
"year",
"ownerId",
"state"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "Owner_layer",
"properties": [
"UniqueID",
"brand",
"carLicensePlate",
"colour",
"deleted",
"model",
"numberOfEvaluations",
"observations",
"ownerId",
"seats",
"state",
"sumOfEvaluations"
"year"
],
"cluster_properties": [
"OwnerID",
"UniqueID"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "CarAge_layer",
"properties": [
"UniqueID",
"brand",
"carLicensePlate",
"colour",
"deleted",
"model",
"numberOfEvaluations",
"observations",
"ownerId",
"seats",
"state",
"sumOfEvaluations"
"year"
],
"cluster_properties": [
"year",
"state"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "Model_layer",
"properties": [
"UniqueID",
"brand",
"carLicensePlate",
"colour",
"deleted",
"model",
"numberOfEvaluations",
"observations",
"ownerId",
"seats",
"state",
"sumOfEvaluations"
"year"
],
"cluster_properties": [
"brand",
"model",
"seats"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "CarState_layer",
"properties": [
"UniqueID",
"ownerId",
"deleted",
"state"
],
"cluster_properties": [
"deleted",
"state"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "CarEvaluation_layer",
"properties": [
"UniqueID",
"brand",
"colour",
"deleted",
"model",
"numberOfEvaluations",
"observations",
"ownerId",
"seats",
"state",
"sumOfEvaluations"
"year"
],
"cluster_properties": [
"numberOfEvaluations",
"sumOfEvaluations"
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("CAR")
table_name = "car"
add_table(use_case,table_name)
add_layers(use_case, table_name)
\ No newline at end of file
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 = [
"connection"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "documents[0]//id"
columns["database"] = "connection//database"
columns["databaseType"] = "connection//databaseType"
columns["host"] = "connection//host"
columns["port"] = "connection//port"
columns["documentCollection"] = "documents[0]//collection"
columns["documentHash"] = "documents[0]//hash"
columns["documentId"] = "documents[0]//id"
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": "document_Layer",
"properties": [
"UniqueID",
"documentCollection",
"documentHash",
"documentId"
],
"cluster_properties": [
"documentId",
"documentCollection"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "hostAndPort_Layer",
"properties": [
"UniqueID",
"database",
"databaseType",
"host",
"port"
],
"cluster_properties": [
"host",
"port"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "databaseType_Layer",
"properties": [
"UniqueID",
"database",
"databaseType",
"host",
"port"
],
"cluster_properties": [
"databaseType"
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("HASH")
table_name = "hash"
add_table(use_case,table_name)
add_layers(use_case,table_name)
\ No newline at end of file
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 = [
"data",
"extension",
"id",
"name",
"publication",
"type"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "publication+id"
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": "MediaExtension_Layer",
"properties": [
"UniqueID",
"data",
"extension",
"id",
"name",
"publication",
"type"
],
"cluster_properties": [
"extension"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "MediaType_Layer",
"properties": [
"UniqueID",
"data",
"extension",
"id",
"name",
"publication",
"type"
],
"cluster_properties": [
"type"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "MediaName_Layer",
"properties": [
"data",
"extension",
"id",
"name",
"publication",
"type"
],
"cluster_properties": [
"name"
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("MEDIA")
table_name = "media"
add_table(use_case,table_name)
add_layers(use_case, table_name)
\ No newline at end of file
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 = [
"available",
"deleted",
"deposit",
"endDate",
"id",
"priceForKm",
"priceForTime",
"startDate"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "id"
columns["carID"] = "car//carLicensePlate"
columns["carOwner"] = "car//ownerId"
columns["startPlaceAddress"] = "startPlace//address"
columns["startPlaceLatitude"] = "startPlace//latitude"
columns["startPlaceLongitude"] = "startPlace//longitude"
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": "OfferStartPlace_layer",
"properties": [
"UniqueID",
"carID",
"carOwner",
"startPlaceAddress",
"startPlaceLatitude",
"startPlaceLongitude",
"startDate"
],
"cluster_properties": [
"carOwner",
"startPlaceLatitude",
"startPlaceLongitude"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "OfferedCar_layer",
"properties": [
"UniqueID",
"carID",
"carOwner"
],
"cluster_properties": [
"carID",
"carOwner"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "OfferPrice_layer",
"properties": [
"UniqueID",
"carOwner",
"priceForKm",
"priceForTime",
"deposit"
],
"cluster_properties": [
"carOwner",
"priceForKm",
"priceForTime",
"deposit"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "OfferTime_layer",
"properties": [
"UniqueID",
"carOwner",
"startDate",
"endDate"
],
"cluster_properties": [
"carOwner",
"startDate",
"endDate"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "OfferStatus_layer",
"properties": [
"UniqueID",
"carOwner",
"available",
"deleted"
],
"cluster_properties": [
"carOwner",
"available",
"deleted"
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("OFFER")
table_name = "offer"
add_table(use_case,table_name)
add_layers(use_case,table_name)
\ No newline at end of file
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 = [
# None
]
#TODO unique id is dependent on offferId -> error?
columns = { c : c for c in columns }
columns["UniqueID"] = "offerId+endPlacesLatitude+endPlacesLongitude"
columns["offerId"] = "offer//id"
columns["endPlacesAddress"]= "endPlaces[0]//address",
columns["endPlacesLatitude"]= "endPlaces[0]//latitude",
columns["endPlacesLongitude"]= "endPlaces[0]//longitude"
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": "OfferEndPlace_layer",
"properties": [
"UniqueID",
"offerID",
"endPlacesAddress",
"endPlacesLatitude",
"endPlacesLongitude"
],
"cluster_properties": [
"endPlacesLatitude",
"endPlacesLongitude"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "OfferEndAddress_layer",
"properties": [
"UniqueID",
"offerID",
"endPlacesAddress",
"endPlacesLatitude",
"endPlacesLongitude"
],
"cluster_properties": [
"endPlacesAddress"
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("OFFER_ENDPLACES")
table_name = "offerEndPlaces"
add_table(use_case,table_name)
add_layers(use_case,table_name)
\ No newline at end of file
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 = [
"answerTo",
"date",
"deleted",
"id",
"labels",
"text",
"user"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "id"
columns["latitude"] = "location//latitude"
columns["longitude"] = "location//longitude"
columns["likesNumber"] = "likesUsers//length"
columns["reportsNumber"] = "usersReports//length"
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": "PublicationLocation_Layer",
"properties": [
"UniqueID",
"user",
"latitude",
"longitude"
],
"cluster_properties": [
"latitude",
"longitude"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "PublicationTime_Layer",
"properties": [
"UniqueID",
"user",
"latitude",
"longitude",
"date"
],
"cluster_properties": [
"date"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "PublicationUser_Layer",
"properties": [
"UniqueID",
"text",
"user",
"labels"
],
"cluster_properties": [
"user"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "PublicationStatus_Layer",
"properties": [
"UniqueID",
"text",
"user",
"deleted",
"answerTo"
],
"cluster_properties": [
"deleted",
"answerTo"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "PublicationLikeReport_Layer",
"properties": [
"UniqueID",
"text",
"user",
"deleted",
"answerTo",
"likesNumber",
"reportsNumber"
],
"cluster_properties": [
"likesNumber",
"reportsNumber"
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("PUBLICATION")
table_name = "publication"
add_table(use_case,table_name)
add_layers(use_case, table_name)
\ No newline at end of file
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 = [
"carLicensePlate",
"carOwner",
"depositBalance",
"endDate",
"id",
"observations",
"offerId",
"priceBalance",
"rentForTime",
"rewardBalance",
"seats",
"startDate",
"status",
"totalPrice",
]
columns = { c : c for c in columns }
columns["UniqueID"] = "id"
columns["endPlaceAddress"] = "endPlace//address"
columns["endPlaceLatitude"] = "endPlace//latitude"
columns["endPlaceLongitude"] = "endPlace//longitude"
columns["startPlaceAddress"] = "startPlace//address"
columns["startPlaceLatitude"] = "startPlace//latitude"
columns["startPlaceLongitude"] = "startPlace//longitude"
columns["checkedByUser"] = "checkedBy[0]//user"
columns["checkedByMoment"] = "checkedBy[0]//moment"
columns["checkedByLatitude"] = "checkedBy[0]//coordinate//latitude"
columns["checkedByLongitude"] = "checkedBy[0]//coordinate//longitude"
columns["checkedByState"] = "checkedBy[0]//state"
columns["scoreNumber"] = "score//length"
columns["scoreSum"] = "score//sum"
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": "StartingPoint_Layer",
"properties": [
'UniqueID',
'startPlaceLatitude',
'startPlaceLongitude',
'startDate',
'endDate'
],
"cluster_properties": [
'startPlaceLatitude',
'startPlaceLatitude'
]
},{
"use_case": use_case,
"table": table_name,
"name": "StartingTime_Layer",
"properties": [
'UniqueID',
'startDate',
'endDate'
],
"cluster_properties": [
'startDate'
]
},{
"use_case": use_case,
"table": table_name,
"name": "CheckedByLocation_Layer",
"properties": [
'UniqueID',
'checkedByUser',
'checkedByMoment',
'checkedByLatitude',
'checkedByLongitude',
'checkedByState',
'startPlaceLatitude',
'startPlaceLongitude'
],
"cluster_properties": [
'checkedByLatitude',
'checkedByLongitude'
]
},{
"use_case": use_case,
"table": table_name,
"name": "CheckedByMoment_Layer",
"properties": [
'UniqueID',
'checkedByUser',
'checkedByMoment',
'checkedByLatitude',
'checkedByLongitude',
'checkedByState',
'startDate',
'startPlaceLatitude',
'startPlaceLongitude'
],
"cluster_properties": [
'checkedByMoment',
'startDate'
]
},{
"use_case": use_case,
"table": table_name,
"name": "FinishedTime_Layer",
"properties": [
'UniqueID',
'startDate',
'endDate'
],
"cluster_properties": [
'endDate'
]
},{
"use_case": use_case,
"table": table_name,
"name": "Price_Layer",
"properties": [
'UniqueID',
'totalPrice',
'priceBalance',
'depositBalance',
'rewardBalance'
],
"cluster_properties": [
'totalPrice',
'priceBalance',
'depositBalance',
'rewardBalance'
]
},
{
"use_case": use_case,
"table": table_name,
"name": "Status_Layer",
"properties": [
'UniqueID',
'status',
'rentForTime'
],
"cluster_properties": [
'status',
'rentForTime'
]
},
{
"use_case": use_case,
"table": table_name,
"name": "Score_Layer",
"properties": [
'UniqueID',
'scoreSum',
'scoreNumber'
],
"cluster_properties": [
'scoreSum',
'scoreNumber'
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("TRAVEL")
table_name = "travel"
add_table(use_case,table_name)
add_layers(use_case, table_name)
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 = [
"travelId"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "travelId+user"
columns["moment"] = "travel//cancelledBy[0]//moment"
columns["latitude"] = "travel//cancelledBy[0]//cancellationPlace//latitude"
columns["longitude"] = "travel//cancelledBy[0]//cancellationPlace//longitude"
columns["user"] = "travel//cancelledBy[0]//user"
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": "CancelledByAtLocation_Layer",
"properties": [
'UniqueID',
'travelId',
'moment',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'latitude',
'latitude'
]
},{
"use_case": use_case,
"table": table_name,
"name": "CancelledByAtMoment_Layer",
"properties": [
'UniqueID',
'travelId',
'moment',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'moment'
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("TRAVEL_CancelledBY")
table_name = "travelCancelledBy"
add_table(use_case,table_name)
add_layers(use_case, table_name)
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 = [
"travelId"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "travelId+user"
columns["moment"] = "travel//finishedBy[0]//moment"
columns["latitude"] = "travel//finishedBy[0]//endPlace//latitude"
columns["longitude"] = "travel//finishedBy[0]//endPlace//longitude"
columns["user"] = "travel//finishedBy[0]//user"
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": "FinishedByAtLocation_Layer",
"properties": [
'UniqueID',
'travelId',
'moment',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'latitude',
'latitude'
]
},{
"use_case": use_case,
"table": table_name,
"name": "FinishedByAtMoment_Layer",
"properties": [
'UniqueID',
'travelId',
'moment',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'moment'
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("TRAVEL_FinishedBy")
table_name = "travelFinishedBy"
add_table(use_case,table_name)
add_layers(use_case, table_name)
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 = [
"travelId"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "travelId+user"
columns["moment"] = "travel//startedBy[0]//moment"
columns["latitude"] = "travel//startedBy[0]//startPlace//latitude"
columns["longitude"] = "travel//startedBy[0]//startPlace//longitude"
columns["user"] = "travel//startedBy[0]//user"
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": "StartedByAtLocation_Layer",
"properties": [
'UniqueID',
'travelId',
'moment',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'latitude',
'latitude'
]
},{
"use_case": use_case,
"table": table_name,
"name": "StartedByAtMoment_Layer",
"properties": [
'UniqueID',
'travelId',
'moment',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'moment'
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("TRAVEL_STARTEDBY")
table_name = "travelStartedBy"
add_table(use_case,table_name)
add_layers(use_case, table_name)
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 = [
"travelId"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "travelId+user"
columns["latitude"] = "travel//suggestedEndPlaces[0]//endPlace//latitude"
columns["longitude"] = "travel//suggestedEndPlaces[0]//endPlace//longitude"
columns["reward"] = "travel//suggestedEndPlaces[0]//reward"
columns["user"] = "travel//suggestedEndPlaces[0]//suggestedBy"
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": "SuggestedEndPlacesAtLocation_Layer",
"properties": [
'UniqueID',
'travelId',
'reward',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'latitude',
'latitude'
]
},{
"use_case": use_case,
"table": table_name,
"name": "SuggestedEndPlacesAtReward_Layer",
"properties": [
'UniqueID',
'travelId',
'reward',
'latitude',
'longitude',
'user'
],
"cluster_properties": [
'reward'
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("TRAVEL_suggestedEndPlaces")
table_name = "travelSuggestedEndPlaces"
add_table(use_case,table_name)
add_layers(use_case, table_name)
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 = [
"travelId"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "travelId+user"
columns["isDriver"] = "travel//users[0]//userIdisDriver"
columns["passengersNr"] = "ravel//users[0]//passengers"
columns["user"] = "travel//users[0]//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": "Driver_layer",
"properties": [
'UniqueID',
'travelId',
'isDriver',
'passengersNr',
'user'
],
"cluster_properties": [
'isDriver'
]
},{
"use_case": use_case,
"table": table_name,
"name": "Passangers_layer",
"properties": [
'UniqueID',
'travelId',
'isDriver',
'passengersNr',
'user'
],
"cluster_properties": [
'passengersNr'
]
}
]
postLayersToSwagger(use_case,layers)
def main(use_case: str):
print("TRAVEL_USERS")
table_name = "travelUsers"
add_table(use_case,table_name)
add_layers(use_case, table_name)
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 = [
"id", # pk
"balance",
"numberOfTripsDone",
"role",
"sumOfTripsScores"
]
columns = { c : c for c in columns }
columns["UniqueID"] = "id"
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",
"balance",
"role",
"numberOfTripsDone",
"sumOfTripsScores"
],
"cluster_properties": [
"balance",
"numberOfTripsDone",
"sumOfTripsScores"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "UserBalance_layer",
"properties": [
"UniqueID",
"balance",
"role",
"numberOfTripsDone",
"sumOfTripsScores"
],
"cluster_properties": [
"balance",
"sumOfTripsScores"
]
},
{
"use_case": use_case,
"table": table_name,
"name": "UserVeterancy_layer",
"properties": [
"UniqueID",
"balance",
"role",
"numberOfTripsDone",
"sumOfTripsScores"
],
"cluster_properties": [
"numberOfTripsDone",
"sumOfTripsScores"
]
}
]
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
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
EXPOSE 5000 EXPOSE 5000
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
RUN pip install connexion[swagger-ui] RUN pip install connexion[swagger-ui]
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
EXPOSE 5000 EXPOSE 5000
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
RUN pip install connexion[swagger-ui] RUN pip install connexion[swagger-ui]
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
RUN pip install connexion[swagger-ui] RUN pip install connexion[swagger-ui]
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
RUN pip install connexion[swagger-ui] RUN pip install connexion[swagger-ui]
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
RUN pip install connexion[swagger-ui] RUN pip install connexion[swagger-ui]
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
RUN pip install flask RUN pip install flask
RUN pip install connexion[swagger-ui] RUN pip install connexion[swagger-ui]
......
FROM python:3 FROM python:3
LABEL maintainer="Alexander Lercher" LABEL maintainer="Alexander Lercher"
ENV http_proxy http://proxy.uni-klu.ac.at:3128/
ENV https_proxy http://proxy.uni-klu.ac.at:3128/
RUN apt-get update RUN apt-get update
EXPOSE 5000 EXPOSE 5000
......
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