Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Recommendation Engine
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
URBANITE
Open
Recommendation Engine
Commits
560517d1
Commit
560517d1
authored
2 years ago
by
Campos Cordobes, Sergio
Browse files
Options
Downloads
Patches
Plain Diff
Update src/app.py
Deleted src/app - copia.py
parent
b41717ec
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app - copia.py
+0
-116
0 additions, 116 deletions
src/app - copia.py
src/app.py
+1
-0
1 addition, 0 deletions
src/app.py
with
1 addition
and
116 deletions
src/app - copia.py
deleted
100644 → 0
+
0
−
116
View file @
b41717ec
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on: 16/01/2023
@author: Andoni Aranguren Ubierna
"""
import
sys
print
(
sys
.
path
)
from
src
import
constants
import
mysql.connector
from
flask
import
Flask
,
request
,
render_template
from
src
import
recommender
,
database
,
planner
app
=
Flask
(
__name__
)
cnx
=
None
@app.plan_detail
(
"
/
"
)
def
index
():
return
render_template
(
"
index.html
"
)
# RECOMMENDERS: -------------------------------------------------------------------------------------------------------
@app.get
(
"
/recommender/popularity
"
)
def
recommender_popularity
():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return
recommender
.
recommender_popularity
(
cnx
,
request
)
@app.get
(
"
/recommender/geographic/action_id
"
)
def
recommender_geographic_id
():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return
recommender
.
recommender_geographic_id
(
cnx
,
request
)
@app.get
(
"
/recommender/geographic/lat_lon
"
)
def
recommender_geographic_lat_lon
():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return
recommender
.
recommender_geographic_lat_lon
(
cnx
,
request
)
@app.get
(
"
/recommender/preferences
"
)
def
recommender_preferences
():
"""
We ask for kpis based on the affinity to the kpi provided.
:return: json
"""
return
recommender
.
recommender_preferences
(
cnx
,
request
)
@app.get
(
"
/recommender/kpis/kpi_id
"
)
def
recommender_kpis_kpi_id
():
"""
Provided a action it returns a set of kpis by their affinity regarding the provided action
:return: json
"""
return
recommender
.
recommender_kpis_kpi_id
(
cnx
,
request
)
@app.get
(
"
/recommender/kpis/action_id
"
)
def
recommender_kpis_action_id
():
"""
Provided a action it returns a set of kpis by their affinity regarding the provided action
:return: json
"""
return
recommender
.
recommender_kpis_action_id
(
cnx
,
request
)
@app.get
(
"
/recommender/bayesian
"
)
def
recommender_bayesian_action_id
():
"""
We ask for actions based on popularity of the actions
:return: json
"""
return
recommender
.
recommender_bayesian_action_id
(
cnx
,
request
)
# DATABASE SAVE: -------------------------------------------------------------------------------------------------------
@app.post
(
"
/database/save/plan
"
)
def
database_save_plan
():
"""
It stores the plan_details that have been selected.
The json provided should have the same format that /planner/plan_detail outputs filled with each plan_detail
:return: json with the plan_detail
"""
if
request
.
json
:
return
database
.
database_save_plan
(
cnx
,
request
)
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
)
# MAIN: ----------------------------------------------------------------------------------------------------------------
if
__name__
==
"
__main__
"
:
cnx
=
mysql
.
connector
.
connect
(
**
constants
.
DDBB_CONFIG
)
app
.
run
(
debug
=
True
,
host
=
'
0.0.0.0
'
)
This diff is collapsed.
Click to expand it.
src/app.py
+
1
−
0
View file @
560517d1
...
...
@@ -3,6 +3,7 @@
"""
Created on: 16/01/2023
@author: Andoni Aranguren Ubierna
-- Adaptations: 02/2023 @author: Sergio Campos
"""
import
sys
print
(
sys
.
path
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment