From 63008a7fe89f3e0199826326dfc6942ea752de83 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 18 Aug 2023 09:01:57 -0400 Subject: [PATCH] analytics query --- .../voice_conversion_models.sql | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/_sql/analytics/voice_conversion/voice_conversion_models.sql b/_sql/analytics/voice_conversion/voice_conversion_models.sql index 4bedacbeb6..5bc292764a 100644 --- a/_sql/analytics/voice_conversion/voice_conversion_models.sql +++ b/_sql/analytics/voice_conversion/voice_conversion_models.sql @@ -76,6 +76,7 @@ order by -- select m.token, + m.model_type, m.title, u.username, r.use_count, @@ -95,6 +96,63 @@ from ( order by r.use_count desc limit 100; + +-- +-- Top 100 voice conversion models by use count (NON DELETED) +-- (jobs table, not results table) +-- +select + m.token, + m.model_type, + m.title, + u.username, + r.use_count, + m.created_at +from ( + select maybe_model_token, count(*) as use_count + from generic_inference_jobs + where maybe_model_token IS NOT NULL + group by maybe_model_token +) as r +join voice_conversion_models as m + on m.token = r.maybe_model_token +join users as u + on u.token = m.creator_user_token +where m.user_deleted_at IS NULL +and m.mod_deleted_at IS NULL +order by r.use_count desc +limit 100; + + +-- +-- Top 100 voice conversion models by use count (NON DELETED, LAST 7 DAYS) +-- (jobs table, not results table) +-- +select + m.token, + m.model_type, + m.title, + u.username, + r.use_count, + m.created_at +from ( + select maybe_model_token, count(*) as use_count + from generic_inference_jobs + where maybe_model_token IS NOT NULL + and created_at > ( CURDATE() - INTERVAL 7 day) + group by maybe_model_token +) as r +join voice_conversion_models as m + on m.token = r.maybe_model_token +join users as u + on u.token = m.creator_user_token +where m.user_deleted_at IS NULL + and m.mod_deleted_at IS NULL +order by r.use_count desc + limit 100; + + + -- Histogram of model contributions select date(created_at) as created_date,