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

1859 dbtpowerschool refactor base powerschool student enrollments for pure powerschool tables #2193

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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 src/dbt/kippcamden/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ vars:
pearson_schema: kippcamden_pearson
powerschool_schema: kippcamden_powerschool
titan_schema: kippcamden_titan
state_reporting_version: NJ

# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models
Expand Down
1 change: 1 addition & 0 deletions src/dbt/kippmiami/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ vars:
iready_schema: kippmiami_iready
powerschool_schema: kippmiami_powerschool
renlearn_schema: kippmiami_renlearn
state_reporting_version: FL

# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models
Expand Down
1 change: 1 addition & 0 deletions src/dbt/kippnewark/dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ vars:
overgrad_schema: kippnewark_overgrad
renlearn_schema: kippnj_renlearn
titan_schema: kippnewark_titan
state_reporting_version: NJ

# Configuring models
# Full documentation: https://docs.getdbt.com/docs/configuring-models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ with
) as is_advanced_math_student,
from {{ ref("base_powerschool__course_enrollments") }} as ce
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on ce.cc_studentid = co.studentid
and ce.cc_academic_year = co.academic_year
and {{ union_dataset_join_clause(left_alias="ce", right_alias="co") }}
Expand Down Expand Up @@ -55,7 +55,7 @@ with
co.grade_level + 1 as illuminate_grade_level_id,

false as is_advanced_math,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
where co.region in ('Newark', 'Camden') and co.grade_level <= 4
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ with
),
4
) as fldoe_percentile_rank,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("stg_fldoe__fast") }} as pp
on co.fleid = pp.student_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ with
if(gpa.gpa_term >= 3.5, 'Quarter GPA 3.5+', null) as is_quarter_gpa_35plus,

if(att.ada < 0.9, 'Chronic Absence', null) as is_chronic_absentee,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
left join
{{ ref("int_powerschool__gpa_term") }} as gpa
on co.studentid = gpa.studentid
Expand All @@ -29,7 +29,7 @@ with
)

select co.student_number, co.academic_year, sp.specprog_name as designation_name,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("int_powerschool__spenrollments") }} as sp
on co.studentid = sp.studentid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ with
lu.lesson_source,
lu.lesson_id,
lu.passed_or_not_passed_numeric,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
cross join unnest(['Reading', 'Math']) as `subject`
inner join
{{ ref("int_powerschool__calendar_week") }} as w
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ select
end as performance_level,
from {{ ref("int_assessments__response_rollup") }} as ar
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on ar.academic_year = co.academic_year
and ar.powerschool_student_number = co.student_number
and co.rn_year = 1
Expand Down Expand Up @@ -84,7 +84,7 @@ inner join
{{ ref("stg_assessments__standard_domains") }} as sd
on ar.response_type_code = sd.standard_code
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on ar.academic_year = co.academic_year
and ar.powerschool_student_number = co.student_number
and co.rn_year = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ select
) as dibels_composite_recent,
coalesce(p.iready_reading_recent, '(No Data)') as iready_reading_recent,
coalesce(p.iready_math_recent, '(No Data)') as iready_math_recent,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
cross join unnest(['Q1', 'Q2', 'Q3', 'Q4']) as term
left join
{{ ref("int_powerschool__gpa_cumulative") }} as cum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ with
when 'Well Below Benchmark'
then 'Not Met'
end as composite_expectations,
from {{ ref("base_powerschool__student_enrollments") }} as s
from {{ ref("int_powerschool__student_enrollments") }} as s
inner join
{{ ref("int_amplify__all_assessments") }} as c
on s.academic_year = c.mclass_academic_year
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ select

sg.cumulative_y1_gpa as `GPA_Y1_weighted`,
sg.cumulative_y1_gpa_unweighted as `GPA_Y1_unweighted`,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("int_powerschool__gpa_cumulative") }} as sg
on co.studentid = sg.studentid
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
with
students as (
select
se.first_name as `givenName`,
se.last_name as `familyName`,
se.student_email_google as `primaryEmail`,
se.school_name,
se.is_out_of_district,
first_name as `givenName`,
last_name as `familyName`,
student_email_google as `primaryEmail`,
school_name,
is_out_of_district,

concat(
'group-students-', lower(se.region), '@teamstudents.org'
) as `groupKey`,
concat('group-students-', lower(region), '@teamstudents.org') as `groupKey`,

to_hex(sha1(se.student_web_password)) as `password`,
to_hex(sha1(student_web_password)) as `password`,

if(se.grade_level >= 3, true, false) as `changePasswordAtNextLogin`,
if(se.enroll_status = 0, false, true) as `suspended`,
from {{ ref("base_powerschool__student_enrollments") }} as se
where se.rn_all = 1 and se.student_email_google is not null
if(grade_level >= 3, true, false) as `changePasswordAtNextLogin`,
if(enroll_status = 0, false, true) as `suspended`,
from {{ ref("base_powerschool__student_enrollments") }}
where rn_all = 1 and student_email_google is not null
),

with_google as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ select
|| p.preferred_name_family_name as class_name,
from {{ ref("base_powerschool__course_enrollments") }} as cc
inner join
{{ ref("base_powerschool__student_enrollments") }} as s
{{ ref("int_powerschool__student_enrollments") }} as s
on cc.students_student_number = s.student_number
and cc.cc_academic_year = s.academic_year
and s.rn_year = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ select
gpa.cumulative_y1_gpa_unweighted as gpa,

round(ada.ada, 2) as previous_year_ada,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
left join
fast_pivot as fp
on co.fleid = fp.fleid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ with
b.notes,

cast(left(b.behavior, length(b.behavior) - 5) as int) as cs_hours,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
left join
{{ ref("stg_deanslist__behavior") }} as b
on (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ select
f.iready_proficiency_eoy as iready_eoy_previous_year,
from {{ ref("int_reporting__student_filters") }} as f
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on f.student_number = co.student_number
and f.academic_year = co.academic_year
and co.rn_year = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ select
from {{ ref("int_kippadb__roster") }} as r
left join {{ ref("int_kippadb__enrollment_pivot") }} as e on r.contact_id = e.student
left join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on r.student_number = co.student_number
and co.rn_undergrad = 1
and co.grade_level != 99
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ with
round(avg(ada.ada), 2) as criteria,
from {{ ref("int_powerschool__ada") }} as ada
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on ada.studentid = co.studentid
and ada.yearid = co.yearid
and co.region = 'Miami'
Expand All @@ -131,7 +131,7 @@ with
round(avg(ada.ada), 2) as criteria,
from {{ ref("int_powerschool__ada") }} as ada
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on ada.studentid = co.studentid
and ada.yearid = co.yearid
and co.region = 'Miami'
Expand All @@ -148,7 +148,7 @@ with
round(avg(ada.ada), 2) as criteria,
from {{ ref("int_powerschool__ada") }} as ada
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on ada.studentid = co.studentid
and ada.yearid = co.yearid
and co.region = 'Miami'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ select
co.contact_2_phone_work
) as contact_2_phone,
concat(co.academic_year, '-', co.academic_year + 1) as last_kipp_academic_year,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
left join {{ ref("int_kippadb__roster") }} as r on co.student_number = r.student_number
left join {{ ref("int_kippadb__enrollment_pivot") }} as ei on r.contact_id = ei.student
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ select
null as `15 Session Type ID`,
null as `16 Enrollment Entry Code`,
-- trunk-ignore-end(sqlfluff/RF05)
from {{ ref("base_powerschool__student_enrollments") }}
from {{ ref("int_powerschool__student_enrollments") }}
where academic_year = {{ var("current_academic_year") }} and grade_level != 99
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ select

null as `15 Session Type ID`,
-- trunk-ignore-end(sqlfluff/RF05)
from {{ ref("base_powerschool__student_enrollments") }} as s
from {{ ref("int_powerschool__student_enrollments") }} as s
inner join
{{ ref("base_powerschool__course_enrollments") }} as enr
on s.studentid = enr.cc_studentid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ with
then true
else false
end as is_bucket2_eligible,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
cross join subject_croswalk as s
inner join grade_bands as gb on co.grade_level = gb.grade_level
inner join
Expand Down Expand Up @@ -293,7 +293,7 @@ with

if(ir.scale_score is not null, 1, 0) as is_tested_int,
if(ir.is_approaching_int = 1, true, false) as is_bucket2_eligible,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
cross join subject_croswalk as s
inner join grade_bands as gb on co.grade_level = gb.grade_level
inner join
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ select
if(
sp.exit_date < current_date('{{ var("local_timezone") }}'), 'Expired', 'Current'
) as hi_status,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("int_powerschool__spenrollments") }} as sp
on co.studentid = sp.studentid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ with
if(
co.grade_level >= 9, enr.courses_credittype, asr.subject_area
) as filter_join,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("int_assessments__response_rollup") }} as asr
on co.student_number = asr.powerschool_student_number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ select
null as is_replacement,
from {{ ref("int_assessments__scaffold") }} as s
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on s.powerschool_student_number = co.student_number
and s.academic_year = co.academic_year
and co.rn_year = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ with

abs_count as (
select co.student_number, co.academic_year, count(att.att_date) as n_absences,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("stg_powerschool__attendance") }} as att
on co.studentid = att.studentid
Expand Down Expand Up @@ -61,7 +61,7 @@ select
null as followup_close_notes,
null as followup_outstanding,
null as homeroom,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
abs_count as ac
on ac.student_number = co.student_number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ select
row_number() over (
partition by co.studentid, att.att_date order by cl.commlog_datetime desc
) as rn_date,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("stg_powerschool__attendance") }} as att
on co.studentid = att.studentid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ with
row_number() over (
partition by student_number order by exitdate desc
) as rn,
from {{ ref("base_powerschool__student_enrollments") }}
from {{ ref("int_powerschool__student_enrollments") }}
where school_level = 'MS'
),

Expand Down Expand Up @@ -76,7 +76,7 @@ with
if(sa.studentid is not null, 1, 0) as is_studentathlete,
from {{ ref("int_powerschool__ps_adaadm_daily_ctod") }} as mem
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on mem.studentid = co.studentid
and mem.schoolid = co.schoolid
and mem.calendardate between co.entrydate and co.exitdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ select
row_number() over (
partition by co.academic_year, co.student_number, cr.commlog_reason
) as rn_commlog_reason,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
cross join commlog_reason as cr
left join
{{ ref("int_powerschool__ada") }} as ada
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ select

concat(dli.create_last, ', ', dli.create_first) as created_staff,
concat(dli.update_last, ', ', dli.update_first) as last_update_staff,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
left join
{{ ref("stg_deanslist__incidents") }} as dli
on co.student_number = dli.student_school_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ with
case
when r.is_mastery then 1 when not r.is_mastery then 0
end as is_mastery_int,
from {{ ref("base_powerschool__student_enrollments") }} as co
from {{ ref("int_powerschool__student_enrollments") }} as co
inner join
{{ ref("int_powerschool__calendar_week") }} as w
on co.academic_year = w.academic_year
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ select
gc.potential_credits_cum,
gc.core_cumulative_y1_gpa,
gc.cumulative_y1_gpa_projected_s1_unweighted,
from {{ ref("base_powerschool__student_enrollments") }} as sr
from {{ ref("int_powerschool__student_enrollments") }} as sr
left join
{{ ref("stg_kippadb__contact") }} as ktc
on sr.student_number = ktc.school_specific_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ select
s.ismissing,
from {{ ref("base_powerschool__course_enrollments") }} as enr
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on enr.cc_studentid = co.studentid
and enr.cc_yearid = co.yearid
and {{ union_dataset_join_clause(left_alias="enr", right_alias="co") }}
Expand Down Expand Up @@ -104,7 +104,7 @@ select
s.ismissing,
from {{ ref("base_powerschool__course_enrollments") }} as enr
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
{{ ref("int_powerschool__student_enrollments") }} as co
on enr.cc_studentid = co.studentid
and enr.cc_yearid = co.yearid
and {{ union_dataset_join_clause(left_alias="enr", right_alias="co") }}
Expand Down
Loading
Loading