Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cohort year in dim_student #141

Merged
merged 5 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased
## New features
- Add array column `cohort_year_array` to `dim_student`, tracking student cohort designation, and add upstream `bld_ef3__student_cohort_years`
- Add support for custom indicators on `dim_course_section`, and companion audit table for testing uniqueness of custom data sources
- Add `section_type` descriptor column to `dim_section` (Ed-Fi Data Standard v5.0 addition)
- Add `preferred_first_name`, `preferred_last_name`, and `gender_identity` columns to `dim_staff` (Ed-Fi Data Standard v5.0 additions)
Expand Down
15 changes: 15 additions & 0 deletions models/build/edfi_3/students/bld_ef3__student_cohort_years.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
with student_cohort_years as (
select * from {{ ref('stg_ef3__stu_ed_org__cohort_years') }}
),
build_object as (
select
tenant_code,
api_year,
k_student,
array_agg(object_construct('cohort_year_type', cohort_year_type,
'school_year', school_year,
'academic_term', academic_term)) as cohort_year_array
from student_cohort_years
group by 1,2,3
)
select * from build_object
6 changes: 6 additions & 0 deletions models/core_warehouse/dim_student.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ stu_programs as (
stu_grade as (
select * from {{ ref('bld_ef3__stu_grade_level') }}
),
stu_cohort_year as (
select * from {{ ref('bld_ef3__student_cohort_years')}}
),

-- student programs
{% if var('src:program:special_ed:enabled', True) %}
Expand Down Expand Up @@ -189,6 +192,7 @@ formatted as (
stg_student.api_year = max(stg_student.api_year) over(partition by stg_student.k_student_xyear) as is_latest_record,

stu_immutable_demos.race_array,
stu_cohort_year.cohort_year_array,
stu_immutable_demos.safe_display_name

from stg_student
Expand All @@ -213,6 +217,8 @@ formatted as (
left join stu_grade
on stu_demos.k_student = stu_grade.k_student
and stg_student.api_year = stu_grade.school_year
left join stu_cohort_year
on stu_demos.k_student = stu_cohort_year.k_student

-- student programs
{% if var('src:program:special_ed:enabled', True) %}
Expand Down
2 changes: 2 additions & 0 deletions models/core_warehouse/dim_student.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ models:
description: Denotes the most recent record of a student's demographic values by school year.
- name: race_array
description: A list of the student's races.
- name: cohort_year_array
description: An array of all cohort information associated with the student.
- name: safe_display_name
description: Display name with student ID, safe for use in grouping operations in a BI tool, to avoid combining students with the same name.
- name: has_hispanic_latino_ethnicity
Expand Down