diff --git a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_gpa.sql b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_gpa.sql index bd69d9cdd..460c1f948 100644 --- a/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_gpa.sql +++ b/src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__gradebook_gpa.sql @@ -186,21 +186,16 @@ with m.rn_course_number_year = 1 and m.cc_sectionid > 0 and m.cc_course_number not in ( - 'LOG100', - 'LOG1010', - 'LOG11', - 'LOG12', - 'LOG20', - 'LOG22999XL', - 'LOG300', - 'LOG9', - 'SEM22106G1', - 'SEM22106S1', - 'SEM72005G1', - 'SEM72005G2', - 'SEM72005G3', - 'SEM72005G4', - 'SEM22101G1' + 'LOG100', -- Lunch + 'LOG1010', -- Lunch + 'LOG11', -- Lunch + 'LOG12', -- Lunch + 'LOG20', -- Early Dismissal + 'LOG22999XL', -- Lunch + 'LOG300', -- Study Hall + 'LOG9', -- Lunch + 'SEM22106G1', -- Advisory + 'SEM22106S1' -- Not in SY24-25 yet ) ), diff --git a/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__student_assignment_audit.sql b/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__student_assignment_audit.sql index 21d399f7f..50427a6a5 100644 --- a/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__student_assignment_audit.sql +++ b/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__student_assignment_audit.sql @@ -1,4 +1,60 @@ with + filtered_courses as ( + select + _dbt_source_relation, + cc_academic_year, + cc_yearid, + cc_schoolid, + students_dcid, + cc_studentid, + cc_course_number, + cc_sectionid, + sections_dcid, + cc_dateenrolled, + cc_dateleft, + + case -- noqa: ST02 + when -- noqa: ST02 + concat(cc_schoolid, cc_course_number) in ( -- noqa: ST02 + '73252SEM72250G1', -- noqa: ST02 + '73252SEM72250G2', -- noqa: ST02 + '73252SEM72250G3', -- noqa: ST02 + '73252SEM72250G4', -- noqa: ST02 + '133570965SEM72250G1', -- noqa: ST02 + '133570965SEM72250G2', -- noqa: ST02 + '133570965SEM72250G3', -- noqa: ST02 + '133570965SEM72250G4', -- noqa: ST02 + '133570965LOG300', -- noqa: ST02 + '73252LOG300', -- noqa: ST02 + '73258LOG300', -- noqa: ST02 + '732514LOG300', -- noqa: ST02 + '732513LOG300', -- noqa: ST02 + '732514GYM08035G1', -- noqa: ST02 + '732514GYM08036G2', -- noqa: ST02 + '732514GYM08037G3', -- noqa: ST02 + '732514GYM08038G4' -- noqa: ST02 + ) -- noqa: ST02 + then true -- noqa: ST02 + else false -- noqa: ST02 + end as exclude_from_audit, -- noqa: ST02 + from {{ ref("base_powerschool__course_enrollments") }} + where + cc_sectionid > 0 + and courses_course_number not in ( + 'LOG100', -- Lunch + 'LOG1010', -- Lunch + 'LOG11', -- Lunch + 'LOG12', -- Lunch + 'LOG20', -- Early Dismissal + 'LOG22999XL', -- Lunch + 'LOG300', -- Study Hall + 'LOG9', -- Lunch + 'SEM22106G1', -- Advisory + 'SEM22106S1', -- Not in SY24-25 yet + 'SEM22101G1' -- Student Government + ) + ), + students_assignments as ( select ce._dbt_source_relation, @@ -37,7 +93,7 @@ with (a.totalpointvalue * s.scorepoints) / 100, s.scorepoints ) as score_converted, - from {{ ref("base_powerschool__course_enrollments") }} as ce + from filtered_courses as ce inner join {{ ref("stg_powerschool__schools") }} as sch on ce.cc_schoolid = sch.school_number @@ -73,23 +129,17 @@ with and {{ union_dataset_join_clause(left_alias="a", right_alias="s") }} where ce.cc_academic_year = {{ var("current_academic_year") }} - and ce.cc_sectionid > 0 - and ce.cc_course_number not in ( - 'HR', - 'LOG100', - 'LOG1010', - 'LOG11', - 'LOG12', - 'LOG20', - 'LOG22999XL', - 'LOG300', - 'LOG9', - 'SEM22106G1', - 'SEM22106S1' - 'SEM72005G1', - 'SEM72005G2', - 'SEM72005G3', - 'SEM72005G4' + and not ce.exclude_from_audit + -- leaves only WH category for iReady courses + and concat(ce.cc_course_number, ge.assignment_category_code) not in ( + 'SEM72005G1F', + 'SEM72005G2F', + 'SEM72005G3F', + 'SEM72005G4F', + 'SEM72005G1S', + 'SEM72005G2S', + 'SEM72005G3S', + 'SEM72005G4S' ) ) diff --git a/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__teacher_assignment_audit.sql b/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__teacher_assignment_audit.sql index 48a60a139..c874ac379 100644 --- a/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__teacher_assignment_audit.sql +++ b/src/dbt/kipptaf/models/powerschool/intermediate/int_powerschool__teacher_assignment_audit.sql @@ -1,4 +1,57 @@ with + filtered_sections as ( + select + _dbt_source_relation, + terms_yearid, + sections_schoolid, + sections_id, + sections_dcid, + terms_firstday, + terms_lastday, + sections_course_number, + teachernumber, + + case -- noqa: ST02 + when -- noqa: ST02 + concat(sections_schoolid, sections_course_number) in ( -- noqa: ST02,LT05 + '73252SEM72250G1', -- noqa: ST02 + '73252SEM72250G2', -- noqa: ST02 + '73252SEM72250G3', -- noqa: ST02 + '73252SEM72250G4', -- noqa: ST02 + '133570965SEM72250G1', -- noqa: ST02 + '133570965SEM72250G2', -- noqa: ST02 + '133570965SEM72250G3', -- noqa: ST02 + '133570965SEM72250G4', -- noqa: ST02 + '133570965LOG300', -- noqa: ST02 + '73252LOG300', -- noqa: ST02 + '73258LOG300', -- noqa: ST02 + '732514LOG300', -- noqa: ST02 + '732513LOG300', -- noqa: ST02 + '732514GYM08035G1', -- noqa: ST02 + '732514GYM08036G2', -- noqa: ST02 + '732514GYM08037G3', -- noqa: ST02 + '732514GYM08038G4' -- noqa: ST02 + ) -- noqa: ST02 + then true -- noqa: ST02 + else false -- noqa: ST02 + end as exclude_from_audit, -- noqa: ST02 + from {{ ref("base_powerschool__sections") }} + where + courses_course_number not in ( + 'LOG100', -- Lunch + 'LOG1010', -- Lunch + 'LOG11', -- Lunch + 'LOG12', -- Lunch + 'LOG20', -- Early Dismissal + 'LOG22999XL', -- Lunch + 'LOG300', -- Study Hall + 'LOG9', -- Lunch + 'SEM22106G1', -- Advisory + 'SEM22106S1', -- Not in SY24-25 yet + 'SEM22101G1' -- Student Government + ) + ), + assignments as ( select sec._dbt_source_relation, @@ -95,7 +148,7 @@ with and c.week_number_quarter = ge.week_number and c.school_level = ge.school_level left join - {{ ref("base_powerschool__sections") }} as sec + filtered_sections as sec on c.schoolid = sec.sections_schoolid and c.yearid = sec.terms_yearid and c.week_end_date between sec.terms_firstday and sec.terms_lastday @@ -111,22 +164,17 @@ with on a.assignmentsectionid = asg.assignmentsectionid and {{ union_dataset_join_clause(left_alias="a", right_alias="asg") }} where - sec.sections_course_number not in ( - 'HR', - 'LOG100', - 'LOG1010', - 'LOG11', - 'LOG12', - 'LOG20', - 'LOG22999XL', - 'LOG300', - 'LOG9', - 'SEM22106G1', - 'SEM22106S1', - 'SEM72005G1', - 'SEM72005G2', - 'SEM72005G3', - 'SEM72005G4' + not sec.exclude_from_audit + -- leaves only WH category for iReady courses + and concat(sec.sections_course_number, ge.assignment_category_code) not in ( + 'SEM72005G1F', + 'SEM72005G2F', + 'SEM72005G3F', + 'SEM72005G4F', + 'SEM72005G1S', + 'SEM72005G2S', + 'SEM72005G3S', + 'SEM72005G4S' ) and sec.terms_firstday >= '{{ var("current_academic_year") }}-07-01' ) diff --git a/src/dbt/powerschool/models/intermediate/int_powerschool__assignment_score_rollup.sql b/src/dbt/powerschool/models/intermediate/int_powerschool__assignment_score_rollup.sql index 970e47567..e5ea3f3b7 100644 --- a/src/dbt/powerschool/models/intermediate/int_powerschool__assignment_score_rollup.sql +++ b/src/dbt/powerschool/models/intermediate/int_powerschool__assignment_score_rollup.sql @@ -1,6 +1,7 @@ with scores as ( select + a.sectionsdcid, a.assignmentsectionid, s.studentsdcid, @@ -32,19 +33,57 @@ with left join {{ ref("stg_powerschool__assignmentscore") }} as s on a.assignmentsectionid = s.assignmentsectionid + ), + + school_course_exceptions as ( + select + cc_yearid, + cc_schoolid, + cc_course_number, + cc_sectionid, + cc_sections_dcid, + + case -- noqa: ST02 + when -- noqa: ST02 + concat(cc_schoolid, cc_course_number) in ( -- noqa: ST02 + '73252SEM72250G1', -- noqa: ST02 + '73252SEM72250G2', -- noqa: ST02 + '73252SEM72250G3', -- noqa: ST02 + '73252SEM72250G4', -- noqa: ST02 + '133570965SEM72250G1', -- noqa: ST02 + '133570965SEM72250G2', -- noqa: ST02 + '133570965SEM72250G3', -- noqa: ST02 + '133570965SEM72250G4', -- noqa: ST02 + '133570965LOG300', -- noqa: ST02 + '73252LOG300', -- noqa: ST02 + '73258LOG300', -- noqa: ST02 + '732514LOG300', -- noqa: ST02 + '732513LOG300', -- noqa: ST02 + '732514GYM08035G1', -- noqa: ST02 + '732514GYM08036G2', -- noqa: ST02 + '732514GYM08037G3', -- noqa: ST02 + '732514GYM08038G4' -- noqa: ST02 + ) -- noqa: ST02 + then true -- noqa: ST02 + else false -- noqa: ST02 + end as exclude_from_audit, -- noqa: ST02 + from {{ ref("base_powerschool__course_enrollments") }} + where cc_sectionid > 0 ) select - assignmentsectionid, + s.assignmentsectionid, - count(studentsdcid) as n_students, - sum(islate) as n_late, - sum(isexempt) as n_exempt, - sum(ismissing) as n_missing, + count(s.studentsdcid) as n_students, + sum(s.islate) as n_late, + sum(s.isexempt) as n_exempt, + sum(s.ismissing) as n_missing, - countif(is_expected) as n_expected, - countif(is_expected_scored) as n_expected_scored, + countif(s.is_expected) as n_expected, + countif(s.is_expected_scored) as n_expected_scored, - avg(if(is_expected_scored, score_percent, null)) as avg_expected_scored_percent, -from scores -group by assignmentsectionid + avg(if(s.is_expected_scored, s.score_percent, null)) as avg_expected_scored_percent, +from scores as s +left join school_course_exceptions as e on s.sections_dcid = e.sectionsdcid +where not e.exclude_from_audit +group by s.assignmentsectionid