Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ __pycache__/

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
Expand Down
4 changes: 4 additions & 0 deletions tutor/openedx_ai_extensions/patches/superset-extra-assets
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% for file in "openedx-ai-extensions/build/assets"|walk_templates %}
---
{% include file %}
{% endfor %}
18 changes: 18 additions & 0 deletions tutor/openedx_ai_extensions/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,24 @@ def _mount_plugin(mounts, path):
hooks.Filters.ENV_PATCHES.add_item((os.path.basename(path), patch_file.read()))


########################
# Template rendering
# Required for superset-extra-assets (datasets, charts, dashboards)
########################

hooks.Filters.ENV_TEMPLATE_ROOTS.add_items(
[
str(importlib_resources.files("openedx_ai_extensions") / "templates"),
]
)

hooks.Filters.ENV_TEMPLATE_TARGETS.add_items(
[
("openedx-ai-extensions/build", "plugins"),
],
)


########################
# UI Slot configurations
########################
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
_file_name: daily_token_consumption_trend.yaml
slice_name: Daily Token Consumption Trend
description: null
certified_by: null
certification_details: null
viz_type: echarts_timeseries_line
params:
datasource: 92__table
viz_type: echarts_timeseries_line
slice_id: 167
x_axis: emission_date
time_grain_sqla: P1D
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
metrics:
- expressionType: SIMPLE
column:
advanced_data_type: null
certification_details: null
certified_by: null
column_name: total_tokens
description: Total tokens used (prompt + completion)
expression: null
filterable: true
groupby: false
id: 927
is_certified: false
is_dttm: false
python_date_format: null
type: Nullable(Int64)
type_generic: 0
verbose_name: Total Tokens
warning_markdown: null
aggregate: SUM
sqlExpression: null
datasourceWarning: false
hasCustomLabel: true
label: Total Tokens
optionName: metric_qv3jyw4lu7_h9abbkf2v8u
groupby:
- workflow_name
contributionMode: null
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_date
order_desc: true
row_limit: 10000
truncate_metric: true
show_empty_columns: true
comparison_type: values
annotation_layers: []
forecastPeriods: 10
forecastInterval: 0.8
x_axis_title_margin: 15
y_axis_title_margin: 15
y_axis_title_position: Left
sort_series_type: sum
color_scheme: supersetColors
seriesType: line
only_total: true
opacity: 0.2
markerSize: 6
show_legend: true
legendType: scroll
legendOrientation: top
x_axis_time_format: smart_date
rich_tooltip: true
tooltipTimeFormat: smart_date
y_axis_format: SMART_NUMBER
truncateXAxis: true
y_axis_bounds:
- null
- null
extra_form_data: {}
dashboards: []
query_context: '{"datasource":{"id":92,"type":"table"},"force":false,"queries":[{"filters":[{"col":"emission_time","op":"TEMPORAL_RANGE","val":"No
filter"},{"col":"emission_date","op":"TEMPORAL_RANGE","val":"No filter"}],"extras":{"time_grain_sqla":"P1D","having":"","where":""},"applied_time_extras":{},"columns":[{"timeGrain":"P1D","columnType":"BASE_AXIS","sqlExpression":"emission_date","label":"emission_date","expressionType":"SQL"},"workflow_name"],"metrics":[{"expressionType":"SIMPLE","column":{"advanced_data_type":null,"certification_details":null,"certified_by":null,"column_name":"total_tokens","description":"Total
tokens used (prompt + completion)","expression":null,"filterable":true,"groupby":false,"id":927,"is_certified":false,"is_dttm":false,"python_date_format":null,"type":"Nullable(Int64)","type_generic":0,"verbose_name":"Total
Tokens","warning_markdown":null},"aggregate":"SUM","sqlExpression":null,"datasourceWarning":false,"hasCustomLabel":true,"label":"Total
Tokens","optionName":"metric_qv3jyw4lu7_h9abbkf2v8u"}],"orderby":[[{"expressionType":"SIMPLE","column":{"advanced_data_type":null,"certification_details":null,"certified_by":null,"column_name":"total_tokens","description":"Total
tokens used (prompt + completion)","expression":null,"filterable":true,"groupby":false,"id":927,"is_certified":false,"is_dttm":false,"python_date_format":null,"type":"Nullable(Int64)","type_generic":0,"verbose_name":"Total
Tokens","warning_markdown":null},"aggregate":"SUM","sqlExpression":null,"datasourceWarning":false,"hasCustomLabel":true,"label":"Total
Tokens","optionName":"metric_qv3jyw4lu7_h9abbkf2v8u"},false]],"annotation_layers":[],"row_limit":10000,"series_columns":["workflow_name"],"series_limit":0,"order_desc":true,"url_params":{},"custom_params":{},"custom_form_data":{},"time_offsets":[],"post_processing":[{"operation":"pivot","options":{"index":["emission_date"],"columns":["workflow_name"],"aggregates":{"Total
Tokens":{"operator":"mean"}},"drop_missing_columns":false}},{"operation":"rename","options":{"columns":{"Total
Tokens":null},"level":0,"inplace":true}},{"operation":"flatten"}]}],"form_data":{"datasource":"92__table","viz_type":"echarts_timeseries_line","slice_id":167,"x_axis":"emission_date","time_grain_sqla":"P1D","x_axis_sort_asc":true,"x_axis_sort_series":"name","x_axis_sort_series_ascending":true,"metrics":[{"expressionType":"SIMPLE","column":{"advanced_data_type":null,"certification_details":null,"certified_by":null,"column_name":"total_tokens","description":"Total
tokens used (prompt + completion)","expression":null,"filterable":true,"groupby":false,"id":927,"is_certified":false,"is_dttm":false,"python_date_format":null,"type":"Nullable(Int64)","type_generic":0,"verbose_name":"Total
Tokens","warning_markdown":null},"aggregate":"SUM","sqlExpression":null,"datasourceWarning":false,"hasCustomLabel":true,"label":"Total
Tokens","optionName":"metric_qv3jyw4lu7_h9abbkf2v8u"}],"groupby":["workflow_name"],"contributionMode":null,"adhoc_filters":[{"clause":"WHERE","comparator":"No
filter","expressionType":"SIMPLE","operator":"TEMPORAL_RANGE","subject":"emission_time"},{"clause":"WHERE","comparator":"No
filter","expressionType":"SIMPLE","operator":"TEMPORAL_RANGE","subject":"emission_date"}],"order_desc":true,"row_limit":10000,"truncate_metric":true,"show_empty_columns":true,"comparison_type":"values","annotation_layers":[],"forecastPeriods":10,"forecastInterval":0.8,"x_axis_title_margin":15,"y_axis_title_margin":15,"y_axis_title_position":"Left","sort_series_type":"sum","color_scheme":"supersetColors","seriesType":"line","only_total":true,"opacity":0.2,"markerSize":6,"show_legend":true,"legendType":"scroll","legendOrientation":"top","x_axis_time_format":"smart_date","rich_tooltip":true,"tooltipTimeFormat":"smart_date","y_axis_format":"SMART_NUMBER","truncateXAxis":true,"y_axis_bounds":[null,null],"extra_form_data":{},"dashboards":[],"force":false,"result_format":"json","result_type":"full"},"result_format":"json","result_type":"full"}'
cache_timeout: null
uuid: b13ccb0b-c3fe-4d04-9970-ee2c8c97ae3f
version: 1.0.0
dataset_uuid: a7c3e8f1-5b2d-4e9a-8f1c-3d7e5a9b2c4f
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
_file_name: event_count_by_verb.yaml
uuid: 6c7d8e9f-0a1b-2c3d-4e5f-6a7b8c9d0e1f
dataset_uuid: a7c3e8f1-5b2d-4e9a-8f1c-3d7e5a9b2c4f
slice_name: Event Count by Verb
description: null
certified_by: null
certification_details: null
viz_type: pie
params:
datasource: 92__table
viz_type: pie
slice_id: 168
groupby:
- verb
metric:
expressionType: SIMPLE
column:
advanced_data_type: null
certification_details: null
certified_by: null
column_name: event_id
description: Unique identifier for each xAPI event
expression: null
filterable: true
groupby: false
id: 915
is_certified: false
is_dttm: false
python_date_format: null
type: UUID
type_generic: 1
verbose_name: Event ID
warning_markdown: null
aggregate: COUNT
sqlExpression: null
datasourceWarning: false
hasCustomLabel: true
label: Event Count
optionName: metric_7421u8cab16_2gaahp2wrv4
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
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: []
query_context: null
cache_timeout: null
version: 1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
_file_name: event_count_by_workflow.yaml
uuid: 5b6c7d8e-9f0a-1b2c-3d4e-5f6a7b8c9d0e
dataset_uuid: a7c3e8f1-5b2d-4e9a-8f1c-3d7e5a9b2c4f
slice_name: Event Count by Workflow
description: null
certified_by: null
certification_details: null
viz_type: echarts_timeseries_bar
params:
datasource: 92__table
viz_type: echarts_timeseries_bar
slice_id: 169
x_axis: workflow_name
xAxisForceCategorical: true
x_axis_sort: workflow_name
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
metrics:
- expressionType: SIMPLE
column:
advanced_data_type: null
certification_details: null
certified_by: null
column_name: event_id
description: Unique identifier for each xAPI event
expression: null
filterable: true
groupby: false
id: 915
is_certified: false
is_dttm: false
python_date_format: null
type: UUID
type_generic: 1
verbose_name: Event ID
warning_markdown: null
aggregate: COUNT
sqlExpression: null
datasourceWarning: false
hasCustomLabel: true
label: Event Count
optionName: metric_13jy73i6akk_0hsv50zelfn
groupby: []
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
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_margin: 15
y_axis_title_position: Left
sort_series_type: sum
color_scheme: supersetColors
only_total: true
show_legend: true
legendType: scroll
legendOrientation: top
x_axis_time_format: smart_date
y_axis_format: SMART_NUMBER
truncateXAxis: true
y_axis_bounds:
- null
- null
rich_tooltip: true
tooltipTimeFormat: smart_date
extra_form_data: {}
dashboards: []
query_context: null
cache_timeout: null
version: 1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
_file_name: total_tokens_by_course.yaml
uuid: 3f2e2d1c-4b5a-6e7f-8a9b-0c1d2e3f4a5b
dataset_uuid: a7c3e8f1-5b2d-4e9a-8f1c-3d7e5a9b2c4f
slice_name: Total Tokens By Course
description: null
certified_by: null
certification_details: null
viz_type: echarts_timeseries_bar
params:
datasource: 92__table
viz_type: echarts_timeseries_bar
slice_id: 170
x_axis: course_key
xAxisForceCategorical: true
x_axis_sort: course_key
x_axis_sort_asc: true
x_axis_sort_series: name
x_axis_sort_series_ascending: true
metrics:
- expressionType: SIMPLE
column:
advanced_data_type: null
certification_details: null
certified_by: null
column_name: total_tokens
description: Total tokens used (prompt + completion)
expression: null
filterable: true
groupby: false
id: 927
is_certified: false
is_dttm: false
python_date_format: null
type: Nullable(Int64)
type_generic: 0
verbose_name: Total Tokens
warning_markdown: null
aggregate: SUM
sqlExpression: null
datasourceWarning: false
hasCustomLabel: true
label: Total Tokens
optionName: metric_gzreklovcg_eh7or6gyrcp
groupby: []
adhoc_filters:
- clause: WHERE
comparator: No filter
expressionType: SIMPLE
operator: TEMPORAL_RANGE
subject: emission_time
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_margin: 15
y_axis_title_position: Left
sort_series_type: sum
color_scheme: supersetColors
only_total: true
show_legend: true
legendType: scroll
legendOrientation: top
x_axis_time_format: smart_date
y_axis_format: SMART_NUMBER
truncateXAxis: true
y_axis_bounds:
- null
- null
rich_tooltip: true
tooltipTimeFormat: smart_date
extra_form_data: {}
dashboards: []
query_context: null
cache_timeout: null
version: 1.0.0
Loading
Loading