From d2d081cd56a0421df4adc483761e142120c1bb9f Mon Sep 17 00:00:00 2001 From: Charlie Bini Date: Thu, 14 Sep 2023 20:33:28 +0000 Subject: [PATCH] std domains --- .../kipptaf/models/assessments/sources.yml | 13 ++++ .../stg_assessments__standard_domains.sql | 1 + .../rpt_deanslist__mod_standards_domains.sql | 68 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 src/dbt/kipptaf/models/assessments/staging/stg_assessments__standard_domains.sql create mode 100644 src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__mod_standards_domains.sql diff --git a/src/dbt/kipptaf/models/assessments/sources.yml b/src/dbt/kipptaf/models/assessments/sources.yml index 8803a583d3..f241e5b4f8 100644 --- a/src/dbt/kipptaf/models/assessments/sources.yml +++ b/src/dbt/kipptaf/models/assessments/sources.yml @@ -69,3 +69,16 @@ sources: data_type: STRING - name: description data_type: STRING + - name: src_assessments__standard_domains + external: + options: + format: GOOGLE_SHEETS + uris: + - https://docs.google.com/spreadsheets/d/1G2z9rwXsFaMdFL6iOYdfQTVjZ7bctXMyz_Q09IhP4QE + sheet_range: src_assessments__standard_domains + skip_leading_rows: 1 + columns: + - name: standard_code + data_type: STRING + - name: standard_domain + data_type: STRING diff --git a/src/dbt/kipptaf/models/assessments/staging/stg_assessments__standard_domains.sql b/src/dbt/kipptaf/models/assessments/staging/stg_assessments__standard_domains.sql new file mode 100644 index 0000000000..44b32eb25a --- /dev/null +++ b/src/dbt/kipptaf/models/assessments/staging/stg_assessments__standard_domains.sql @@ -0,0 +1 @@ +select * from {{ source("assessments", "src_assessments__standard_domains") }} 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 new file mode 100644 index 0000000000..e494bd3a33 --- /dev/null +++ b/src/dbt/kipptaf/models/extracts/deanslist/rpt_deanslist__mod_standards_domains.sql @@ -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