Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cbini committed Nov 14, 2023
2 parents 94bcb0b + 2f7c48f commit b01934e
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with
and sr.is_internal_assessment
and sr.academic_year = {{ var("current_academic_year") }}
and sr.subject_area in ('Text Study', 'Mathematics', 'Writing')
and sr.module_type in ('QA', 'MQQ')
and sr.module_type in ('QA', 'MQQ', 'GWT')
and sr.powerschool_student_number in (
select student_number,
from {{ ref("stg_powerschool__students") }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,65 @@ with

sum(if(is_submitted, 1, 0)) as n_submitted,
sum(if(is_accepted, 1, 0)) as n_accepted,

round(
avg(
case
when application_submission_status = 'Wishlist'
then adjusted_6_year_minority_graduation_rate
end
),
0
) as ecc_wishlist_avg,
round(
min(
case
when application_submission_status = 'Wishlist'
then adjusted_6_year_minority_graduation_rate
end
),
0
) as ecc_wishlist_min,
round(
avg(
case
when application_submission_status = 'Submitted'
then adjusted_6_year_minority_graduation_rate
end
),
0
) as ecc_submitted_avg,
round(
min(
case
when application_submission_status = 'Submitted'
then adjusted_6_year_minority_graduation_rate
end
),
0
) as ecc_submitted_min,
round(
avg(
case
when
matriculation_decision = 'Matriculated (Intent to Enroll)'
and transfer_application = false
then adjusted_6_year_minority_graduation_rate
end
),
0
) as ecc_matriculated_avg,
round(
min(
case
when
matriculation_decision = 'Matriculated (Intent to Enroll)'
and transfer_application = false
then adjusted_6_year_minority_graduation_rate
end
),
0
) as ecc_matriculated_min,
from {{ ref("base_kippadb__application") }}
group by applicant
),
Expand Down Expand Up @@ -215,6 +274,12 @@ select
ar.n_submitted,
ar.n_accepted,
ar.is_matriculated,
ar.ecc_submitted_avg,
ar.ecc_wishlist_avg,
ar.ecc_submitted_min,
ar.ecc_wishlist_min,
ar.ecc_matriculated_avg,
ar.ecc_matriculated_min,

cnr.as1,
cnr.as2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ with

round(avg(mem.attendancevalue), 2) as ada_term_running,
coalesce(sum(abs(mem.attendancevalue - 1)), 0) as n_absences_y1_running,
coalesce(
sum(
case
when ac.att_code not in ('ISS', 'OSS', 'OS', 'OSSP', 'SHI')
then abs(mem.attendancevalue - 1)
end
),
0
) as n_absences_y1_running_non_susp,
case
regexp_extract(mem._dbt_source_relation, r'(kipp\w+)_')
when 'kippnewark'
Expand All @@ -34,6 +43,17 @@ with
and mem.yearid = rt.powerschool_year_id
and mem.calendardate <= rt.end_date -- join to all terms after calendardate
and rt.type = 'RT'
left join
{{ ref("stg_powerschool__attendance") }} as att
on mem.studentid = att.studentid
and mem.calendardate = att.att_date
and {{ union_dataset_join_clause(left_alias="mem", right_alias="att") }}
left join
{{ ref("stg_powerschool__attendance_code") }} as ac
on att.attendance_codeid = ac.id
and att.yearid = ac.yearid
and att.schoolid = ac.schoolid
and {{ union_dataset_join_clause(left_alias="att", right_alias="ac") }}
where
mem.membershipvalue = 1
and mem.calendardate <= current_date('{{ var("local_timezone") }}')
Expand Down Expand Up @@ -110,6 +130,7 @@ with

att.ada_term_running,
att.n_absences_y1_running,
att.n_absences_y1_running_non_susp,

ir.iready_reading_recent,
ir.iready_math_recent,
Expand All @@ -134,11 +155,11 @@ with
/* HS */
when
co.grade_level >= 9
and att.n_absences_y1_running >= att.hs_at_risk_absences
and att.n_absences_y1_running_non_susp >= att.hs_at_risk_absences
then 'Off-Track'
when
co.grade_level >= 9
and att.n_absences_y1_running >= att.hs_off_track_absences
and att.n_absences_y1_running_non_susp >= att.hs_off_track_absences
then 'Off-Track'
else 'On-Track'
end as attendance_status,
Expand Down Expand Up @@ -196,6 +217,7 @@ select
term_name,
ada_term_running,
n_absences_y1_running,
n_absences_y1_running_non_susp,
iready_reading_recent,
iready_math_recent,
n_failing,
Expand Down

0 comments on commit b01934e

Please sign in to comment.