Skip to content

Commit

Permalink
feat: add graded and block_type to dim_course_blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Feb 29, 2024
1 parent 7ae44e6 commit e8352e1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 11 additions & 1 deletion models/base/dim_course_blocks.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,17 @@ select
courses.course_run as course_run,
blocks.location as block_id,
blocks.block_name as block_name,
blocks.display_name_with_location as display_name_with_location
blocks.display_name_with_location as display_name_with_location,
graded,
case
when block_id like '%@chapter+block@%'
then 'section'
when block_id like '%@sequential+block@%'
then 'subsection'
when block_id like '%@vertical+block@%'
then 'unit'
else regexpExtract(block_id, '@([^+]+)\+block@', 1)
end as block_type
from {{ source("event_sink", "course_block_names") }} blocks
join
{{ source("event_sink", "course_names") }} courses
Expand Down
5 changes: 5 additions & 0 deletions models/base/schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ models:
- name: display_name_with_location
data_type: String
description: "The block's display name with section, subsection, and unit prepended to the name. This provides additional context when looking at block names and can help data consumers understand which block they are analyzing"
- name: graded
data_type: Boolean
- block_type:
data_type: String
description: "The type of block. This can be a section, subsection, unit, or the block type"

0 comments on commit e8352e1

Please sign in to comment.