Skip to content

Commit

Permalink
🐛(dashboards) fix course videos metrics
Browse files Browse the repository at this point in the history
We need to focus on video UUIDs; the course key is implicit and already
used to select video uuids.
  • Loading branch information
jmaupetit committed Apr 6, 2022
1 parent 1816fab commit 6060de2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to

## [Unreleased]

### Fixed

- Course videos metrics were improperly collected

## [0.4.2] - 2022-04-06

### Fixed
Expand Down
1 change: 1 addition & 0 deletions src/dashboards/teachers/common.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ local common = import '../common.libsonnet';
course_key: $.queries.course_key,
school_course_session: $.queries.school_course_session,
},
course_videos: 'object.id.keyword:${COURSE_VIDEOS_IDS_WITH_UUID:lucene}',
downloads: '%(video_query)s AND verb.id:"%(verb_downloaded)s"' % {
video_query: $.queries.video_id,
verb_downloaded: common.verb_ids.downloaded,
Expand Down
54 changes: 27 additions & 27 deletions src/dashboards/teachers/course.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ dashboard.new(
).addTarget(
elasticsearch.target(
datasource=common.datasources.lrs,
query=teachers_common.queries.course_query,
query=teachers_common.queries.course_videos,
metrics=[common.metrics.count],
bucketAggs=[
{
Expand Down Expand Up @@ -113,8 +113,8 @@ dashboard.new(
elasticsearch.target(
alias='Views',
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_videos: teachers_common.queries.course_videos,
verb_played: common.verb_ids.played,
time: common.utils.single_escape_string(teachers_common.fields.result_extensions_time),
view_count_threshold: teachers_common.constants.view_count_threshold,
Expand All @@ -138,8 +138,8 @@ dashboard.new(
elasticsearch.target(
alias='Complete views',
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_completed)s"' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_completed)s"' % {
course_videos: teachers_common.queries.course_videos,
verb_completed: common.verb_ids.completed,
},
metrics=[common.metrics.count],
Expand All @@ -161,8 +161,8 @@ dashboard.new(
elasticsearch.target(
alias='Downloads',
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_downloaded)s"' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_downloaded)s"' % {
course_videos: teachers_common.queries.course_videos,
verb_downloaded: common.verb_ids.downloaded,
},
metrics=[common.metrics.count],
Expand Down Expand Up @@ -200,8 +200,8 @@ dashboard.new(
).addTarget(
elasticsearch.target(
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_videos: teachers_common.queries.course_videos,
verb_played: common.verb_ids.played,
time: common.utils.single_escape_string(teachers_common.fields.result_extensions_time),
view_count_threshold: teachers_common.constants.view_count_threshold,
Expand All @@ -228,8 +228,8 @@ dashboard.new(
).addTarget(
elasticsearch.target(
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_videos: teachers_common.queries.course_videos,
verb_played: common.verb_ids.played,
time: common.utils.single_escape_string(teachers_common.fields.result_extensions_time),
view_count_threshold: teachers_common.constants.view_count_threshold,
Expand Down Expand Up @@ -266,8 +266,8 @@ dashboard.new(
).addTarget(
elasticsearch.target(
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_videos: teachers_common.queries.course_videos,
verb_played: common.verb_ids.played,
time: common.utils.single_escape_string(teachers_common.fields.result_extensions_time),
view_count_threshold: teachers_common.constants.view_count_threshold,
Expand Down Expand Up @@ -305,8 +305,8 @@ dashboard.new(
).addTarget(
elasticsearch.target(
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_completed)s"' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_completed)s"' % {
course_videos: teachers_common.queries.course_videos,
verb_completed: common.verb_ids.completed,
},
metrics=[common.metrics.count],
Expand All @@ -332,8 +332,8 @@ dashboard.new(
).addTarget(
elasticsearch.target(
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_completed)s"' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_completed)s"' % {
course_videos: teachers_common.queries.course_videos,
verb_completed: common.verb_ids.completed,
},
metrics=[common.metrics.cardinality(common.fields.actor_account_name)],
Expand Down Expand Up @@ -368,8 +368,8 @@ dashboard.new(
).addTarget(
elasticsearch.target(
datasource=common.datasources.lrs,
query='(%(course_query)s) AND verb.id:"%(verb_completed)s"' % {
course_query: teachers_common.queries.course_query,
query='%(course_videos)s AND verb.id:"%(verb_completed)s"' % {
course_videos: teachers_common.queries.course_videos,
verb_completed: common.verb_ids.completed,
},
metrics=[common.metrics.count],
Expand Down Expand Up @@ -525,8 +525,8 @@ dashboard.new(
type: 'count',
},
],
query: '(%(course_query)s) AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_query: teachers_common.queries.course_query,
query: '%(course_videos)s AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_videos: teachers_common.queries.course_videos,
verb_played: common.verb_ids.played,
time: common.utils.single_escape_string(teachers_common.fields.result_extensions_time),
view_count_threshold: teachers_common.constants.view_count_threshold,
Expand Down Expand Up @@ -594,8 +594,8 @@ dashboard.new(
],
datasource: common.datasources.lrs,
metrics: [common.metrics.cardinality(common.fields.actor_account_name)],
query: '(%(course_query)s) AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_query: teachers_common.queries.course_query,
query: '%(course_videos)s AND verb.id:"%(verb_played)s" AND %(time)s:[0 TO %(view_count_threshold)s]' % {
course_videos: teachers_common.queries.course_videos,
verb_played: common.verb_ids.played,
time: common.utils.single_escape_string(teachers_common.fields.result_extensions_time),
view_count_threshold: teachers_common.constants.view_count_threshold,
Expand All @@ -619,8 +619,8 @@ dashboard.new(
],
datasource: common.datasources.lrs,
metrics: [common.metrics.count],
query: '(%(course_query)s) AND verb.id:"%(verb_completed)s"' % {
course_query: teachers_common.queries.course_query,
query: '%(course_videos)s AND verb.id:"%(verb_completed)s"' % {
course_videos: teachers_common.queries.course_videos,
verb_completed: common.verb_ids.completed,
},
refId: 'Videos complete views query',
Expand All @@ -642,8 +642,8 @@ dashboard.new(
],
datasource: common.datasources.lrs,
metrics: [common.metrics.cardinality(common.fields.actor_account_name)],
query: '(%(course_query)s) AND verb.id:"%(verb_completed)s"' % {
course_query: teachers_common.queries.course_query,
query: '%(course_videos)s AND verb.id:"%(verb_completed)s"' % {
course_videos: teachers_common.queries.course_videos,
verb_completed: common.verb_ids.completed,
},
refId: 'Videos complete unique views query',
Expand Down

0 comments on commit 6060de2

Please sign in to comment.