Skip to content

Commit

Permalink
add same rule for historic obj assess (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlittle08 authored Jan 25, 2024
1 parent 20165ec commit 0d7ea0e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
18 changes: 15 additions & 3 deletions models/core_warehouse/fct_student_objective_assessment.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ with student_obj_assessments_long_results as (
student_obj_assessments as (
select * from {{ ref('stg_ef3__student_objective_assessments') }}
),
dim_student as (
select * from {{ ref('dim_student') }}
),
object_agg_other_results as (
select
k_student_objective_assessment,
Expand All @@ -29,9 +32,10 @@ student_obj_assessments_wide as (
student_obj_assessments.k_objective_assessment,
student_obj_assessments.k_student_assessment,
student_obj_assessments.k_assessment,
student_obj_assessments.k_student,
dim_student.k_student,
student_obj_assessments.k_student_xyear,
student_obj_assessments.tenant_code,
school_year,
student_obj_assessments.school_year,
administration_date,
administration_end_date,
event_description,
Expand Down Expand Up @@ -59,7 +63,15 @@ student_obj_assessments_wide as (
and student_obj_assessments_long_results.normalized_score_name != 'other'
left join object_agg_other_results
on student_obj_assessments.k_student_objective_assessment = object_agg_other_results.k_student_objective_assessment
{{ dbt_utils.group_by(n=18) }}
-- left join to allow 'historic' records (assess records with no corresponding stu demographics)
left join dim_student
on student_obj_assessments.k_student = dim_student.k_student
-- FILTER to students who EVER have a record in dim_student
where student_obj_assessments.k_student_xyear in (
select distinct k_student_xyear
from dim_student
)
{{ dbt_utils.group_by(n=19) }}
)
select *
from student_obj_assessments_wide
24 changes: 21 additions & 3 deletions models/core_warehouse/fct_student_objective_assessment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,27 @@ version: 2
models:
- name: fct_student_objective_assessment
description: >
Student objective assessment records. The wide results columns are
determined based on the `normalized_score_name` column
from the seed table `xwalk_objective_assessment_scores`.
##### Overview:
This fact table defines student objective assessment records.
##### Primary Key:
`k_student_objective_assessment` -- There is one record per student-objective assessment event
##### Important Business Rules:
The wide score results columns are determined based on the `normalized_score_name`
column from the seed table `xwalk_assessment_scores`.
`k_student` is an annualized student identifier, so it will be null unless there is a student record for the relevant school year.
We INCLUDE records with null `k_student` to enable analysis of current students' full history of assessments. Therefore,
users CAN use `fct_student_objective_assessment` to answer "What is the longitudinal trend in test scores for my current students?"
However, `k_student_xyear` is a x-year student identifier, and we EXCLUDE records where `k_student_xyear` is null,
because we have no way to identify the students. Therefore, users CAN NOT use `fct_student_objective_assessment` to answer
"What is the longitudinal trend in test scores for students who were english learners at the time of the test?",
UNLESS every year of assessment data has a corresponding & complete set of identifying data in `dim_student`.
Often, this means you should only run longitudinal analysis on years for which you have populated an Ed-Fi ODS,
or a supplementary data source.
config:
tags: ['assessment']
enabled: "{{ var('src:domain:assessment:enabled', True) }}"
Expand Down

0 comments on commit 0d7ea0e

Please sign in to comment.