-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #290 from TEAMSchools/deanslist-extracts
std domains
- Loading branch information
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/dbt/kipptaf/models/assessments/staging/stg_assessments__standard_domains.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
select * from {{ source("assessments", "src_assessments__standard_domains") }} |
68 changes: 68 additions & 0 deletions
68
src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__mod_standards_domains.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
with | ||
response_rollup as ( | ||
select | ||
sr.powerschool_student_number, | ||
sr.academic_year, | ||
sr.term_administered, | ||
sr.percent_correct, | ||
if( | ||
sr.subject_area = 'Writing', 'Text Study', sr.subject_area | ||
) as subject_area, | ||
|
||
st.standard_domain, | ||
from {{ ref("int_assessments__response_rollup") }} as sr | ||
inner join | ||
{{ ref("stg_assessments__standard_domains") }} as st | ||
on sr.response_type_code = st.standard_code | ||
where | ||
sr.response_type = 'standard' | ||
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.powerschool_student_number in ( | ||
select student_number | ||
from {{ ref("stg_powerschool__students") }} | ||
where | ||
grade_level < 5 | ||
and not regexp_contains(_dbt_source_relation, r'kippmiami') | ||
) | ||
), | ||
|
||
standard_avg as ( | ||
select | ||
powerschool_student_number, | ||
academic_year, | ||
term_administered, | ||
subject_area, | ||
standard_domain, | ||
round(avg(percent_correct), 0) as avg_percent_correct, | ||
from response_rollup | ||
group by | ||
powerschool_student_number, | ||
academic_year, | ||
term_administered, | ||
subject_area, | ||
standard_domain | ||
) | ||
|
||
select | ||
powerschool_student_number as local_student_id, | ||
academic_year, | ||
term_administered, | ||
subject_area, | ||
standard_domain, | ||
avg_percent_correct, | ||
case | ||
when avg_percent_correct >= 85 | ||
then 'Exceeds Expectations' | ||
when avg_percent_correct >= 70 | ||
then 'Met Expectations' | ||
when avg_percent_correct >= 50 | ||
then 'Approaching Expectations' | ||
when avg_percent_correct >= 30 | ||
then 'Below Expectations' | ||
when avg_percent_correct >= 0 | ||
then 'Far Below Expectations' | ||
end as performance_level, | ||
from standard_avg |