From 199046064cc13c734487943c63484505aa8e1062 Mon Sep 17 00:00:00 2001 From: Sara Burns Date: Tue, 22 Oct 2024 14:48:24 -0400 Subject: [PATCH 1/3] fix: updates --- .../assets/datasets/course_information.yaml | 4 ++-- .../assets/datasets/tag_filter.yaml | 18 +++++++++++++-- .../datasets/watched_video_duration.yaml | 23 ++++++++----------- .../queries/tag_filter_dataset.sql | 23 +++++++++---------- 4 files changed, 39 insertions(+), 29 deletions(-) diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/course_information.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/course_information.yaml index a78b564eb..56c142e25 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/course_information.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/course_information.yaml @@ -104,7 +104,7 @@ metrics: - currency: null d3format: null description: null - expression: uniq((active_learner,course_run)) + expression: uniq(active_learner,course_run) extra: warning_markdown: '' metric_name: active_count @@ -125,7 +125,7 @@ metrics: - currency: null d3format: null description: null - expression: uniq((actor_id,course_run)) + expression: uniq(actor_id,course_run) extra: warning_markdown: '' metric_name: enrollees diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/tag_filter.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/tag_filter.yaml index 563dc484e..99c8f06f1 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/tag_filter.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/tag_filter.yaml @@ -38,6 +38,18 @@ columns: python_date_format: null type: String verbose_name: Tag +- advanced_data_type: null + column_name: course_key + description: null + expression: null + extra: {} + filterable: true + groupby: true + is_active: true + is_dttm: false + python_date_format: null + type: String + verbose_name: Course Key database_uuid: 21174b6c-4d40-4958-8161-d6c3cf5e77b6 default_endpoint: null description: null @@ -50,7 +62,8 @@ metrics: d3format: null description: null expression: COUNT(*) - extra: {} + extra: + warning_markdown: '' metric_name: count metric_type: count verbose_name: COUNT(*) @@ -59,7 +72,8 @@ metrics: d3format: null description: null expression: min(rownum) - extra: {} + extra: + warning_markdown: '' metric_name: order metric_type: null verbose_name: order diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml index d96d8289f..3f07d5cc5 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml @@ -2,19 +2,6 @@ _file_name: watched_video_duration.yaml always_filter_main_dttm: false cache_timeout: null columns: -- advanced_data_type: null - column_name: video_count - description: null - expression: null - extra: - warning_markdown: null - filterable: true - groupby: true - is_active: true - is_dttm: false - python_date_format: null - type: UInt64 - verbose_name: Number of Videos - advanced_data_type: null column_name: course_name description: null @@ -157,6 +144,16 @@ metrics: metric_type: null verbose_name: Avg Video Length (seconds) warning_text: null +- currency: null + d3format: null + description: null + expression: avg(video_count) + extra: + warning_markdown: '' + metric_name: num_videos + metric_type: null + verbose_name: Number of Videos + warning_text: null - currency: null d3format: null description: null diff --git a/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql b/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql index 05bc2a308..ed841c297 100644 --- a/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql +++ b/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql @@ -1,12 +1,11 @@ -with - data as ( - select - id, - case when parent = 0 then id else cast(parent as int) end as sort_order_1, - case when parent = 0 then 0 else 1 end as sort_order_2, - concat(repeat('- ', countMatches(lineage, ',')), value) as tag, - row_number() over (order by sort_order_1, sort_order_2, value) as rownum - from {{ ASPECTS_EVENT_SINK_DATABASE }}.most_recent_tags - ) -select id, rownum, tag -from data +SELECT id, rownum, tag, course_key +FROM ( + SELECT + id, + multiIf(parent = 0, id, CAST(parent, 'int')) AS sort_order_1, + multiIf(parent = 0, 0, 1) AS sort_order_2, + concat(repeat('- ', countMatches(lineage, ',')), value) AS tag, + row_number() OVER (ORDER BY sort_order_1 ASC, sort_order_2 ASC, value ASC) AS rownum + FROM {{ ASPECTS_EVENT_SINK_DATABASE }}.most_recent_tags +) as t +left join {{ DBT_PROFILE_TARGET_DATABASE }}.most_recent_course_tags ct on ct.tag_id = t.id From f6497d1d793d2f90f2e64a1c86c1858df102c235 Mon Sep 17 00:00:00 2001 From: Sara Burns Date: Tue, 22 Oct 2024 15:19:20 -0400 Subject: [PATCH 2/3] fix: video count --- .../charts/Video_Engagement_5b00f7.yaml | 10 ++++--- .../charts/Video_Engagement_6b7610.yaml | 12 +++++---- .../Course_Comparison_Dashboard.yaml | 2 +- .../datasets/watched_video_duration.yaml | 12 +++++++++ .../queries/tag_filter_dataset.sql | 26 +++++++++++-------- 5 files changed, 41 insertions(+), 21 deletions(-) diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml index 70b9374e3..df9223ccf 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml @@ -18,8 +18,8 @@ params: groupby: - course_name - org - - video_count metrics: + - num_videos - watched_percent - rewatched_percent - avg_video_length @@ -28,6 +28,7 @@ params: percent_metrics: [] query_mode: aggregate row_limit: 50000 + server_page_length: 10 show_cell_bars: false table_timestamp_format: smart_date temporal_columns_lookup: {} @@ -55,8 +56,8 @@ query_context: groupby: - course_name - org - - video_count metrics: + - num_videos - watched_percent - rewatched_percent - avg_video_length @@ -67,6 +68,7 @@ query_context: result_format: json result_type: full row_limit: 50000 + server_page_length: 10 show_cell_bars: false slice_id: 82 table_timestamp_format: smart_date @@ -78,7 +80,6 @@ query_context: columns: - course_name - org - - video_count custom_form_data: {} custom_params: {} extras: @@ -86,12 +87,13 @@ query_context: where: '' filters: [] metrics: + - num_videos - watched_percent - rewatched_percent - avg_video_length order_desc: true orderby: - - - watched_percent + - - num_videos - false post_processing: [] row_limit: 50000 diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml index 2634c067b..e753f9700 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml @@ -18,8 +18,8 @@ params: groupby: - course_run - course_name - - video_count metrics: + - num_videos - watched_percent - rewatched_percent - avg_video_length @@ -28,6 +28,7 @@ params: percent_metrics: [] query_mode: aggregate row_limit: 50000 + server_page_length: 10 show_cell_bars: false table_timestamp_format: smart_date temporal_columns_lookup: {} @@ -55,8 +56,8 @@ query_context: groupby: - course_run - course_name - - video_count metrics: + - num_videos - watched_percent - rewatched_percent - avg_video_length @@ -67,8 +68,9 @@ query_context: result_format: json result_type: full row_limit: 50000 + server_page_length: 10 show_cell_bars: false - slice_id: 145 + slice_id: 641 table_timestamp_format: smart_date temporal_columns_lookup: {} viz_type: table @@ -78,7 +80,6 @@ query_context: columns: - course_run - course_name - - video_count custom_form_data: {} custom_params: {} extras: @@ -86,12 +87,13 @@ query_context: where: '' filters: [] metrics: + - num_videos - watched_percent - rewatched_percent - avg_video_length order_desc: true orderby: - - - watched_percent + - - num_videos - false post_processing: [] row_limit: 50000 diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml index 9fd139524..a4d4c8cf3 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml @@ -484,7 +484,7 @@ position: children: [] id: CHART-explore-1508-1 meta: - chartId: 145 + chartId: 641 height: 50 sliceName: Video Engagement uuid: 6b7610a7-41d0-4d14-be81-62a5a8f22d62 diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml index 3f07d5cc5..6a67dcba8 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/datasets/watched_video_duration.yaml @@ -106,6 +106,18 @@ columns: python_date_format: null type: String verbose_name: Org +- advanced_data_type: null + column_name: video_count + description: null + expression: null + extra: {} + filterable: true + groupby: true + is_active: true + is_dttm: false + python_date_format: null + type: Int32 + verbose_name: Video Count database_uuid: 21174b6c-4d40-4958-8161-d6c3cf5e77b6 default_endpoint: null description: null diff --git a/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql b/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql index ed841c297..de81a2158 100644 --- a/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql +++ b/tutoraspects/templates/openedx-assets/queries/tag_filter_dataset.sql @@ -1,11 +1,15 @@ -SELECT id, rownum, tag, course_key -FROM ( - SELECT - id, - multiIf(parent = 0, id, CAST(parent, 'int')) AS sort_order_1, - multiIf(parent = 0, 0, 1) AS sort_order_2, - concat(repeat('- ', countMatches(lineage, ',')), value) AS tag, - row_number() OVER (ORDER BY sort_order_1 ASC, sort_order_2 ASC, value ASC) AS rownum - FROM {{ ASPECTS_EVENT_SINK_DATABASE }}.most_recent_tags -) as t -left join {{ DBT_PROFILE_TARGET_DATABASE }}.most_recent_course_tags ct on ct.tag_id = t.id +select id, rownum, tag, course_key +from + ( + select + id, + multiIf(parent = 0, id, CAST(parent, 'int')) as sort_order_1, + multiIf(parent = 0, 0, 1) as sort_order_2, + concat(repeat('- ', countMatches(lineage, ',')), value) as tag, + row_number() over ( + order by sort_order_1 ASC, sort_order_2 ASC, value ASC + ) as rownum + from {{ ASPECTS_EVENT_SINK_DATABASE }}.most_recent_tags + ) as t +left join + {{ DBT_PROFILE_TARGET_DATABASE }}.most_recent_course_tags ct on ct.tag_id = t.id From 117fe68b41734be74113a70cfddf6edf94ea0b80 Mon Sep 17 00:00:00 2001 From: Sara Burns Date: Tue, 22 Oct 2024 15:31:05 -0400 Subject: [PATCH 3/3] fix: remove pagination --- .../openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml | 2 -- .../openedx-assets/assets/charts/Video_Engagement_6b7610.yaml | 4 +--- .../assets/dashboards/Course_Comparison_Dashboard.yaml | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml index df9223ccf..22364c178 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_5b00f7.yaml @@ -28,7 +28,6 @@ params: percent_metrics: [] query_mode: aggregate row_limit: 50000 - server_page_length: 10 show_cell_bars: false table_timestamp_format: smart_date temporal_columns_lookup: {} @@ -68,7 +67,6 @@ query_context: result_format: json result_type: full row_limit: 50000 - server_page_length: 10 show_cell_bars: false slice_id: 82 table_timestamp_format: smart_date diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml index e753f9700..eb8c74164 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/charts/Video_Engagement_6b7610.yaml @@ -28,7 +28,6 @@ params: percent_metrics: [] query_mode: aggregate row_limit: 50000 - server_page_length: 10 show_cell_bars: false table_timestamp_format: smart_date temporal_columns_lookup: {} @@ -68,9 +67,8 @@ query_context: result_format: json result_type: full row_limit: 50000 - server_page_length: 10 show_cell_bars: false - slice_id: 641 + slice_id: 145 table_timestamp_format: smart_date temporal_columns_lookup: {} viz_type: table diff --git a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml index a4d4c8cf3..9fd139524 100644 --- a/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml +++ b/tutoraspects/templates/aspects/build/aspects-superset/openedx-assets/assets/dashboards/Course_Comparison_Dashboard.yaml @@ -484,7 +484,7 @@ position: children: [] id: CHART-explore-1508-1 meta: - chartId: 641 + chartId: 145 height: 50 sliceName: Video Engagement uuid: 6b7610a7-41d0-4d14-be81-62a5a8f22d62