Skip to content

Commit

Permalink
feat: move page engagement to an mv
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed May 27, 2024
1 parent 714e660 commit 314143b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ offset: 0
params: null
schema: '{{ DBT_PROFILE_TARGET_DATABASE }}'
sql: |-
{% filter indent(width=2) %}{% include 'openedx-assets/queries/fact_page_views.sql' %}{% endfilter %}
{% filter indent(width=2) %}{% include 'openedx-assets/queries/fact_page_engagement.sql' %}{% endfilter %}
table_name: fact_pageview_engagement
template_params: {}
uuid: 9febd6be-5102-4dbf-86b9-45ebd3cbbc45
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
with
subsection_engagement as (
select
org,
course_key,
'subsection' as content_level,
actor_id,
subsection_block_id as block_id,
engagement_level as section_subsection_page_engagement
from {{ ASPECTS_XAPI_DATABASE }}.subsection_page_engagement
where 1=1
{% include 'openedx-assets/queries/common_filters.sql' %}
),
section_engagement as (
select
org,
course_key,
'section' as content_level,
actor_id,
section_block_id as block_id,
engagement_level as section_subsection_page_engagement
from {{ ASPECTS_XAPI_DATABASE }}.section_page_engagement
),
page_engagement as (
select *
from subsection_engagement
union all
select *
from section_engagement
)

select
pv.org as org,
pv.course_key as course_key,
course_blocks.course_run as course_run,
course_blocks.display_name_with_location as section_subsection_name,
pv.content_level as content_level,
pv.actor_id as actor_id,
pv.section_subsection_page_engagement as section_subsection_page_engagement,
users.username as username,
users.name as name,
users.email as email
from page_engagement pv
join
{{ DBT_PROFILE_TARGET_DATABASE }}.dim_course_blocks course_blocks
on (
pv.org = course_blocks.org
and pv.course_key = course_blocks.course_key
and pv.block_id = course_blocks.block_id
)
left outer join
{{ DBT_PROFILE_TARGET_DATABASE }}.dim_user_pii users on toUUID(pv.actor_id) = users.external_user_id

This file was deleted.

0 comments on commit 314143b

Please sign in to comment.