TDOE#230: Refactor Student Disability Models.#250
Open
AngelicaLastra wants to merge 11 commits into
Open
Conversation
…rows are edorg level and which are program level
…ich is to usually use the ref name directly
This was referenced Jun 9, 2026
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.
Warning
This PR results in breaking changes. Any implementation using the newest version of this package would be required to generate a
xwalk_disability_designationscsv seed (even if empty).This PR also requires the companion edu_edfi_source PR#190 to be released before this PR can run cleanly.
Description & motivation
This PR is a subset of TN'S edu_wh PR #230, it introduces
fct_student_disability, a new fact table that unifies student disabilities from two Ed-Fi sources:StudentEducationOrganizationAssociation.Disabilities(ed org level) andStudentSpecialEducationProgramAssociation.Disabilities(program level).Main highlights:
bld_ef3__student__disabilitiesandbld_ef3__student__wide_disability_designations, handle stacking and designation pivoting for student disability models before the final fact model's further transformations.fct_student_disabilitytable covers two distinct grains in a single place. Anis_programboolean flag, makes it easier to distinguish program-level from ed org-level rows without null-checkingk_program.k_student_programis surfaced as a primary key for program rows and joins to program association fact tables, in anticipation of PR#249.xwalk_disability_designations, using the sameea_pivot+accordion_columnspattern used elsewhere in the warehouse.PR Merge Priority:
New files created:
Build models:
bld_ef3__student__disabilities:stg_ef3__stu_ed_org__disabilities(always included) andstg_ef3__stu_spec_ed__disabilities(gated onsrc:program:special_ed:enabled) usingdbt_utils.union_relations.is_programand carriesk_student_programforward for downstream use.k_student_disabilitysurrogate key here so the wide designation model can carry it forward and the final fact join reduces to a single join on that key.bld_ef3__student__wide_disability_designations:v_designationsusingouter=trueso disability records with no designations are preserved as all-false rows rather than being dropped.ea_pivotagainstxwalk_disability_designations. The pivot block is skipped entirely when the crosswalk is empty via theis_empty_model().Warehouse model:
fct_student_disability:bld_ef3__student__disabilitiestodim_studentand left joins tobld_ef3__student__wide_disability_designationsfor designation indicator columns.k_student_disabilityis built fromtenant_code,school_year,k_student,k_lea,k_school,k_program,program_enroll_begin_date, anddisability_type.accordion_columns, allowing stadium implementations to extend them throughxwalk_disability_designationswithout modifying this model.fct_student_disability.yml:k_program/k_student_programfor ed org rows), and a join example. Noenabledgate is set at the fact level since the build models already handle conditional sourcing, and ed org disabilities do not depend onsrc:program:special_ed:enabled.Changes to existing files:
_edfi_3__students.yml: Added docs forbld_ef3__student__disabilitiesandbld_ef3__student__wide_disability_designationswithtags: ['special_ed']. Neither carries anenabledgate since the build models handle conditional sourcing internally.Changes applied in review:
ed_org_idfrom all models. It is fully recoverable fromk_leaandk_school, which are already included, consistent with the approach taken in PR#249.k_student_programtobld_ef3__student__disabilitiesandfct_student_disability.is_program(k_program is not null) tobld_ef3__student__disabilities.disability_typeto thek_student_disabilitysurrogate key. The original key was built from(tenant_code, school_year, k_student, k_lea, k_school, k_program, ed_org_id, program_enroll_begin_date), which would produce duplicate surrogate keys for students with multiple disabilities under the same program enrollment.fct_student_disabilityto use full CTE names rather than short aliases (sd,stu), matching the repo convention.k_student_disabilitysurrogate key generation intobld_ef3__student__disabilitiesso it flows throughbld_ef3__student__wide_disability_designations. The original join infct_student_disabilityneeded a six-condition null-safe match acrossk_student,k_lea,k_school,k_program,tenant_code,school_year, anddisability_type; it now joins onk_student_disabilityalone.join-->inner join, missing space in--Ed Org Disabilities.Tests and QC done:
dbt compileclean against localedu_edfi_sourcedevelopment branchdbt run --select +fct_student_disability+passes