From 74f21fd4027a74541c191cb0e24e71c983a93544 Mon Sep 17 00:00:00 2001 From: "Campos Cordobes, Sergio" <sergio.campos@tecnalia.com> Date: Tue, 14 Feb 2023 11:03:53 +0100 Subject: [PATCH] Deleted recommender_geographic.sql, recommender_preferences.sql, recommender_popularity.sql, recommender_tags.sql --- recommender_geographic.sql | 50 --------------------- recommender_popularity.sql | 88 ------------------------------------- recommender_preferences.sql | 61 ------------------------- recommender_tags.sql | 36 --------------- 4 files changed, 235 deletions(-) delete mode 100644 recommender_geographic.sql delete mode 100644 recommender_popularity.sql delete mode 100644 recommender_preferences.sql delete mode 100644 recommender_tags.sql diff --git a/recommender_geographic.sql b/recommender_geographic.sql deleted file mode 100644 index 1693786..0000000 --- a/recommender_geographic.sql +++ /dev/null @@ -1,50 +0,0 @@ --- Created on: 16/01/2023 --- @author: Andoni Aranguren Ubierna --- Adaptations: 02/2023 @author: Sergio Campos - -DELIMITER $$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_geographic_action_id`(IN action_id_in INT, IN kpi INT) -BEGIN - SET @deg_to_km = 111.2; - IF kpi is null THEN - SELECT - p.action_id, p.action_name, p.lon, p.lat, - -- This lines are so we can get the list of kpis vvvvvvvvvv - GROUP_CONCAT(distinct t_list.kpi_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 ^^^^^^^^^^ - POW(@deg_to_km * (p.lat - p_t.lat), 2) + - POW(@deg_to_km * (p_t.lon - p.lon) * COS(p.lat / 57.3), 2) AS distance_squared - FROM action p - LEFT JOIN action p_t ON p_t.action_id = action_id_in - -- 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.kpi_id = t_p_list.kpi_id - -- This lines are so we can get the list of kpis ^^^^^^^^^^ - WHERE p_t.action_id != p.action_id - GROUP BY p.action_id - ORDER BY distance_squared ASC - LIMIT 100; - ELSE - SELECT - p.action_id, p.action_name, p.lon, p.lat, - -- This lines are so we can get the list of kpis vvvvvvvvvv - GROUP_CONCAT(distinct t_list.kpi_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 ^^^^^^^^^^ - POW(@deg_to_km * (p.lat - p_t.lat), 2) + - POW(@deg_to_km * (p_t.lon - p.lon) * COS(p.lat / 57.3), 2) AS distance_squared - FROM action p - LEFT JOIN action p_t ON p_t.action_id = action_id_in - 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.kpi_id = t_p_list.kpi_id - -- This lines are so we can get the list of kpis ^^^^^^^^^^ - WHERE p_t.action_id != p.action_id AND t.kpi_id = kpi - GROUP BY p.action_id - ORDER BY distance_squared ASC - LIMIT 100; - END IF; -END$$ -DELIMITER ; diff --git a/recommender_popularity.sql b/recommender_popularity.sql deleted file mode 100644 index de01291..0000000 --- a/recommender_popularity.sql +++ /dev/null @@ -1,88 +0,0 @@ --- Created on: 16/01/2023 --- @author: Andoni Aranguren Ubierna --- Adaptations: 02/2023 @author: Sergio Campos - -recommender_kpis_action_idDELIMITER $$ -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.kpi_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 ^^^^^^^^^^ - p.popularity as popularity - 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.kpi_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.kpi_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 ^^^^^^^^^^ - p.popularity as popularity - 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.kpi_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 ; -DELIMITER $$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_geographic_action_id`(IN action_id_in INT, IN kpi INT) -BEGIN - SET @deg_to_km = 111.2; - IF kpi is null THEN - SELECT - p.action_id, p.action_name, p.lon, p.lat, - -- This lines are so we can get the list of kpis vvvvvvvvvv - GROUP_CONCAT(distinct t_list.kpi_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 ^^^^^^^^^^ - POW(@deg_to_km * (p.lat - p_t.lat), 2) + - POW(@deg_to_km * (p_t.lon - p.lon) * COS(p.lat / 57.3), 2) AS distance_squared - FROM action p - LEFT JOIN action p_t ON p_t.action_id = action_id_in - -- 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.kpi_id = t_p_list.kpi_id - -- This lines are so we can get the list of kpis ^^^^^^^^^^ - WHERE p_t.action_id != p.action_id - GROUP BY p.action_id - ORDER BY distance_squared ASC - LIMIT 100; - ELSE - SELECT - p.action_id, p.action_name, p.lon, p.lat, - -- This lines are so we can get the list of kpis vvvvvvvvvv - GROUP_CONCAT(distinct t_list.kpi_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 ^^^^^^^^^^ - POW(@deg_to_km * (p.lat - p_t.lat), 2) + - POW(@deg_to_km * (p_t.lon - p.lon) * COS(p.lat / 57.3), 2) AS distance_squared - FROM action p - LEFT JOIN action p_t ON p_t.action_id = action_id_in - 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.kpi_id = t_p_list.kpi_id - -- This lines are so we can get the list of kpis ^^^^^^^^^^ - WHERE p_t.action_id != p.action_id AND t.kpi_id = kpi - GROUP BY p.action_id - ORDER BY distance_squared ASC - LIMIT 100; - END IF; -END$$ -DELIMITER ; \ No newline at end of file diff --git a/recommender_preferences.sql b/recommender_preferences.sql deleted file mode 100644 index 26f7ff0..0000000 --- a/recommender_preferences.sql +++ /dev/null @@ -1,61 +0,0 @@ --- Created on: 16/01/2023 --- @author: Andoni Aranguren Ubierna --- Adaptations: 02/2023 @author: Sergio Campos - -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.kpi_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.kpi_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.kpi_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.kpi_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 ; diff --git a/recommender_tags.sql b/recommender_tags.sql deleted file mode 100644 index 4da3b64..0000000 --- a/recommender_tags.sql +++ /dev/null @@ -1,36 +0,0 @@ --- Created on: 16/01/2023 --- @author: Andoni Aranguren Ubierna --- Adaptations: 02/2023 @author: Sergio Campos - -DELIMITER // -DELIMITER $$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_kpis_action_id`(IN action_id INT) -BEGIN - SELECT kpi.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 - WHERE target_p.action_id = action_id) as distinct_kpis ON kpi.kpi_id = distinct_kpis.kpi_id - GROUP BY kpi.kpi_id - ORDER BY Probability DESC; -END$$ -DELIMITER ; - - -DELIMITER $$ -CREATE DEFINER=`root`@`localhost` PROCEDURE `recommender_kpis_kpi_id`(IN kpi_id INT) -BEGIN -SELECT kpi.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.kpi_id = distinct_kpis.kpi_id - GROUP BY kpi.kpi_id - ORDER BY Probability DESC; -END$$ -DELIMITER ; -- GitLab