Skip to content

Commit

Permalink
fix: restore query context for charts
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Mar 15, 2024
1 parent b1c1524 commit 3864b02
Show file tree
Hide file tree
Showing 16 changed files with 124 additions and 43 deletions.
3 changes: 1 addition & 2 deletions tutoraspects/asset_command_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,11 @@ class ChartAsset(Asset):

path = "charts"
omitted_vars = [
"query_context",
"params.dashboards",
"params.datasource",
"params.slice_id",
]
raw_vars = ["sqlExpression"]
raw_vars = ["sqlExpression", "query_context"]


class DashboardAsset(Asset):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ dataset_uuid: d777bd95-2110-46db-a1c4-8358be81a85a
description: The distribution of grades for a course, out of 100%. Grades are grouped
in ranges of 10%.
params:
adhoc_filters: []
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
bottom_margin: auto
color_scheme: supersetColors
columns: []
extra_form_data: {}
granularity_sqla: emission_time
groupby:
- grade_bucket
metrics:
Expand All @@ -29,6 +33,10 @@ params:
- null
y_axis_format: SMART_NUMBER
y_axis_label: Number Of Students
query_context: '{"datasource":{"id":236,"type":"table"},"force":false,"queries":[{"filters":[{"col":"emission_time","op":"TEMPORAL_RANGE","val":"No
filter"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":["grade_bucket"],"metrics":["students"],"annotation_layers":[],"row_limit":10000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"236__table","viz_type":"dist_bar","slice_id":298,"metrics":["students"],"adhoc_filters":[{"clause":"WHERE","subject":"emission_time","operator":"TEMPORAL_RANGE","comparator":"No
filter","expressionType":"SIMPLE"}],"groupby":["grade_bucket"],"columns":[],"row_limit":10000,"order_desc":true,"color_scheme":"supersetColors","show_legend":false,"rich_tooltip":true,"order_bars":true,"y_axis_format":"SMART_NUMBER","y_axis_label":"Number
Of Students","y_axis_bounds":[null,null],"x_axis_label":"Course Grade (out of 100%)","bottom_margin":"auto","x_ticks_layout":"auto","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
slice_name: Course Grade Distribution
uuid: f9adbc85-1f50-4c04-ace3-31ba7390de5e
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,17 @@ params:
operatorId: EQUALS
sqlExpression: null
subject: enrollment_status
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: enrollment_status_date
color_picker:
a: 1
b: 135
g: 122
r: 0
extra_form_data: {}
granularity_sqla: enrollment_status_date
header_font_size: 0.4
metric: count
rolling_type: None
Expand All @@ -34,9 +38,12 @@ params:
subheader_font_size: 0.15
time_format: smart_date
time_grain_sqla: P1D
time_range: No filter
viz_type: big_number
x_axis: enrollment_status_date
y_axis_format: SMART_NUMBER
query_context: '{"datasource":{"id":188,"type":"table"},"force":false,"queries":[{"filters":[{"col":"enrollment_status","op":"==","val":"registered"},{"col":"enrollment_status_date","op":"TEMPORAL_RANGE","val":"No
filter"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":[{"timeGrain":"P1D","columnType":"BASE_AXIS","sqlExpression":"enrollment_status_date","label":"enrollment_status_date","expressionType":"SQL"}],"metrics":["count"],"annotation_layers":[],"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{},"post_processing":[{"operation":"pivot","options":{"index":["enrollment_status_date"],"columns":[],"aggregates":{"count":{"operator":"mean"}},"drop_missing_columns":true}},{"operation":"flatten"}]}],"form_data":{"datasource":"188__table","viz_type":"big_number","slice_id":344,"x_axis":"enrollment_status_date","time_grain_sqla":"P1D","metric":"count","adhoc_filters":[{"clause":"WHERE","comparator":"registered","expressionType":"SIMPLE","filterOptionName":"filter_hcnm4t7piq6_hfbtt65nqqs","isExtra":false,"isNew":false,"operator":"==","operatorId":"EQUALS","sqlExpression":null,"subject":"enrollment_status"},{"clause":"WHERE","subject":"enrollment_status_date","operator":"TEMPORAL_RANGE","comparator":"No
filter","expressionType":"SIMPLE"}],"show_trend_line":true,"start_y_axis_at_zero":true,"color_picker":{"a":1,"b":135,"g":122,"r":0},"header_font_size":0.4,"subheader_font_size":0.15,"y_axis_format":"SMART_NUMBER","time_format":"smart_date","rolling_type":"None","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
slice_name: Currently Enrolled Learners Per Day
uuid: ed2fe731-6544-422f-bc55-42f399f48b2c
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ certified_by: null
dataset_uuid: 39d1e786-c0c8-4c56-81c8-56fb0df88001
description: null
params:
adhoc_filters: []
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
extra_form_data: {}
granularity_sqla: emission_time
header_font_size: 0.4
metric:
aggregate: COUNT_DISTINCT
Expand Down Expand Up @@ -36,9 +40,11 @@ params:
sqlExpression: null
subheader_font_size: 0.15
time_format: smart_date
time_range: No filter
viz_type: big_number_total
y_axis_format: SMART_NUMBER
query_context: '{"datasource":{"id":242,"type":"table"},"force":false,"queries":[{"filters":[{"col":"emission_time","op":"TEMPORAL_RANGE","val":"No
filter"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":[],"metrics":[{"aggregate":"COUNT_DISTINCT","column":{"advanced_data_type":null,"certification_details":null,"certified_by":null,"column_name":"actor_id","description":null,"expression":null,"filterable":true,"groupby":true,"id":445,"is_certified":false,"is_dttm":false,"python_date_format":null,"type":"String","type_generic":1,"verbose_name":null,"warning_markdown":null},"datasourceWarning":false,"expressionType":"SIMPLE","hasCustomLabel":false,"label":"COUNT_DISTINCT(actor_id)","optionName":"metric_5y4uvwa13v4_f12i3twecs6","sqlExpression":null}],"annotation_layers":[],"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"242__table","viz_type":"big_number_total","slice_id":395,"metric":{"aggregate":"COUNT_DISTINCT","column":{"advanced_data_type":null,"certification_details":null,"certified_by":null,"column_name":"actor_id","description":null,"expression":null,"filterable":true,"groupby":true,"id":445,"is_certified":false,"is_dttm":false,"python_date_format":null,"type":"String","type_generic":1,"verbose_name":null,"warning_markdown":null},"datasourceWarning":false,"expressionType":"SIMPLE","hasCustomLabel":false,"label":"COUNT_DISTINCT(actor_id)","optionName":"metric_5y4uvwa13v4_f12i3twecs6","sqlExpression":null},"adhoc_filters":[{"clause":"WHERE","subject":"emission_time","operator":"TEMPORAL_RANGE","comparator":"No
filter","expressionType":"SIMPLE"}],"header_font_size":0.4,"subheader_font_size":0.15,"y_axis_format":"SMART_NUMBER","time_format":"smart_date","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
slice_name: Distinct forum users
uuid: feb323ad-c819-49ca-a336-584bd9ff1a2e
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ params:
- null
y_axis_format: SMART_NUMBER
y_axis_label: Students
query_context: '{"datasource":{"id":209,"type":"table"},"force":false,"queries":[{"filters":[{"col":"success","op":"==","val":"true"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":["attempts"],"metrics":["students"],"annotation_layers":[],"row_limit":10000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"209__table","viz_type":"dist_bar","slice_id":331,"metrics":["students"],"adhoc_filters":[{"clause":"WHERE","comparator":"true","expressionType":"SIMPLE","filterOptionName":"filter_0fpmws3t1h6a_md2ud9xse7m","isExtra":false,"isNew":false,"operator":"==","operatorId":"EQUALS","sqlExpression":null,"subject":"success"}],"groupby":["attempts"],"columns":[],"row_limit":10000,"order_desc":true,"color_scheme":"supersetColors","show_legend":false,"rich_tooltip":true,"order_bars":true,"y_axis_format":"SMART_NUMBER","y_axis_label":"Students","y_axis_bounds":[null,null],"x_axis_label":"Number
Of Attempts To Find Correct Answer","bottom_margin":"auto","x_ticks_layout":"auto","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
slice_name: Distribution Of Attempts
uuid: db90930f-f16e-4c32-8050-0e4abae28f4c
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ params:
- null
y_axis_format: SMART_NUMBER
y_axis_label: Students
query_context: '{"datasource":{"id":191,"type":"table"},"force":false,"queries":[{"filters":[],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":["total_hints"],"metrics":["students"],"annotation_layers":[],"row_limit":10000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"191__table","viz_type":"dist_bar","slice_id":307,"metrics":["students"],"adhoc_filters":[],"groupby":["total_hints"],"columns":[],"row_limit":10000,"order_desc":true,"color_scheme":"supersetColors","show_legend":false,"rich_tooltip":true,"y_axis_format":"SMART_NUMBER","y_axis_label":"Students","y_axis_bounds":[null,null],"x_axis_label":"Hints
/ Answer Displayed Before Correct Answer Chosen","bottom_margin":"auto","x_ticks_layout":"auto","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
slice_name: Distribution Of Hints Per Correct Answer
uuid: ee94be4c-6fdd-4295-b43c-40890d6c549d
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ description: 'This chart shows the number of students who scored within a certai
percentage of points for this problem. For problems that are pass/fail it will only
show the lowest and highest percentage ranges. '
params:
adhoc_filters: []
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
bottom_margin: auto
color_scheme: supersetColors
columns: []
extra_form_data: {}
granularity_sqla: emission_time
groupby:
- grade_bucket
metrics:
Expand All @@ -30,6 +34,10 @@ params:
- null
y_axis_format: SMART_NUMBER
y_axis_label: Students
query_context: '{"datasource":{"id":215,"type":"table"},"force":false,"queries":[{"filters":[{"col":"emission_time","op":"TEMPORAL_RANGE","val":"No
filter"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":["grade_bucket"],"metrics":["students"],"annotation_layers":[],"row_limit":10000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"215__table","viz_type":"dist_bar","slice_id":382,"metrics":["students"],"adhoc_filters":[{"clause":"WHERE","subject":"emission_time","operator":"TEMPORAL_RANGE","comparator":"No
filter","expressionType":"SIMPLE"}],"groupby":["grade_bucket"],"columns":[],"row_limit":10000,"order_desc":true,"color_scheme":"supersetColors","show_legend":false,"rich_tooltip":true,"order_bars":true,"y_axis_format":"SMART_NUMBER","y_axis_label":"Students","y_axis_bounds":[null,null],"x_axis_label":"Percentage
Grade","bottom_margin":"auto","x_ticks_layout":"auto","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
slice_name: Distribution Of Problem Grades
uuid: 4f7e3606-f5de-4643-97c0-bbb6340a3df2
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ description: This chart shows how often an answer or combination of answers (for
is selected by learners. Some problems allow learners to submit a response more
than once, this chart will include all of the responses in that case.
params:
adhoc_filters: []
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
bottom_margin: auto
color_scheme: supersetColors
columns: []
extra_form_data: {}
granularity_sqla: emission_time
groupby:
- responses
metrics:
Expand All @@ -29,6 +33,10 @@ params:
- null
y_axis_format: SMART_NUMBER
y_axis_label: Responses
query_context: '{"datasource":{"id":225,"type":"table"},"force":false,"queries":[{"filters":[{"col":"emission_time","op":"TEMPORAL_RANGE","val":"No
filter"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":["responses"],"metrics":["total_responses"],"annotation_layers":[],"row_limit":10000,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"225__table","viz_type":"dist_bar","slice_id":352,"metrics":["total_responses"],"adhoc_filters":[{"clause":"WHERE","subject":"emission_time","operator":"TEMPORAL_RANGE","comparator":"No
filter","expressionType":"SIMPLE"}],"groupby":["responses"],"columns":[],"row_limit":10000,"order_desc":true,"color_scheme":"supersetColors","show_legend":false,"rich_tooltip":true,"y_axis_format":"SMART_NUMBER","y_axis_label":"Responses","y_axis_bounds":[null,null],"x_axis_label":"Answers
Chosen","bottom_margin":"auto","x_ticks_layout":"auto","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
slice_name: Distribution Of Responses
uuid: f1651c44-a8f4-4b44-ad49-962823009319
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ description: A count of the number of enrollments and un-enrollments per day. Le
can enroll and unenroll multiple times, in this chart each individual enrollment
and unenrollment will be counted.
params:
adhoc_filters: []
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
annotation_layers: []
color_scheme: supersetColors
comparison_type: values
extra_form_data: {}
forecastInterval: 0.8
forecastPeriods: 10
granularity_sqla: emission_time
groupby:
- expressionType: SQL
label: Enrollment Status
Expand All @@ -32,13 +36,17 @@ params:
row_limit: 10000
show_empty_columns: true
show_legend: false
stack: true
sort_series_type: sum
stack: null
time_grain_sqla: P1D
time_range: No filter
tooltipTimeFormat: smart_date
truncate_metric: true
viz_type: echarts_timeseries_bar
xAxisLabelRotation: 45
x_axis: emission_time
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
x_axis_time_format: '%Y-%m-%d'
x_axis_title_margin: 15
y_axis_bounds:
Expand All @@ -48,6 +56,8 @@ params:
y_axis_title: Number Of Events
y_axis_title_margin: 15
y_axis_title_position: Left
query_context: |-
{% raw %}{"datasource":{"id":224,"type":"table"},"force":false,"queries":[{"filters":[{"col":"emission_time","op":"TEMPORAL_RANGE","val":"No filter"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":[{"timeGrain":"P1D","columnType":"BASE_AXIS","sqlExpression":"emission_time","label":"emission_time","expressionType":"SQL"},{"expressionType":"SQL","label":"Enrollment Status","sqlExpression":"{{translate_column('enrollment_status')}}"}],"metrics":["count"],"orderby":[["count",false]],"annotation_layers":[],"row_limit":10000,"series_columns":[{"expressionType":"SQL","label":"Enrollment Status","sqlExpression":"{{translate_column('enrollment_status')}}"}],"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{},"time_offsets":[],"post_processing":[{"operation":"pivot","options":{"index":["emission_time"],"columns":["Enrollment Status"],"aggregates":{"count":{"operator":"mean"}},"drop_missing_columns":false}},{"operation":"rename","options":{"columns":{"count":null},"level":0,"inplace":true}},{"operation":"flatten"}]}],"form_data":{"datasource":"224__table","viz_type":"echarts_timeseries_bar","slice_id":332,"x_axis":"emission_time","time_grain_sqla":"P1D","x_axis_sort_asc":true,"x_axis_sort_series":"name","x_axis_sort_series_ascending":true,"metrics":["count"],"groupby":[{"expressionType":"SQL","label":"Enrollment Status","sqlExpression":"{{translate_column('enrollment_status')}}"}],"adhoc_filters":[{"clause":"WHERE","subject":"emission_time","operator":"TEMPORAL_RANGE","comparator":"No filter","expressionType":"SIMPLE"}],"order_desc":true,"row_limit":10000,"truncate_metric":true,"show_empty_columns":true,"comparison_type":"values","annotation_layers":[],"forecastPeriods":10,"forecastInterval":0.8,"orientation":"vertical","x_axis_title_margin":15,"y_axis_title":"Number Of Events","y_axis_title_margin":15,"y_axis_title_position":"Left","sort_series_type":"sum","color_scheme":"supersetColors","stack":null,"only_total":true,"show_legend":false,"legendType":"scroll","legendOrientation":"top","legendMargin":null,"x_axis_time_format":"%Y-%m-%d","xAxisLabelRotation":45,"y_axis_format":"SMART_NUMBER","y_axis_bounds":[null,null],"rich_tooltip":true,"tooltipTimeFormat":"smart_date","extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}{% endraw %}
slice_name: Enrollment Events Per Day
uuid: bb1147cc-b7bc-44b7-b06a-79b0db6626aa
version: 1.0.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ params:
operatorId: EQUALS
sqlExpression: null
subject: enrollment_status
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
color_scheme: supersetColors
date_format: smart_date
extra_form_data: {}
Expand All @@ -40,6 +45,8 @@ params:
show_legend: true
sort_by_metric: true
viz_type: pie
query_context: |-
{% raw %}{"datasource":{"id":224,"type":"table"},"force":false,"queries":[{"filters":[{"col":"enrollment_status","op":"==","val":"registered"},{"col":"emission_time","op":"TEMPORAL_RANGE","val":"No filter"}],"extras":{"having":"","where":""},"applied_time_extras":{},"columns":[{"expressionType":"SQL","label":"Enrollment Mode","sqlExpression":"{{translate_column('enrollment_mode')}}"}],"metrics":["count"],"orderby":[["count",false]],"annotation_layers":[],"row_limit":100,"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{}}],"form_data":{"datasource":"224__table","viz_type":"pie","slice_id":411,"groupby":[{"expressionType":"SQL","label":"Enrollment Mode","sqlExpression":"{{translate_column('enrollment_mode')}}"}],"metric":"count","adhoc_filters":[{"clause":"WHERE","comparator":"registered","expressionType":"SIMPLE","filterOptionName":"filter_itrvc9c0jxb_g4qd4b18na4","isExtra":false,"isNew":false,"operator":"==","operatorId":"EQUALS","sqlExpression":null,"subject":"enrollment_status"},{"clause":"WHERE","subject":"emission_time","operator":"TEMPORAL_RANGE","comparator":"No filter","expressionType":"SIMPLE"}],"row_limit":100,"sort_by_metric":true,"color_scheme":"supersetColors","show_labels_threshold":5,"show_legend":true,"legendType":"scroll","legendOrientation":"top","label_type":"key","number_format":"SMART_NUMBER","date_format":"smart_date","show_labels":true,"labels_outside":true,"outerRadius":70,"innerRadius":30,"extra_form_data":{},"dashboards":[148],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}{% endraw %}
slice_name: Enrollments By Enrollment Mode
uuid: 05ed7102-5464-4e2f-86ae-31700b787cc3
version: 1.0.0
Expand Down
Loading

0 comments on commit 3864b02

Please sign in to comment.