Skip to content
Snippets Groups Projects
Commit c75e173e authored by Campos Airas, Daniel's avatar Campos Airas, Daniel
Browse files

[IMP] added code changes

parent 5c08b1a9
No related branches found
No related tags found
No related merge requests found
# Recommendation Engine - Alternative
INSTALL
python -m pip install --index-url https://support.bayesfusion.com/pysmile-B/ pysmile
## Getting started
......
......@@ -219,6 +219,17 @@ def planner_plan_detail():
"""
return planner.planner_plan_detail(cnx, request)
@app.get("/database/store/kpi")
def database_store_kpi():
"""
It stores the Kpis that have been selected.
The json provided should have the same format that json with the kpi
"""
#if request.json:
if request:
return database.database_store_kpi(cnx, request)
else:
return constants.ERROR_JSON_NEEDED
# MAIN: ----------------------------------------------------------------------------------------------------------------
if __name__ == "__main__":
......
File added
mysql-connector-python~=8.0.31
Flask~=2.2.2
anyio==3.6.2
AnyQt==0.2.0
asttokens==2.2.1
backcall==0.2.0
baycomp==1.0.2
Bottleneck==1.3.7
CacheControl==0.12.12
certifi==2022.12.7
cffi==1.15.1
chardet==5.1.0
charset-normalizer==3.0.1
click==8.1.3
comm==0.1.2
commonmark==0.9.1
contourpy==1.0.7
cryptography==39.0.2
cycler==0.11.0
debugpy==1.6.6
decorator==5.1.1
dictdiffer==0.9.0
docopt==0.6.2
docutils==0.19
et-xmlfile==1.1.0
executing==1.2.0
filelock==3.9.0
Flask==2.2.3
fonttools==4.39.0
h11==0.14.0
httpcore==0.16.3
httpx==0.23.3
idna==3.4
importlib-metadata==6.0.0
importlib-resources==5.12.0
ipykernel==6.21.3
ipython==8.11.0
ipython-genutils==0.2.0
itsdangerous==2.1.2
jaraco.classes==3.2.3
jedi==0.18.2
jeepney==0.8.0
Jinja2==3.1.2
joblib==1.2.0
jupyter_client==8.0.3
jupyter_core==5.2.0
keyring==23.13.1
keyrings.alt==4.2.0
kiwisolver==1.4.4
MarkupSafe==2.1.2
matplotlib==3.7.1
matplotlib-inline==0.1.6
more-itertools==9.1.0
msgpack==1.0.5
mysql-connector-python~=8.0.32
nest-asyncio==1.5.6
networkx==3.0
numpy~=1.23.5
requests~=2.28.1
pandas~=1.5.1
utm~=0.7.0
\ No newline at end of file
openpyxl==3.1.2
openTSNE==0.7.1
orange-canvas-core==0.1.29
orange-widget-base==4.19.0
Orange3==3.34.1
packaging==23.0
pandas==1.5.3
parso==0.8.3
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.4.0
pipreqs==0.4.11
platformdirs==3.1.1
prompt-toolkit==3.0.38
protobuf==3.20.3
psutil==5.9.4
ptyprocess==0.7.0
pure-eval==0.2.2
pycparser==2.21
Pygments==2.14.0
pyparsing==3.0.9
pyqtgraph==0.13.2
pysmile==2.0.10
python-dateutil==2.8.2
python-louvain==0.16
pytz==2022.7.1
pywin32==305
pywin32-ctypes==0.2.0
PyYAML==6.0
pyzmq==25.0.0
qasync==0.23.0
qtconsole==5.4.1
QtPy==2.3.0
requests=2.28.2
rfc3986==1.5.0
scikit-learn==1.1.3
scipy==1.10.1
SecretStorage==3.3.3
serverfiles==0.3.1
six==1.16.0
sniffio==1.3.0
stack-data==0.6.2
threadpoolctl==3.1.0
tornado==6.2
traitlets==5.9.0
typing_extensions==4.5.0
urllib3==1.26.14
utm==0.7.0
wcwidth==0.2.6
Werkzeug==2.2.3
xlrd==2.0.1
XlsxWriter==3.0.9
xmltodict==0.13.0
yarg==0.1.9
zipp==3.14.0
......@@ -4,16 +4,19 @@
Created on: 16/01/2023
@author: Andoni Aranguren Ubierna
@updates: Sergio Campos 02-03/2023
"""
import pickle
import pysmile
import sys
import json
print(sys.path)
from src import constants
import mysql.connector
from flask import Flask, request, render_template
from src import recommender, database, planner, modal_choice
from src import configuration, recommender, database, planner, modal_choice
app = Flask(__name__)
cnx = None
......@@ -24,6 +27,111 @@ def index():
return render_template("index.html")
# MODAL CHOICE: -------------------------------------------------------------------------------------------------------
@app.get("/modal_choice/estimation")
def modal_choice_estimation():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return modal_choice.modal_choice_estimation(cnx, request)
@app.get("/modal_choice/getProbabilites")
def modal_choice_getprobabilities():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return modal_choice.modal_choice_getprobabilities(cnx, request)
@app.get("/modal_choice/setProbabilites")
def modal_choice_setprobabilities():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return modal_choice.modal_choice_setprobabilities(cnx, request)
@app.get("/modal_choice/getDependencies")
def modal_choice_getdependencies():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return modal_choice.modal_choice_getdependencies(cnx, request)
@app.get("/modal_choice/getValues")
def modal_choice_getvalues():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return modal_choice.modal_choice_getvalues(cnx, request)
#Dexi configuration: -------------------------------------------------------------------------------------------------
@app.get("/recommender/configuration/getMatrix")
def configuration_getmatrix():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return configuration.getmatrix(cnx, request)
@app.get("/recommender/configuration/setMatrix")
def configuration_setmatrix():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return configuration.setmatrix(cnx, request)
@app.get("/recommender/configuration/getSliders")
def configuration_getsliders():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return configuration.getsliders(cnx, request)
@app.get("/recommender/configuration/setSliders")
def configuration_setsliders():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return configuration.setsliders(cnx, request)
@app.get("/recommender/configuration/getEvaluationFile")
def configuration_getevaluationfile():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return configuration.getevaluationfile(cnx, request)
@app.get("/recommender/configuration/getConfigurationFile")
def configuration_getconfigurationfile():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return configuration.getconfigurationfile(cnx, request)
# RECOMMENDERS: -------------------------------------------------------------------------------------------------------
@app.get("/recommender/popularity")
def recommender_popularity():
......@@ -101,6 +209,15 @@ def database_save_plan():
else:
return constants.ERROR_JSON_NEEDED
# plan_detail PLANNER: -------------------------------------------------------------------------------------------------------
@app.get("/planner/plan_detail")
def planner_plan_detail():
"""
It calculates the best plan_detail traversing streets and reordering the intermediate nodes provided.
:return: json with the plan_detail
"""
return planner.planner_plan_detail(cnx, request)
@app.get("/database/store/kpi")
def database_store_kpi():
"""
......@@ -125,5 +242,6 @@ def planner_plan_detail():
# MAIN: ----------------------------------------------------------------------------------------------------------------
if __name__ == "__main__":
model = pickle.load(open('model.pkcls', 'rb'))
cnx = mysql.connector.connect(**constants.DDBB_CONFIG)
app.run(debug=True, host='0.0.0.0')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment