diff --git a/src/dbt/kippcamden/dbt_project.yml b/src/dbt/kippcamden/dbt_project.yml index 014dcb7015..3b5eb50035 100644 --- a/src/dbt/kippcamden/dbt_project.yml +++ b/src/dbt/kippcamden/dbt_project.yml @@ -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 diff --git a/src/dbt/kippmiami/dbt_project.yml b/src/dbt/kippmiami/dbt_project.yml index 6d1e1656a9..ed54633452 100644 --- a/src/dbt/kippmiami/dbt_project.yml +++ b/src/dbt/kippmiami/dbt_project.yml @@ -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 diff --git a/src/dbt/kippnewark/dbt_project.yml b/src/dbt/kippnewark/dbt_project.yml index 9a9c876607..e47347fab0 100644 --- a/src/dbt/kippnewark/dbt_project.yml +++ b/src/dbt/kippnewark/dbt_project.yml @@ -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 diff --git a/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__course_enrollments.sql b/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__course_enrollments.sql index 16d1fa62c5..f4b64c33b4 100644 --- a/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__course_enrollments.sql +++ b/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__course_enrollments.sql @@ -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") }} @@ -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 ) diff --git a/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__fast_previous_year.sql b/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__fast_previous_year.sql index 98eb70dcb8..cc97d079bd 100644 --- a/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__fast_previous_year.sql +++ b/src/dbt/kipptaf/models/assessments/intermediate/int_assessments__fast_previous_year.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__designations.sql b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__designations.sql index 241983231d..536f7b4d50 100644 --- a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__designations.sql +++ b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__designations.sql @@ -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 @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__iready_lessons.sql b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__iready_lessons.sql index 850d46135f..c0fdc6cb06 100644 --- a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__iready_lessons.sql +++ b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__iready_lessons.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__mod_standards_domains.sql b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__mod_standards_domains.sql index 8a775803e2..895e7606ef 100644 --- a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__mod_standards_domains.sql +++ b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__mod_standards_domains.sql @@ -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 @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__promo_status.sql b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__promo_status.sql index dfce17f904..e9404898bf 100644 --- a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__promo_status.sql +++ b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__promo_status.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__reading_levels.sql b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__reading_levels.sql index 1e76dbd3bf..b19a6db501 100644 --- a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__reading_levels.sql +++ b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__reading_levels.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__transcript_gpas.sql b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__transcript_gpas.sql index 9ad7142084..139d4ed601 100644 --- a/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__transcript_gpas.sql +++ b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__transcript_gpas.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/google/directory/rpt_google_directory__users_import.sql b/src/dbt/kipptaf/models/extracts/google/directory/rpt_google_directory__users_import.sql index ff07c86e40..8ab5f78f5d 100644 --- a/src/dbt/kipptaf/models/extracts/google/directory/rpt_google_directory__users_import.sql +++ b/src/dbt/kipptaf/models/extracts/google/directory/rpt_google_directory__users_import.sql @@ -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 ( diff --git a/src/dbt/kipptaf/models/extracts/google/sheets/int_gsheets__dds_import.sql b/src/dbt/kipptaf/models/extracts/google/sheets/int_gsheets__dds_import.sql index c6bcde2a27..9300cf3ebb 100644 --- a/src/dbt/kipptaf/models/extracts/google/sheets/int_gsheets__dds_import.sql +++ b/src/dbt/kipptaf/models/extracts/google/sheets/int_gsheets__dds_import.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_ghseets__kippfwd_miami_roster.sql b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_ghseets__kippfwd_miami_roster.sql index e2ad6aaa4c..bedb5b9324 100644 --- a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_ghseets__kippfwd_miami_roster.sql +++ b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_ghseets__kippfwd_miami_roster.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__community_service_upload.sql b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__community_service_upload.sql index 79717da23b..819816b955 100644 --- a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__community_service_upload.sql +++ b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__community_service_upload.sql @@ -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 ( diff --git a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__ddi_tier_roster.sql b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__ddi_tier_roster.sql index c1825286dd..c27ac5e322 100644 --- a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__ddi_tier_roster.sql +++ b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__ddi_tier_roster.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kfwd_taf_contact_feed.sql b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kfwd_taf_contact_feed.sql index e993e5483f..faad5e5bf2 100644 --- a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kfwd_taf_contact_feed.sql +++ b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kfwd_taf_contact_feed.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kippmiami_payout_roster.sql b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kippmiami_payout_roster.sql index 2581c91053..e7d59540de 100644 --- a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kippmiami_payout_roster.sql +++ b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__kippmiami_payout_roster.sql @@ -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' @@ -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' @@ -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' diff --git a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__njsmart_transfer_unverified.sql b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__njsmart_transfer_unverified.sql index 35ba8d7247..f47de74ca2 100644 --- a/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__njsmart_transfer_unverified.sql +++ b/src/dbt/kipptaf/models/extracts/google/sheets/rpt_gsheets__njsmart_transfer_unverified.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__enrollment.sql b/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__enrollment.sql index 7eff2b4c06..3be4202a9f 100644 --- a/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__enrollment.sql +++ b/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__enrollment.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__roster.sql b/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__roster.sql index 64d5f47a5d..61fedccc5c 100644 --- a/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__roster.sql +++ b/src/dbt/kipptaf/models/extracts/illuminate/rpt_illuminate__roster.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__academic_goals_rollup.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__academic_goals_rollup.sql index 397ed8c96f..d4c7d5ae1d 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__academic_goals_rollup.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__academic_goals_rollup.sql @@ -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 @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__approved_home_instruction.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__approved_home_instruction.sql index 98e09b9d09..4683b7b93b 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__approved_home_instruction.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__approved_home_instruction.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_dashboard.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_dashboard.sql index 6ca2ca8bc0..0736a47e03 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_dashboard.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_dashboard.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_entry_audit.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_entry_audit.sql index 6df37d317b..94c84230a7 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_entry_audit.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__assessment_entry_audit.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_chronic_absenteeism_log.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_chronic_absenteeism_log.sql index 4f893772ef..9830c8c642 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_chronic_absenteeism_log.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_chronic_absenteeism_log.sql @@ -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 @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_comm_log.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_comm_log.sql index 921a18da90..20518465ff 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_comm_log.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_comm_log.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_dashboard.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_dashboard.sql index 637caad60d..64d3d35e60 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_dashboard.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_dashboard.sql @@ -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' ), @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_interventions.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_interventions.sql index dcadd46714..cf4e78df52 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_interventions.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__attendance_interventions.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__consequence_dashboard.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__consequence_dashboard.sql index 39c35171ef..beb2782c7d 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__consequence_dashboard.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__consequence_dashboard.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__ddi_dashboard.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__ddi_dashboard.sql index 1ae1a361c8..430f269160 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__ddi_dashboard.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__ddi_dashboard.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gpa_analysis.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gpa_analysis.sql index e74c846580..d8e1e66873 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gpa_analysis.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gpa_analysis.sql @@ -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_assignments.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_assignments.sql index 3d883e3d29..31c63bb6dc 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_assignments.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_assignments.sql @@ -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") }} @@ -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") }} diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_dashboard.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_dashboard.sql index 8238e131cd..e4a7c9410e 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_dashboard.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_dashboard.sql @@ -23,7 +23,7 @@ with case when sp.studentid is not null then 1 end as is_counselingservices, case when sa.studentid is not null then 1 end as is_studentathlete, - from {{ ref("base_powerschool__student_enrollments") }} as co + from {{ ref("int_powerschool__student_enrollments") }} as co left join {{ ref("int_powerschool__spenrollments") }} as sp on co.studentid = sp.studentid diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__home_instruction_queue.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__home_instruction_queue.sql index 0e958e6519..e624f305fe 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__home_instruction_queue.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__home_instruction_queue.sql @@ -48,7 +48,7 @@ left join on cast(u.dl_user_id as string) = cf.approver_name and {{ union_dataset_join_clause(left_alias="u", right_alias="cf") }} inner join - {{ ref("base_powerschool__student_enrollments") }} as co + {{ ref("int_powerschool__student_enrollments") }} as co on dli.student_school_id = co.student_number and dli.create_ts_academic_year = co.academic_year and {{ union_dataset_join_clause(left_alias="dli", right_alias="co") }} diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__kfwd_dashboard.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__kfwd_dashboard.sql index d6f097f3e2..9645924afc 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__kfwd_dashboard.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__kfwd_dashboard.sql @@ -414,7 +414,7 @@ with false ) ) as is_es_grad, - from {{ ref("base_powerschool__student_enrollments") }} + from {{ ref("int_powerschool__student_enrollments") }} where rn_year = 1 group by student_number ), diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_iready.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_iready.sql index d856f63668..424f6d4d19 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_iready.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_iready.sql @@ -42,7 +42,7 @@ select regexp_replace( left(up.domain_name, length(up.domain_name) - 19), '_', ' ' ) as domain_name, -from {{ ref("base_powerschool__student_enrollments") }} as co +from {{ ref("int_powerschool__student_enrollments") }} as co cross join subjects as subj cross join unnest(['BOY', 'MOY', 'EOY']) as ar left join diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_star.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_star.sql index 089ca2b2d8..a0b0440386 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_star.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__miami_k2_star.sql @@ -124,7 +124,7 @@ select s.standard_percent_mastery, s.star_subject, s.rn_subject_round_star, -from {{ ref("base_powerschool__student_enrollments") }} as co +from {{ ref("int_powerschool__student_enrollments") }} as co cross join subjects as subj cross join unnest(['BOY', 'MOY', 'EOY']) as administration_round left join diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__next_year_status.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__next_year_status.sql index 4f5688d990..de3da1f9ef 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__next_year_status.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__next_year_status.sql @@ -34,5 +34,5 @@ select replace( concat(co.street, '+', co.city, '+', co.state, '+', co.zip), ' ', '+' ) as gmaps_address, -from {{ ref("base_powerschool__student_enrollments") }} as co +from {{ ref("int_powerschool__student_enrollments") }} as co where co.rn_undergrad = 1 and co.enroll_status in (0, -1) diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__nj_school_register.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__nj_school_register.sql index 353738bb2a..dce13aa6fa 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__nj_school_register.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__nj_school_register.sql @@ -44,7 +44,7 @@ select if(co.lep_status, 1, 0) as lep_status, if(co.is_self_contained, 1, 0) as is_pathways, -from {{ ref("base_powerschool__student_enrollments") }} as co +from {{ ref("int_powerschool__student_enrollments") }} as co left join {{ ref("int_powerschool__calendar_rollup") }} as d on co.schoolid = d.schoolid diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_behavior.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_behavior.sql index d1fd1d92ed..5a7ff93f21 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_behavior.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_behavior.sql @@ -173,7 +173,7 @@ select count(distinct co.student_number) over ( partition by co.schoolid, cw.week_start_monday ) as school_enrollment_by_week, -from {{ ref("base_powerschool__student_enrollments") }} as co +from {{ ref("int_powerschool__student_enrollments") }} as co inner join {{ ref("int_powerschool__calendar_week") }} as cw on co.schoolid = cw.schoolid diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_referrals.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_referrals.sql index 3eae3cac73..d876bf5b34 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_referrals.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__okrts_referrals.sql @@ -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' ), @@ -194,7 +194,7 @@ select order by dlp.is_suspension desc ) ) as rn_incident, -from {{ ref("base_powerschool__student_enrollments") }} as co +from {{ ref("int_powerschool__student_enrollments") }} as co left join {{ ref("base_powerschool__course_enrollments") }} as hr on co.studentid = hr.cc_studentid diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__power_standards.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__power_standards.sql index da6b01495f..548dd2e80e 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__power_standards.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__power_standards.sql @@ -51,7 +51,7 @@ with when asr.performance_band_label_number > 3 then 3 end as growth_band, - 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 @@ -129,7 +129,7 @@ with when asr.performance_band_label_number > 2 then 3 end as growth_band, - 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 @@ -206,7 +206,7 @@ with when asr.performance_band_label_number > 3 then 3 end as growth_band, - 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 @@ -283,7 +283,7 @@ with when asr.performance_band_label_number > 2 then 3 end as growth_band, - 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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__promo_status.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__promo_status.sql index 82523f049b..c1a0c15c72 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__promo_status.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__promo_status.sql @@ -37,7 +37,7 @@ select ps.overall_status as promo_status_overall, if(co.spedlep like 'SPED%', 'Has IEP', co.spedlep) as iep_status, -from {{ ref("base_powerschool__student_enrollments") }} as co +from {{ ref("int_powerschool__student_enrollments") }} as co inner join {{ ref("stg_reporting__terms") }} as rt on co.academic_year = rt.academic_year diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__qbl.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__qbl.sql index d0e8289c35..2a238d5529 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__qbl.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__qbl.sql @@ -75,7 +75,7 @@ select order by asr.administered_at desc ) end as rn_test_subject_term, -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 @@ -187,7 +187,7 @@ select order by asr.administered_at desc ) end as rn_test_subject_term, -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__school_culture_dashboard_nj.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__school_culture_dashboard_nj.sql index a27dd11bd6..ced8b0fe7b 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__school_culture_dashboard_nj.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__school_culture_dashboard_nj.sql @@ -81,7 +81,7 @@ select ) ) ) as week_of, -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 diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_attrition_over_time.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_attrition_over_time.sql index 7452f3149c..69d81d843e 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_attrition_over_time.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_attrition_over_time.sql @@ -44,13 +44,13 @@ select then 1.0 else 0.0 end as is_attrition, -from {{ ref("base_powerschool__student_enrollments") }} as y1 +from {{ ref("int_powerschool__student_enrollments") }} as y1 inner join {{ ref("stg_powerschool__students") }} as s on y1.student_number = s.student_number and {{ union_dataset_join_clause(left_alias="y1", right_alias="s") }} left join - {{ ref("base_powerschool__student_enrollments") }} as y2 + {{ ref("int_powerschool__student_enrollments") }} as y2 on y1.student_number = y2.student_number and y1.academic_year = (y2.academic_year - 1) and date(y2.academic_year, 10, 1) between y2.entrydate and y2.exitdate diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_info_audit.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_info_audit.sql index dda425d087..4a850c5d56 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_info_audit.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__student_info_audit.sql @@ -88,7 +88,7 @@ with then 1 else 0 end as race_eth_flag, - from {{ ref("base_powerschool__student_enrollments") }} as se + from {{ ref("int_powerschool__student_enrollments") }} as se left join {{ ref("stg_powerschool__fte") }} as fte on se.schoolid = fte.schoolid diff --git a/src/dbt/kipptaf/models/powerschool/base/base_powerschool__student_enrollments.sql b/src/dbt/kipptaf/models/powerschool/base/base_powerschool__student_enrollments.sql index 41c0bbbeb8..3a2b6ccd44 100644 --- a/src/dbt/kipptaf/models/powerschool/base/base_powerschool__student_enrollments.sql +++ b/src/dbt/kipptaf/models/powerschool/base/base_powerschool__student_enrollments.sql @@ -1,270 +1,21 @@ -with - student_enrollments_union as ( - {{ - dbt_utils.union_relations( - relations=[ - source("kippnewark_powerschool", model.name), - source("kippcamden_powerschool", model.name), - source("kippmiami_powerschool", model.name), - ] - ) - }} - ), - - all_regions as ( - select - seu.*, - - suf.fleid, - suf.newark_enrollment_number, - suf.infosnap_id, - suf.infosnap_opt_in, - suf.media_release, - suf.rides_staff, - - nj.districtcoderesident, - nj.referral_date, - nj.parental_consent_eval_date, - nj.eligibility_determ_date, - nj.initial_iep_meeting_date, - nj.parent_consent_intial_iep_date, - nj.annual_iep_review_meeting_date, - nj.reevaluation_date, - nj.parent_consent_obtain_code, - nj.initial_process_delay_reason, - nj.special_education_placement, - nj.time_in_regular_program, - nj.early_intervention_yn, - nj.determined_ineligible_yn, - nj.counseling_services_yn, - nj.occupational_therapy_serv_yn, - nj.physical_therapy_services_yn, - nj.speech_lang_theapy_services_yn, - nj.other_related_services_yn, - nj.lepbegindate, - nj.lependdate, - nj.gifted_and_talented, - - sr.mail as advisor_email, - sr.communication_business_mobile as advisor_phone, - - sl.username as student_web_id, - sl.default_password as student_web_password, - sl.google_email as student_email_google, - - regexp_extract(seu._dbt_source_relation, r'(kipp\w+)_') as code_location, - initcap(regexp_extract(seu._dbt_source_relation, r'kipp(\w+)_')) as region, +select + ar.* except (spedlep, lunch_status), - coalesce(suf.is_504, false) as is_504, - from student_enrollments_union as seu - left join - {{ ref("stg_powerschool__u_studentsuserfields") }} as suf - on seu.students_dcid = suf.studentsdcid - and {{ union_dataset_join_clause(left_alias="seu", right_alias="suf") }} - left join - {{ ref("stg_powerschool__s_nj_stu_x") }} as nj - on seu.students_dcid = nj.studentsdcid - and {{ union_dataset_join_clause(left_alias="seu", right_alias="nj") }} - left join - {{ ref("base_people__staff_roster") }} as sr - on seu.advisor_teachernumber = sr.powerschool_teacher_number - left join - {{ ref("stg_people__student_logins") }} as sl - on seu.student_number = sl.student_number - ) + sr.mail as advisor_email, + sr.communication_business_mobile as advisor_phone, -select - ar._dbt_source_relation, - ar.studentid, - ar.students_dcid, - ar.student_number, - ar.state_studentnumber, - ar.fleid, - ar.newark_enrollment_number, - ar.infosnap_id, - ar.lastfirst, - ar.first_name, - ar.middle_name, - ar.last_name, - ar.yearid, - ar.academic_year, - ar.grade_level, - ar.grade_level_prev, - ar.schoolid, - ar.school_name, - ar.school_abbreviation, - ar.reporting_schoolid, - ar.reporting_school_name, - ar.school_level, - ar.region, - ar.code_location, - ar.advisory_name, - ar.advisor_teachernumber, - ar.advisor_lastfirst, - ar.advisor_email, - ar.advisor_phone, - ar.student_web_id, - ar.student_web_password, - ar.student_email_google, - ar.entrydate, - ar.exitdate, - ar.entrycode, - ar.exitcode, - ar.exit_code_kf, - ar.exit_code_ts, - ar.exitcomment, - ar.enroll_status, - ar.cohort, - ar.dob, - ar.gender, - ar.ethnicity, - ar.fedethnicity, - ar.next_school, - ar.sched_nextyeargrade, - ar.boy_status, - ar.track, - ar.fteid, - ar.is_self_contained, - ar.is_out_of_district, - ar.is_homeless, - ar.is_retained_year, - ar.is_retained_ever, - ar.rn_year, - ar.rn_school, - ar.rn_all, - ar.rn_undergrad, - ar.year_in_school, - ar.year_in_network, - ar.entry_schoolid, - ar.entry_grade_level, - ar.highest_grade_level_achieved, - ar.street, - ar.city, - ar.state, - ar.zip, - ar.home_phone, - ar.is_enrolled_y1, - ar.is_enrolled_oct01, - ar.is_enrolled_oct15, - ar.is_enrolled_recent, - ar.infosnap_opt_in, - ar.media_release, - ar.rides_staff, - ar.districtcoderesident, - ar.contact_1_address_home, - ar.contact_1_email_current, - ar.contact_1_name, - ar.contact_1_phone_daytime, - ar.contact_1_phone_home, - ar.contact_1_phone_mobile, - ar.contact_1_phone_primary, - ar.contact_1_phone_work, - ar.contact_1_relationship, - ar.contact_2_address_home, - ar.contact_2_email_current, - ar.contact_2_name, - ar.contact_2_phone_daytime, - ar.contact_2_phone_home, - ar.contact_2_phone_mobile, - ar.contact_2_phone_primary, - ar.contact_2_phone_work, - ar.contact_2_relationship, - ar.emergency_1_address_home, - ar.emergency_1_email_current, - ar.emergency_1_name, - ar.emergency_1_phone_daytime, - ar.emergency_1_phone_home, - ar.emergency_1_phone_mobile, - ar.emergency_1_phone_primary, - ar.emergency_1_phone_work, - ar.emergency_1_relationship, - ar.emergency_2_address_home, - ar.emergency_2_email_current, - ar.emergency_2_name, - ar.emergency_2_phone_daytime, - ar.emergency_2_phone_home, - ar.emergency_2_phone_mobile, - ar.emergency_2_phone_primary, - ar.emergency_2_phone_work, - ar.emergency_2_relationship, - ar.emergency_3_address_home, - ar.emergency_3_email_current, - ar.emergency_3_name, - ar.emergency_3_phone_daytime, - ar.emergency_3_phone_home, - ar.emergency_3_phone_mobile, - ar.emergency_3_phone_primary, - ar.emergency_3_phone_work, - ar.emergency_3_relationship, - ar.pickup_1_address_home, - ar.pickup_1_email_current, - ar.pickup_1_name, - ar.pickup_1_phone_daytime, - ar.pickup_1_phone_home, - ar.pickup_1_phone_mobile, - ar.pickup_1_phone_primary, - ar.pickup_1_phone_work, - ar.pickup_1_relationship, - ar.pickup_2_address_home, - ar.pickup_2_email_current, - ar.pickup_2_name, - ar.pickup_2_phone_daytime, - ar.pickup_2_phone_home, - ar.pickup_2_phone_mobile, - ar.pickup_2_phone_primary, - ar.pickup_2_phone_work, - ar.pickup_2_relationship, - ar.pickup_3_address_home, - ar.pickup_3_email_current, - ar.pickup_3_name, - ar.pickup_3_phone_daytime, - ar.pickup_3_phone_home, - ar.pickup_3_phone_mobile, - ar.pickup_3_phone_primary, - ar.pickup_3_phone_work, - ar.pickup_3_relationship, - ar.is_504, - ar.referral_date, - ar.parental_consent_eval_date, - ar.eligibility_determ_date, - ar.initial_iep_meeting_date, - ar.parent_consent_intial_iep_date, - ar.annual_iep_review_meeting_date, - ar.reevaluation_date, - ar.parent_consent_obtain_code, - ar.initial_process_delay_reason, - ar.special_education_placement, - ar.time_in_regular_program, - ar.early_intervention_yn, - ar.determined_ineligible_yn, - ar.counseling_services_yn, - ar.occupational_therapy_serv_yn, - ar.physical_therapy_services_yn, - ar.speech_lang_theapy_services_yn, - ar.other_related_services_yn, - ar.lepbegindate, - ar.lependdate, - ar.gifted_and_talented, + sl.username as student_web_id, + sl.default_password as student_web_password, + sl.google_email as student_email_google, - {# regional differences #} - case - when ar.region = 'Miami' - then ar.lep_status - when ar.lepbegindate is null - then false - when ar.lependdate < ar.entrydate - then false - when ar.lepbegindate <= ar.exitdate - then true - else false - end as lep_status, + tpd.total_balance as lunch_balance, + /* regional differences */ if( ar.region = 'Miami', ar.spedlep, sped.special_education_code ) as special_education_code, - coalesce(if(ar.region = 'Miami', ar.spedlep, sped.spedlep), 'No IEP') as spedlep, - tpd.total_balance as lunch_balance, + coalesce(if(ar.region = 'Miami', ar.spedlep, sped.spedlep), 'No IEP') as spedlep, case when ar.academic_year < {{ var("current_academic_year") }} @@ -274,6 +25,7 @@ select when ar.rn_year = 1 then coalesce(if(tpd.is_directly_certified, 'F', null), tpd.eligibility_name) end as lunch_status, + case when ar.academic_year < {{ var("current_academic_year") }} then ar.lunch_status @@ -289,7 +41,13 @@ select else tpd.eligibility || ' - ' || tpd.eligibility_determination_reason end end as lunch_application_status, -from all_regions as ar +from {{ ref("int_powerschool__student_enrollments") }} as ar +left join + {{ ref("base_people__staff_roster") }} as sr + on ar.advisor_teachernumber = sr.powerschool_teacher_number +left join + {{ ref("stg_people__student_logins") }} as sl + on ar.student_number = sl.student_number left join {{ ref("int_edplan__njsmart_powerschool_union") }} as sped on ar.student_number = sped.student_number diff --git a/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__student_enrollments.sql b/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__student_enrollments.sql new file mode 100644 index 0000000000..8a35bdd33a --- /dev/null +++ b/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__student_enrollments.sql @@ -0,0 +1,30 @@ +with + union_relations as ( + {{ + dbt_utils.union_relations( + relations=[ + source( + "kippnewark_powerschool", + "int_powerschool__student_enrollments", + ), + source( + "kippcamden_powerschool", + "int_powerschool__student_enrollments", + ), + source( + "kippmiami_powerschool", + "int_powerschool__student_enrollments", + ), + ] + ) + }} + ), + + parse_region as ( + -- trunk-ignore(sqlfluff/AM04) + select *, regexp_extract(_dbt_source_relation, r'kipp(\w+)_') as region, + from union_relations + ) + +select * except (region), initcap(region) as region, 'kipp' || region as code_location, +from parse_region diff --git a/src/dbt/kipptaf/models/powerschool/properties.yml b/src/dbt/kipptaf/models/powerschool/properties.yml index 3c044257ea..7c0be78b63 100644 --- a/src/dbt/kipptaf/models/powerschool/properties.yml +++ b/src/dbt/kipptaf/models/powerschool/properties.yml @@ -1,7 +1,7 @@ version: 2 models: - - name: base_powerschool__student_enrollments + - name: int_powerschool__student_enrollments description: | This view is a complete enrollment history of all students with enrollments in PowerSchool. The exception to this are students with the same entry and exit dates in PowerSchool ("no-show" students who never attended a KTAF school) and students with an "inactive" enrollment status in PowerSchool (primarily used for duplicate records). diff --git a/src/dbt/kipptaf/models/powerschool/sources-kippcamden.yml b/src/dbt/kipptaf/models/powerschool/sources-kippcamden.yml index 81c88d0637..523f173e80 100644 --- a/src/dbt/kipptaf/models/powerschool/sources-kippcamden.yml +++ b/src/dbt/kipptaf/models/powerschool/sources-kippcamden.yml @@ -2,6 +2,9 @@ version: 2 sources: - name: kippcamden_powerschool + schema: + "{% if env_var('DBT_DEV', '') == 'true' %}_dev_kippcamden_powerschool{% else + %}kippcamden_powerschool{% endif %}" tables: - name: stg_powerschool__assignmentcategoryassoc meta: @@ -515,14 +518,14 @@ sources: - kippcamden - powerschool - base_powerschool__sections - - name: base_powerschool__student_enrollments + - name: int_powerschool__student_enrollments meta: dagster: group: powerschool asset_key: - kippcamden - powerschool - - base_powerschool__student_enrollments + - int_powerschool__student_enrollments - name: int_powerschool__advisory meta: dagster: diff --git a/src/dbt/kipptaf/models/powerschool/sources-kippmiami.yml b/src/dbt/kipptaf/models/powerschool/sources-kippmiami.yml index cb22a6989c..4a43e36c5f 100644 --- a/src/dbt/kipptaf/models/powerschool/sources-kippmiami.yml +++ b/src/dbt/kipptaf/models/powerschool/sources-kippmiami.yml @@ -2,6 +2,9 @@ version: 2 sources: - name: kippmiami_powerschool + schema: + "{% if env_var('DBT_DEV', '') == 'true' %}_dev_kippmiami_powerschool{% else + %}kippmiami_powerschool{% endif %}" tables: - name: stg_powerschool__assignmentcategoryassoc meta: @@ -483,14 +486,14 @@ sources: - kippmiami - powerschool - base_powerschool__sections - - name: base_powerschool__student_enrollments + - name: int_powerschool__student_enrollments meta: dagster: group: powerschool asset_key: - kippmiami - powerschool - - base_powerschool__student_enrollments + - int_powerschool__student_enrollments - name: int_powerschool__advisory meta: dagster: diff --git a/src/dbt/kipptaf/models/powerschool/sources-kippnewark.yml b/src/dbt/kipptaf/models/powerschool/sources-kippnewark.yml index b88b8bcb3d..1a101fee1c 100644 --- a/src/dbt/kipptaf/models/powerschool/sources-kippnewark.yml +++ b/src/dbt/kipptaf/models/powerschool/sources-kippnewark.yml @@ -2,6 +2,9 @@ version: 2 sources: - name: kippnewark_powerschool + schema: + "{% if env_var('DBT_DEV', '') == 'true' %}_dev_kippnewark_powerschool{% else + %}kippnewark_powerschool{% endif %}" tables: - name: stg_powerschool__assignmentcategoryassoc meta: @@ -515,14 +518,14 @@ sources: - kippnewark - powerschool - base_powerschool__sections - - name: base_powerschool__student_enrollments + - name: int_powerschool__student_enrollments meta: dagster: group: powerschool asset_key: - kippnewark - powerschool - - base_powerschool__student_enrollments + - int_powerschool__student_enrollments - name: int_powerschool__advisory meta: dagster: diff --git a/src/dbt/powerschool/dbt_project.yml b/src/dbt/powerschool/dbt_project.yml index 551003079d..35b085405c 100644 --- a/src/dbt/powerschool/dbt_project.yml +++ b/src/dbt/powerschool/dbt_project.yml @@ -27,6 +27,7 @@ clean-targets: # directories to be removed by `dbt clean` vars: current_academic_year: 0 local_timezone: UTC + state_reporting_version: null models: +schema: powerschool diff --git a/src/dbt/powerschool/models/intermediate/int_powerschool__district_entry_date.sql b/src/dbt/powerschool/models/intermediate/int_powerschool__district_entry_date.sql index 6927f26740..d64e2b6e8d 100644 --- a/src/dbt/powerschool/models/intermediate/int_powerschool__district_entry_date.sql +++ b/src/dbt/powerschool/models/intermediate/int_powerschool__district_entry_date.sql @@ -9,7 +9,7 @@ with lag(exitcode, 1) over ( partition by student_number order by entrydate asc ) as exitcode_prev, - from {{ ref("base_powerschool__student_enrollments") }} + from {{ ref("int_powerschool__student_enrollments") }} where schoolid != 999999 ) diff --git a/src/dbt/powerschool/models/intermediate/int_powerschool__gpa_cumulative.sql b/src/dbt/powerschool/models/intermediate/int_powerschool__gpa_cumulative.sql index 771d11288d..b9611f5800 100644 --- a/src/dbt/powerschool/models/intermediate/int_powerschool__gpa_cumulative.sql +++ b/src/dbt/powerschool/models/intermediate/int_powerschool__gpa_cumulative.sql @@ -77,7 +77,7 @@ with null as unweighted_grade_points, from {{ ref("base_powerschool__final_grades") }} as fg inner join - {{ ref("base_powerschool__student_enrollments") }} as co + {{ ref("int_powerschool__student_enrollments") }} as co on fg.studentid = co.studentid and fg.yearid = co.yearid and co.rn_year = 1 @@ -125,7 +125,7 @@ with null as unweighted_grade_points, from {{ ref("base_powerschool__final_grades") }} as fg inner join - {{ ref("base_powerschool__student_enrollments") }} as co + {{ ref("int_powerschool__student_enrollments") }} as co on fg.studentid = co.studentid and fg.yearid = co.yearid and co.rn_year = 1 diff --git a/src/dbt/powerschool/models/base/base_powerschool__student_enrollments.sql b/src/dbt/powerschool/models/intermediate/int_powerschool__student_enrollments.sql similarity index 89% rename from src/dbt/powerschool/models/base/base_powerschool__student_enrollments.sql rename to src/dbt/powerschool/models/intermediate/int_powerschool__student_enrollments.sql index a0403bdfe3..751b9f7852 100644 --- a/src/dbt/powerschool/models/base/base_powerschool__student_enrollments.sql +++ b/src/dbt/powerschool/models/intermediate/int_powerschool__student_enrollments.sql @@ -352,7 +352,6 @@ select sch.abbreviation as school_abbreviation, scf.spedlep, - scf.lep_status, scf.is_homeless, adv.advisory_name, @@ -432,13 +431,7 @@ select scw.pickup_3_phone_work, scw.pickup_3_relationship, - case - when enr.grade_level = 99 - then enr.cohort_graduated - when enr.grade_level >= 9 - then enr.cohort_secondary - else enr.cohort_primary - end as cohort, + coalesce(suf.is_504, false) as is_504, coalesce(sp.is_self_contained, false) as is_self_contained, @@ -449,6 +442,57 @@ select if(ood.dcid is not null, ood.specprog_name, sch.name) as reporting_school_name, if(ood.dcid is not null, 'OD', sch.school_level) as school_level, + + case + when enr.grade_level = 99 + then enr.cohort_graduated + when enr.grade_level >= 9 + then enr.cohort_secondary + else enr.cohort_primary + end as cohort, + + {% if var("state_reporting_version") == "NJ" %} + nj.districtcoderesident, + nj.referral_date, + nj.parental_consent_eval_date, + nj.eligibility_determ_date, + nj.initial_iep_meeting_date, + nj.parent_consent_intial_iep_date, + nj.annual_iep_review_meeting_date, + nj.reevaluation_date, + nj.parent_consent_obtain_code, + nj.initial_process_delay_reason, + nj.special_education_placement, + nj.time_in_regular_program, + nj.early_intervention_yn, + nj.determined_ineligible_yn, + nj.counseling_services_yn, + nj.occupational_therapy_serv_yn, + nj.physical_therapy_services_yn, + nj.speech_lang_theapy_services_yn, + nj.other_related_services_yn, + nj.lepbegindate, + nj.lependdate, + nj.gifted_and_talented, + + suf.newark_enrollment_number, + suf.infosnap_id, + suf.infosnap_opt_in, + suf.media_release, + suf.rides_staff, + + case + when nj.lepbegindate is null + then false + when nj.lependdate < enr.entrydate + then false + when nj.lepbegindate <= enr.exitdate + then true + else false + end as lep_status, + {% elif var("state_reporting_version") == "FL" %} + suf.fleid, suf.infosnap_id, suf.media_release, scf.lep_status, + {% endif %} from with_boy_status_window as enr inner join {{ ref("stg_powerschool__schools") }} as sch on enr.schoolid = sch.school_number @@ -473,3 +517,11 @@ left join on enr.studentid = ood.studentid and enr.exitdate between ood.enter_date and ood.exit_date and ood.is_out_of_district +left join + {{ ref("stg_powerschool__u_studentsuserfields") }} as suf + on enr.students_dcid = suf.studentsdcid +{% if var("state_reporting_version") == "NJ" %} + left join + {{ ref("stg_powerschool__s_nj_stu_x") }} as nj + on enr.students_dcid = nj.studentsdcid +{% endif %} diff --git a/src/dbt/powerschool/models/intermediate/int_powerschool__teacher_grade_levels.sql b/src/dbt/powerschool/models/intermediate/int_powerschool__teacher_grade_levels.sql index 8db04667a6..08a3fed8c4 100644 --- a/src/dbt/powerschool/models/intermediate/int_powerschool__teacher_grade_levels.sql +++ b/src/dbt/powerschool/models/intermediate/int_powerschool__teacher_grade_levels.sql @@ -34,7 +34,7 @@ with {{ ref("base_powerschool__course_enrollments") }} as enr on st.sectionid = enr.cc_abs_sectionid 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_dateenrolled between co.entrydate and co.exitdate group by st.teachernumber, enr.cc_yearid, enr.cc_academic_year, co.grade_level