feat(tfact_enrollment): add Emeritus/Global Alumni platform support#2406
Open
quazi-h wants to merge 3 commits into
Open
feat(tfact_enrollment): add Emeritus/Global Alumni platform support#2406quazi-h wants to merge 3 commits into
quazi-h wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the dimensional enrollment fact model (tfact_enrollment) to include Emeritus and Global Alumni enrollments, so downstream consumers (notably the upcoming migration of marts__combined_course_enrollment_detail) don’t lose those platform rows when switching to dimensional sourcing.
Changes:
- Adds Emeritus and Global Alumni enrollment CTEs and unions them into
combined_enrollments. - Introduces a MITxPro external-readable-id lookup and a MITxPro-only
dim_course_runjoin path to resolvecourserun_fkfor these platforms. - Extends
user_lookupand FK resolution logic to support Emeritus/Global Alumni user IDs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add emeritus_enrollments/global_alumni_enrollments CTEs sourced from stg__emeritus__api__bigquery__user_enrollments / stg__global_alumni__api__bigquery__user_enrollments (the same staging models dim_user already uses for its emeritus_user_id/global_alumni_user_id columns), following the existing per-platform CTE pattern. - Add mitxpro_external_readable_id_lookup CTE (sourced from int__mitxpro__course_runs) to resolve these platforms' course run FK: Emeritus/Global Alumni don't own course run records, so their enrollments map onto existing MITxPro course runs via courserun_external_readable_id, mirroring the join logic previously used in int__combined__courserun_enrollments. - Extend user_lookup to select emeritus_user_id/global_alumni_user_id from dim_user (already present there) and thread through the user_fk coalesce chain. - Add dim_course_run_mitxpro CTE + join to resolve courserun_fk for these two platforms against MITxPro-platform dim_course_run rows. - enrollment_is_edx_enrolled is null for both (same treatment as program/bootcamps enrollments). Prerequisite for #2075/PR #2314 (migrate marts__combined_course_enrollment_detail to the dimensional layer): without this, sourcing that mart exclusively from tfact_enrollment would silently drop all Emeritus/Global Alumni enrollment rows. Closes #2405 Requires a --full-refresh of tfact_enrollment after deploy to backfill historical Emeritus/Global Alumni enrollment rows (incremental_strategy is delete+insert, so new CTEs alone only capture new activity going forward). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…lobal Alumni column mapping
- Use internal platform code 'mitxpro' instead of var("mitxpro") (display label
"xPro") when filtering dim_course_run_mitxpro, which was leaving courserun_fk
NULL for all Emeritus/Global Alumni enrollments.
- global_alumni_enrollments: source has no enrollment_created_on column (would
fail compilation against real data); null it out and surface the enrollment_status
the staging model does provide instead of dropping it.
- emeritus_enrollments: source provides enrollment_updated_on; use it instead of
NULL so incremental per-platform watermark logic works instead of falling back
to the 7-day lookback path.
…behavior The comment claimed Global Alumni rows fall back to the 7-day lookback path, but that path requires enrollment_created_on to be non-null. Since Global Alumni has neither enrollment_created_on nor enrollment_updated_on, it actually hits the unconditional 'or ewf.enrollment_created_on is null' branch and is fully reprocessed on every incremental run.
blarghmatey
force-pushed
the
copilot/2405-emeritus-global-alumni-tfact-enrollment
branch
from
July 16, 2026 14:06
04f71c6 to
438018c
Compare
🔎 ol-dbt impact — column-level blast radius✅ No column-level downstream impact detected for the changed models. Posted by |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What are the relevant tickets?
Closes #2405
Blocks #2075 (PR #2314 — migrate
marts__combined_course_enrollment_detailto the dimensional layer)Description (What does it do?)
Adds
emeritusandglobal_alumniplatform support totfact_enrollment, which previously had no coverage for these two platforms. Without this, migratingmarts__combined_course_enrollment_detailto source exclusively fromtfact_enrollment(PR #2314) would silently drop all Emeritus/Global Alumni enrollment rows — this was flagged during Copilot review on that PR.Changes:
emeritus_enrollments/global_alumni_enrollmentsCTEs sourced fromstg__emeritus__api__bigquery__user_enrollments/stg__global_alumni__api__bigquery__user_enrollments— the same staging modelsdim_useralready uses for its existingemeritus_user_id/global_alumni_user_idcolumns — following the existing per-platform CTE pattern intfact_enrollment.mitxpro_external_readable_id_lookupCTE (fromint__mitxpro__course_runs) to resolve these platforms' course run FK: Emeritus/Global Alumni don't own course run records, so their enrollments map onto existing MITxPro course runs viacourserun_external_readable_id, mirroring the join logic previously used inint__combined__courserun_enrollments.user_lookupto selectemeritus_user_id/global_alumni_user_idfromdim_userand thread through theuser_fkcoalesce chain.dim_course_run_mitxproCTE + join to resolvecourserun_fkfor these two platforms against MITxPro-platformdim_course_runrows.enrollment_is_edx_enrolled=nullfor both (same treatment asprogram/bootcampsenrollments).How can this be tested?
dbt compile --select tfact_enrollment— verified clean.sqlfluff-lint/sqlfluff-fix— verified clean, no changes needed.main'smarts__combined_course_enrollment_detailandtfact_enrollment(filteredenrollment_type = 'course') to confirm Emeritus/Global Alumni parity before feat(#2075): migrate marts__combined_course_enrollment_detail to dimensional models #2314 merges.Additional Context
This PR should merge and be deployed (with
--full-refresh) before PR #2314 merges.