Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased
## New features
- **Breaking Change**: Add fct models `fct_student_iep`, `fct_idea_event`, and `fct_student_iep_disability`. These new models require adding the corresponding sources.
## Under the hood
## Fixes

Expand Down
3 changes: 3 additions & 0 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ models:
+enabled: "{{ var('edu:tpdm:enabled', False) }}"
core_warehouse:
+schema: wh
sedm_warehouse:
+schema: wh
+enabled: "{{ var('edu:sedm:enabled', False) }}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rlittle08 I see that there is an existsing special education tag edu:special_ed. However, these new models are only available with the new SEDM Ed-Fi extension, so I'm not sure if I should use this new name and make a note about this distinction somewhere, or if these new models should fall under the existing variable.

tpdm_warehouse:
+schema: wh
+enabled: "{{ var('edu:tpdm:enabled', False) }}"
Expand Down
43 changes: 43 additions & 0 deletions models/sedm_warehouse/fct_idea_event.sql
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because student is part of the grain, can you rename here to fct_student_idea_event? base/stg can stay the same to follow practice of those models exactly matching the ed-fi resource

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{
config(
post_hook=[
"alter table {{ this }} alter column k_idea_event set not null",
"alter table {{ this }} alter column k_student set not null",
"alter table {{ this }} alter column k_student_xyear set not null",
"alter table {{ this }} add primary key (k_idea_event)",
"alter table {{ this }} add constraint fk_{{ this.name }}_student foreign key (k_student) references {{ ref('dim_student') }}",
]
)
}}

with stage as (
select * from {{ ref('stg_sedm__idea_events') }}
),

dim_student as (
select * from {{ ref('dim_student') }}
),

formatted as (
select
stage.k_idea_event,
dim_student.k_student,
dim_student.k_student_xyear,
stage.tenant_code,
stage.school_year,
stage.idea_event_id,
stage.ed_org_id,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back in stage, can you add edorg_ref(), so we can get k_lea and k_school in the fct here?

stage.ed_org_type,
stage.idea_event,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

back in base/stg, I think we should rename this to idea_event_type, to follow our typical practice. There are exceptions, but i think this is a case where type is important info - this is capturing the type/category of event, right?

stage.event_begin_date,
stage.event_end_date,
stage.event_narrative,
stage.event_reason,
stage.event_compliance
{{ edu_edfi_source.extract_extension(model_name='stg_sedm__idea_events', flatten=False) }}
from stage
inner join dim_student
on stage.k_student = dim_student.k_student
)

select * from formatted
60 changes: 60 additions & 0 deletions models/sedm_warehouse/fct_idea_event.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version: 2

models:
- name: fct_idea_event
description: >
##### Overview:
This fact table contains IDEA-related events for students (for example, meetings,
evaluations, or other documented IDEA processes), keyed to the warehouse student.

##### Primary Key:
`k_idea_event` -- There is one record per IDEA event association in the source data.

config:
tags: ['sedm']
enabled: "{{ var('edu:sedm:enabled', False) }}"

constraints:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for including these!

- type: primary_key
columns: [k_idea_event]
- type: foreign_key
name: fk__fct_idea_event__k_student
columns: [k_student]
to: ref('dim_student')
to_columns: [k_student]

columns:
- name: k_idea_event
tests:
- unique
- not_null
- name: k_student
description: Defining key for the student in this school year.
- name: k_student_xyear
description: Defining key for the student, which is consistent across years.
- name: tenant_code
description: The tenant associated with the record.
- name: school_year
description: >
School year specified by Spring year.
e.g. the 2021-2022 year would be 2022.
- name: idea_event_id
description: A unique identifier for the event record as assigned by the provider of IEP services.
- name: ed_org_id
description: The identifier for the educational organization associated with the IDEA event.
- name: ed_org_type
description: >
The type of educational organization
e.g., School or LocalEducationAgency.
- name: idea_event
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you fill in these idea-specific fields, using the data handbook descriptions?

description: The specific legal step, procedure, or standard event milestone captured as part of IDEA compliance requirements.
- name: event_begin_date
description: The date when the IDEA related event started.
- name: event_end_date
description: The date when the IDEA related event concluded.
- name: event_narrative
description: Detailed and summary notes recorded during the event.
- name: event_reason
description: The reason why the IDEA event occurred.
- name: event_compliance
description: The type of compliance represented by this event.
48 changes: 48 additions & 0 deletions models/sedm_warehouse/fct_student_iep.sql
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm leaning toward a rename of fct_student_iep_association - thoughts?

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{{
config(
post_hook=[
"alter table {{ this }} alter column k_student_iep set not null",
"alter table {{ this }} alter column k_student set not null",
"alter table {{ this }} alter column k_student_xyear set not null",
"alter table {{ this }} add primary key (k_student_iep)",
"alter table {{ this }} add constraint fk_{{ this.name }}_student foreign key (k_student) references {{ ref('dim_student') }}",
]
)
}}

with stage as (
select * from {{ ref('stg_sedm__student_ieps') }}
),

dim_student as (
select * from {{ ref('dim_student') }}
),

formatted as (
select
stage.k_student_iep,
dim_student.k_student,
dim_student.k_student_xyear,
stage.tenant_code,
stage.school_year,
stage.student_iep_association_id,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment on upstream pr about this col - the ed-fi docs call it by a different name?

stage.ed_org_id,
stage.ed_org_type,
stage.iep_finalized_date,
stage.iep_begin_date,
stage.iep_end_date,
stage.iep_amended_date,
stage.iep_status,
stage.reason_exited,
stage.special_education_setting,
stage.is_medically_fragile,
stage.is_multiply_disabled,
stage.school_hours_per_week,
stage.special_education_hours_per_week
{{ edu_edfi_source.extract_extension(model_name='stg_sedm__student_ieps', flatten=False) }}
from stage
inner join dim_student
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

picky, we generally just do join not inner join, and don't indent this way

on stage.k_student = dim_student.k_student
)

select * from formatted
50 changes: 50 additions & 0 deletions models/sedm_warehouse/fct_student_iep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
version: 2

models:
- name: fct_student_iep
description: >
##### Overview:
This fact table contains student Individualized Education Program (IEP) records,
keyed to the warehouse student.

##### Primary Key:
`k_student_iep` -- There is one record per student IEP association in the source data.

config:
tags: ['sedm']
enabled: "{{ var('edu:sedm:enabled', False) }}"

constraints:
- type: primary_key
columns: [k_student_iep]
- type: foreign_key
name: fk__fct_student_iep__k_student
columns: [k_student]
to: ref('dim_student')
to_columns: [k_student]

columns:
- name: k_student_iep
tests:
- unique
- not_null
- name: k_student
description: Defining key for the student in this school year.
- name: k_student_xyear
description: Defining key for the student, which is consistent across years.
- name: tenant_code
- name: school_year
- name: student_iep_association_id
- name: ed_org_id
- name: ed_org_type
- name: iep_finalized_date
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add descriptions to these by copying from ed-fi handbook?

- name: iep_begin_date
- name: iep_end_date
- name: iep_amended_date
- name: iep_status
- name: reason_exited
- name: special_education_setting
- name: is_medically_fragile
- name: is_multiply_disabled
- name: school_hours_per_week
- name: special_education_hours_per_week
27 changes: 27 additions & 0 deletions models/sedm_warehouse/fct_student_iep_disability.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{
config(
post_hook=[
"alter table {{ this }} add constraint fk_{{ this.name }}_student_iep foreign key (k_student_iep) references {{ ref('fct_student_iep') }}",
]
)
}}

with disabilities as (
select * from {{ ref('stg_sedm__student_iep_disability_collections') }}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment on upstream pr - is this resource available in 6.1 data model? or has it moved to being a collection on studentIEP?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

depending on your response, I may think about whether this should have its own fct model vs. be included in fct_student_iep

),

formatted as (
select
disabilities.k_student_iep,
disabilities.tenant_code,
disabilities.school_year,
disabilities.ed_org_id,
disabilities.disability_descriptor,
disabilities.disability_determination_source_type_descriptor,
disabilities.disability_diagnosis,
disabilities.order_of_disability
{{ edu_edfi_source.extract_extension(model_name='stg_sedm__student_iep_disability_collections', flatten=False) }}
from disabilities
)

select * from formatted
40 changes: 40 additions & 0 deletions models/sedm_warehouse/fct_student_iep_disability.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: 2

models:
- name: fct_student_iep_disability
description: >
##### Overview:
This fact table lists disabilities associated with each student IEP, as recorded
in the source disability collection.

##### Grain:
One row per IEP disability entry, typically unique by `k_student_iep` and
`order_of_disability`.

config:
tags: ['sedm']
enabled: "{{ var('edu:sedm:enabled', False) }}"

constraints:
- type: foreign_key
name: fk__fct_student_iep_disability__k_student_iep
columns: [k_student_iep]
to: ref('fct_student_iep')
to_columns: [k_student_iep]

tests:
- dbt_utils.unique_combination_of_columns:
arguments:
combination_of_columns:
- k_student_iep
- order_of_disability

columns:
- name: k_student_iep
- name: tenant_code
- name: school_year
- name: ed_org_id
- name: disability_descriptor
- name: disability_determination_source_type_descriptor
- name: disability_diagnosis
- name: order_of_disability