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

create 10+ absence roster with DL commlog data #2208

Merged
merged 2 commits into from
Nov 22, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
with
commlog as (
select
student_school_id as student_number,
reason as commlog_reason,
response as commlog_notes,
topic as commlog_topic,
_dbt_source_relation,

date(call_date_time) as commlog_date,
{{
date_to_fiscal_year(
date_field="call_date_time", start_month=7, year_source="start"
)
}} as academic_year
from {{ ref("stg_deanslist__comm_log") }} as c
where c.reason like 'Att:%'
)

select
co.academic_year,
co.region,
co.school_abbreviation as school_name,
co.grade_level,
co.student_number,
co.state_studentnumber,
co.lastfirst as student_name,
co.entrydate,
co.exitdate,
co.exitcode,
co.exitcomment,

st.streak_start_date as absence_start_date,
st.streak_end_date as absence_end_date,
st.streak_length_membership as absence_length_in_days,

c.commlog_reason,
c.commlog_notes,
c.commlog_topic,
from {{ ref("int_powerschool__attendance_streak") }} as st
inner join
{{ ref("base_powerschool__student_enrollments") }} as co
on st.studentid = co.studentid
and st.yearid = co.yearid
and {{ union_dataset_join_clause(left_alias="st", right_alias="co") }}
and co.academic_year >= {{ var("current_academic_year") - 1 }}
left join
commlog as c
on co.student_number = c.student_number
and c.commlog_date between st.streak_start_date and st.streak_end_date
and {{ union_dataset_join_clause(left_alias="co", right_alias="c") }}
where st.att_code in ('A', 'AD', 'M') and st.streak_length_membership >= 10
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{
dbt_utils.union_relations(
relations=[
source("kippnewark_powerschool", model.name),
source("kippcamden_powerschool", model.name),
source("kippmiami_powerschool", model.name),
]
)
}}
Loading