Skip to content

Fix page_engagement_views_report: platform joins, block category filters, and uniqueness test#1923

Merged
quazi-h merged 1 commit into
page-engagement-views-reportfrom
copilot/sub-pr-1915
Feb 20, 2026
Merged

Fix page_engagement_views_report: platform joins, block category filters, and uniqueness test#1923
quazi-h merged 1 commit into
page-engagement-views-reportfrom
copilot/sub-pr-1915

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 20, 2026

page_engagement_views_report had several correctness issues introduced in the initial implementation.

Changes

  • Platform-conditional dim_user joins: Previously only joined on mitxonline_openedx_user_id, silently dropping users from edxorg, mitxpro, and residential. Now uses conditional joins per platform:

    inner join dim_user
        on (
            (page_engagement.platform = 'mitxonline'
                and page_engagement.openedx_user_id = dim_user.mitxonline_openedx_user_id)
            or (page_engagement.platform = 'edxorg'
                and page_engagement.openedx_user_id = dim_user.edxorg_openedx_user_id)
            or (page_engagement.platform = 'mitxpro'
                and page_engagement.openedx_user_id = dim_user.mitxpro_openedx_user_id)
            or (page_engagement.platform = 'residential'
                and page_engagement.openedx_user_id = dim_user.residential_openedx_user_id)
        )
  • block_category filters on subsection_blocks and section_blocks: Without these filters, the CTEs included all block types, causing incorrect joins on sequential_block_fk and chapter_block_fk. Now filters sequential and chapter respectively.

  • Removed unnecessary GROUP BY from course_runs CTE: int__combined__course_runs already guarantees unique courserun_readable_id values.

  • Added uniqueness test: dbt_expectations.expect_compound_columns_to_be_unique on [user_email, courserun_readable_id, unit_title] to enforce expected grain.


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Add page engagement views report Fix page_engagement_views_report: platform joins, block category filters, and uniqueness test Feb 20, 2026
Copilot AI requested a review from quazi-h February 20, 2026 19:58
@quazi-h quazi-h marked this pull request as ready for review February 20, 2026 20:38
@quazi-h quazi-h merged commit 5d2bf86 into page-engagement-views-report Feb 20, 2026
3 checks passed
@quazi-h quazi-h deleted the copilot/sub-pr-1915 branch February 20, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants