-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/sedm clean #244
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
base: main
Are you sure you want to change the base?
Feature/sedm clean #244
Changes from all commits
cc69664
1072801
b0caf49
6c3de2f
9cb1321
26ec0af
5016fe4
71f97b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because student is part of the grain, can you rename here to |
| 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, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. back in stage, can you add |
||
| stage.ed_org_type, | ||
| stage.idea_event, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. back in base/stg, I think we should rename this to |
||
| 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 | ||
| 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: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm leaning toward a rename of |
| 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, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. picky, we generally just do |
||
| on stage.k_student = dim_student.k_student | ||
| ) | ||
|
|
||
| select * from formatted | ||
| 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 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
| 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') }} | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| ), | ||
|
|
||
| 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 | ||
| 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 |
There was a problem hiding this comment.
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.