Query editor
WITH fid_data AS (-- Calculating various metrics per week for each fid (Temporal Normalization)SELECTfid,number_of_followers / NULLIF(weeks_since_fid_creation, 0) AS followers_per_week,number_of_casts / NULLIF(weeks_since_fid_creation, 0) AS casts_per_week,number_of_recasts / NULLIF(weeks_since_fid_creation, 0) AS recasts_per_week,number_of_replies / NULLIF(weeks_since_fid_creation, 0) AS replies_per_week,number_of_mentions / NULLIF(weeks_since_fid_creation, 0) AS mentions_per_week,number_of_likes / NULLIF(weeks_since_fid_creation, 0) AS likes_per_week,days_since_pb / NULLIF(weeks_since_fid_creation, 0) AS days_since_pb_per_week,post_virality_score / NULLIF(weeks_since_fid_creation, 0) AS post_virality_score_per_week,consensys_mentions,metamask_mentions,infura_mentions,linea_mentions,ethereum_mentions,mentions_to_products,avatar_url,display_name,profile_bio,user_url,preferred_fnameFROMdune.mlfonseca.result_fid_table_farcaster),normalized_data AS (-- Normalizing the metrics per week by scaling to a range between 0 and 1 (Metric Normalization)SELECTfid,(followers_per_week - MIN(followers_per_week) OVER ()) / NULLIF((MAX(followers_per_week) OVER () - MIN(followers_per_week) OVER ()), 0) AS norm_followers_per_week,(casts_per_week - MIN(casts_per_week) OVER ()) / NULLIF((MAX(casts_per_week) OVER () - MIN(casts_per_week) OVER ()), 0) AS norm_casts_per_week,(recasts_per_week - MIN(recasts_per_week) OVER ()) / NULLIF((MAX(recasts_per_week) OVER () - MIN(recasts_per_week) OVER ()), 0) AS norm_recasts_per_week,(replies_per_week - MIN(replies_per_week) OVER ()) / NULLIF((MAX(replies_per_week) OVER () - MIN(replies_per_week) OVER ()), 0) AS norm_replies_per_week,(mentions_per_week - MIN(mentions_per_week) OVER ()) / NULLIF((MAX(mentions_per_week) OVER () - MIN(mentions_per_week) OVER ()), 0) AS norm_mentions_per_week,(likes_per_week - MIN(likes_per_week) OVER ()) / NULLIF((MAX(likes_per_week) OVER () - MIN(likes_per_week) OVER ()), 0) AS norm_likes_per_week,(days_since_pb_per_week - MIN(days_since_pb_per_week) OVER ()) / NULLIF((MAX(days_since_pb_per_week) OVER () - MIN(days_since_pb_per_week) OVER ()), 0) AS norm_days_since_pb_per_week,(post_virality_score_per_week - MIN(post_virality_score_per_week) OVER ()) / NULLIF((MAX(post_virality_score_per_week) OVER () - MIN(post_virality_score_per_week) OVER ()), 0) AS norm_post_virality_score_per_week,consensys_mentions,metamask_mentions,infura_mentions,linea_mentions,ethereum_mentions,mentions_to_products,avatar_url,display_name,profile_bio,user_url,preferred_fnameFROMfid_data),kol_scores AS (-- Calculating the individual contributions to the KOL score using adjusted weights (Weighing)SELECTfid,(0.17 * norm_followers_per_week) AS followers_contribution,(0.12 * norm_casts_per_week) AS casts_contribution,(0.17 * norm_recasts_per_week) AS recasts_contribution,(0.17 * norm_replies_per_week) AS replies_contribution,