diff --git a/.recommender_plans.sql.swp b/.recommender_plans.sql.swp
new file mode 100644
index 0000000000000000000000000000000000000000..728a4bd483c5a2b5bc6898110584c59db20579df
Binary files /dev/null and b/.recommender_plans.sql.swp differ
diff --git a/recommender_kpis_kpi_id.sql b/recommender_kpis_kpi_id.sql
new file mode 100644
index 0000000000000000000000000000000000000000..95b2406c5e73f9dad0cd27b11210bbf6c81176b8
--- /dev/null
+++ b/recommender_kpis_kpi_id.sql
@@ -0,0 +1,13 @@
+CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_kpis_kpi_id`(IN kpi_id INT)
+BEGIN 
+SELECT kpi.id, kpi_name, count(*) as Count, kpi.popularity as Popularity, count(*)/kpi.popularity as Probability FROM kpi kpi
+	INNER JOIN (
+	SELECT DISTINCT t_p.action_id, t_p.kpi_id, c_p.plan_id, r.time_slot FROM kpi_action t_p
+		INNER JOIN CHOSEN_action c_p ON c_p.action_id = t_p.action_id
+		INNER JOIN plan_detail r ON r.plan_id = c_p.plan_id AND r.time_slot = c_p.time_slot
+		INNER JOIN CHOSEN_action target_p ON r.plan_id = target_p.plan_id AND r.time_slot = target_p.time_slot
+		INNER JOIN kpi_action target_kpi_p ON target_kpi_p.kpi_id != t_p.kpi_id AND target_p.action_id = target_kpi_p.action_id 
+		WHERE target_kpi_p.kpi_id = kpi_id) as distinct_kpis ON kpi.id = distinct_kpis.kpi_id
+	GROUP BY kpi.id
+	ORDER BY Probability DESC;
+END
diff --git a/recommender_plans.sql b/recommender_plans.sql
new file mode 100644
index 0000000000000000000000000000000000000000..05f2fd144d66bfc33bab093502964977a0424d6b
--- /dev/null
+++ b/recommender_plans.sql
@@ -0,0 +1,100 @@
+-- Created on: 16/01/2023
+-- @author: Andoni Aranguren Ubierna
+-- Adaptations: 02/2023 @author: Sergio Campos
+
+drop procedure `recommender_popularity_detailed`;
+DELIMITER $$
+CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_popularity_detailed`(IN kpi INT, IN action INT)
+BEGIN
+        IF ((kpi is null) and (action is NULL))  THEN
+                SELECT t_p_list.plan_id,p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+            		GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+            		GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+            		GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+        	GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+
+	ELSEIF (not(kpi is null))  THEN
+                SELECT t_p_list.plan_id,p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+                        GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+                        GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+                        GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                WHERE t_p_list.kpi_id = kpi
+		GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+		
+        ELSEIF (not(action is NULL))  THEN
+                SELECT t_p_list.plan_id, p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+                        GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+                        GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+                        GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+		WHERE t_list.action_id = action
+                GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+
+	ELSE 
+                SELECT t_p_list.plan_id, p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+                        GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+                        GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+                        GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+		WHERE t_list.action_id = action AND t_p_list.kpi_id = kpi
+		GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+
+
+
+         END IF;
+END$$
+DELIMITER ;
+
diff --git a/recommender_popularity.sql b/recommender_popularity.sql
new file mode 100644
index 0000000000000000000000000000000000000000..d66e20ae4775254ea6664dce6c7cb487d62cf994
--- /dev/null
+++ b/recommender_popularity.sql
@@ -0,0 +1,46 @@
+drop procedure recommender_popularity;
+DELIMITER $$
+CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_popularity`(IN kpi INT)
+BEGIN
+	IF kpi is null THEN
+		SELECT p.action_id, p.action_name, p.lat, p.lon,
+		-- This lines are so we can get the list of kpis vvvvvvvvvv
+			GROUP_CONCAT(distinct t_list.id) as kpi_id_list,
+			GROUP_CONCAT(distinct t_list.kpi_name) as kpi_name_list,
+            GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+            GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+            GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+		-- This lines are so we can get the list of kpis ^^^^^^^^^^
+		p.popularity as popularity, p.category as category
+		FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+			INNER JOIN kpi_action t_p_list ON t_p_list.action_id = p.action_id 
+			INNER JOIN kpi t_list ON t_list.id = t_p_list.kpi_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+        GROUP BY p.action_id
+		ORDER BY popularity DESC
+		LIMIT 100;
+	ELSE
+		SELECT p.action_id, p.action_name, p.lat, p.lon,
+		-- This lines are so we can get the list of kpis vvvvvvvvvv
+			GROUP_CONCAT(distinct t_list.id) as kpi_id_list,
+			GROUP_CONCAT(distinct t_list.kpi_name) as kpi_name_list,
+            GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+            GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+            GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+		-- This lines are so we can get the list of kpis ^^^^^^^^^^
+		p.popularity as popularity, p.category as category
+		FROM action p
+        INNER JOIN kpi_action t ON t.action_id = p.action_id
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+			INNER JOIN kpi_action t_p_list ON t_p_list.action_id = p.action_id 
+			INNER JOIN kpi t_list ON t_list.id = t_p_list.kpi_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+        WHERE t.kpi_id = kpi
+        GROUP BY p.action_id
+		ORDER BY popularity DESC
+		LIMIT 100;
+	END IF;
+END$$
+DELIMITER ;
+
diff --git a/recommender_popularity_detailed.sql b/recommender_popularity_detailed.sql
new file mode 100644
index 0000000000000000000000000000000000000000..05f2fd144d66bfc33bab093502964977a0424d6b
--- /dev/null
+++ b/recommender_popularity_detailed.sql
@@ -0,0 +1,100 @@
+-- Created on: 16/01/2023
+-- @author: Andoni Aranguren Ubierna
+-- Adaptations: 02/2023 @author: Sergio Campos
+
+drop procedure `recommender_popularity_detailed`;
+DELIMITER $$
+CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_popularity_detailed`(IN kpi INT, IN action INT)
+BEGIN
+        IF ((kpi is null) and (action is NULL))  THEN
+                SELECT t_p_list.plan_id,p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+            		GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+            		GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+            		GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+        	GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+
+	ELSEIF (not(kpi is null))  THEN
+                SELECT t_p_list.plan_id,p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+                        GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+                        GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+                        GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                WHERE t_p_list.kpi_id = kpi
+		GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+		
+        ELSEIF (not(action is NULL))  THEN
+                SELECT t_p_list.plan_id, p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+                        GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+                        GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+                        GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+        -- This lines are so we can get the list of kpis ^^^^^^^^^^
+		WHERE t_list.action_id = action
+                GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+
+	ELSE 
+                SELECT t_p_list.plan_id, p.action_id, p.action_name, p.lat, p.lon,
+                -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        GROUP_CONCAT(distinct t_p_list.plan_id) as plan_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_id) as kpi_id_list,
+                        GROUP_CONCAT(distinct t_p_list.kpi_name) as kpi_name_list,
+                        GROUP_CONCAT(t_p_list.absolute) as kpi_absolute_list,
+                        GROUP_CONCAT(t_p_list.relative) as kpi_relative_list,
+                        GROUP_CONCAT(t_p_list.geographical) as kpi_geographical_list,
+                -- This lines are so we can get the list of kpis ^^^^^^^^^^
+                p.popularity as popularity, p.category as category
+                FROM action p
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+                        INNER JOIN chosen_action t_list ON t_list.action_id = p.action_id
+                        INNER JOIN kpi_action_plan_detail t_p_list ON t_list.plan_id = t_p_list.plan_id
+                        INNER JOIN action a ON a.action_id = t_p_list.action_id
+		WHERE t_list.action_id = action AND t_p_list.kpi_id = kpi
+		GROUP BY p.action_id
+                ORDER BY popularity DESC
+                LIMIT 100;
+
+
+
+         END IF;
+END$$
+DELIMITER ;
+
diff --git a/recommender_preferences.sql b/recommender_preferences.sql
new file mode 100644
index 0000000000000000000000000000000000000000..90536b36d816f536bb2c9ee1e4ab6793679b4e3f
--- /dev/null
+++ b/recommender_preferences.sql
@@ -0,0 +1,63 @@
+-- Created on: 16/01/2023
+-- @author: Andoni Aranguren Ubierna
+-- Adaptations: 02/2023 @author: Sergio Campos
+
+drop procedure recommender_preferences;
+DELIMITER $$
+CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_preferences`(
+	IN emission_total FLOAT,
+    IN noise_total FLOAT,
+    IN kpi INT)
+BEGIN 
+	IF kpi IS NULL THEN
+		SELECT c_action.action_id, p.action_name, p.lat, p.lon,
+		--  This lines are so we can get the list of kpis vvvvvvvvvv
+			GROUP_CONCAT(distinct t_list.id) as kpi_id_list,
+			GROUP_CONCAT(distinct t_list.kpi_name) as kpi_name_list,
+		--  This lines are so we can get the list of kpis ^^^^^^^^^^
+		COUNT(c_action.action_id) as Count
+		FROM chosen_action c_action
+		INNER JOIN           
+			(SELECT r.plan_id, 
+					r.time_slot, 
+					POWER(r.emission_total-emission_total,2) + POWER(r.noise_total-noise_total,2) as distance
+			FROM plan_detail r
+			ORDER BY distance ASC
+			LIMIT 5) as r ON c_action.plan_id = r.plan_id AND c_action.time_slot = r.time_slot
+		INNER JOIN action p ON c_action.action_id = p.action_id 
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+			INNER JOIN kpi_action t_p_list ON t_p_list.action_id = p.action_id 
+			INNER JOIN kpi t_list ON t_list.id = t_p_list.kpi_id
+		--  This lines are so we can get the list of kpis ^^^^^^^^^^
+		GROUP BY c_action.action_id
+		ORDER BY Count DESC
+		LIMIT 100;
+	ELSE
+		SELECT c_action.action_id, p.action_name, p.lat, p.lon,
+		--  This lines are so we can get the list of kpis vvvvvvvvvv
+			GROUP_CONCAT(distinct t_list.id) as kpi_id_list,
+			GROUP_CONCAT(distinct t_list.kpi_name) as kpi_name_list,
+		--  This lines are so we can get the list of kpis ^^^^^^^^^^
+		COUNT(c_action.action_id) as Count
+		FROM chosen_action c_action
+		INNER JOIN           
+			(SELECT r.plan_id, 
+					r.time_slot, 
+					POWER(r.emission_total-emission_total,2) + POWER(r.noise_total-noise_total,2) as distance
+			FROM plan_detail r
+			ORDER BY distance ASC
+			LIMIT 5) as r ON c_action.plan_id = r.plan_id AND c_action.time_slot = r.time_slot
+		INNER JOIN action p ON c_action.action_id = p.action_id 
+        INNER JOIN kpi_action t ON t.action_id = p.action_id
+        -- This lines are so we can get the list of kpis vvvvvvvvvv
+			INNER JOIN kpi_action t_p_list ON t_p_list.action_id = p.action_id 
+			INNER JOIN kpi t_list ON t_list.id = t_p_list.kpi_id
+		--  This lines are so we can get the list of kpis ^^^^^^^^^^
+        WHERE t.kpi_id = kpi
+		GROUP BY c_action.action_id
+		ORDER BY Count DESC
+		LIMIT 100;
+	END IF;
+END$$
+DELIMITER ;
+