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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased
## New features
- Update base/stg models for SEDM `student_ieps` and `iep_events`
- Add base/stg models for new SEDM `student_iep_disability_collections`
## Under the hood
## Fixes

Expand Down
16 changes: 8 additions & 8 deletions macros/gen_skey.sql
Original file line number Diff line number Diff line change
Expand Up @@ -344,18 +344,18 @@
},
'k_idea_event': {
'reference_name': 'idea_event_reference',
'col_list': ['ed_org_id',
'idea_event_id',
'student_unique_id',
'idea_event'],
'col_list': ['educationOrganizationId',
'ideaEvent',
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.

based on API docs, I think we need ideaEventTypeDescriptor instead of ideaEvent

'ideaEventId',
'studentUniqueId'],
'annualize': True
},
'k_student_iep': {
'reference_name': 'student_iep_reference',
'col_list': ['iep_finalized_date',
'ed_org_id',
'student_iep_association_id',
'student_unique_id'],
'col_list': ['educationOrganizationId',
'iepFinalizedDate',
'studentIEPAssociationId',
'studentUniqueId'],
'annualize': True
},
'k_student_iep_service_prescription': {
Expand Down
4 changes: 4 additions & 0 deletions models/staging/sedm/base/_sedm__base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ models:
config:
tags: ['sedm']
enabled: "{{ var('src:domain:sedm:enabled', False) }}"
- name: base_sedm__student_iep_disability_collections
config:
tags: ['sedm']
enabled: "{{ var('src:domain:sedm:enabled', False) }}"
- name: base_sedm__idea_events
config:
tags: ['sedm']
Expand Down
4 changes: 2 additions & 2 deletions models/staging/sedm/base/base_sedm__idea_events.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ renamed as (
v:educationOrganizationReference:link:rel::string as ed_org_type,
{{ extract_descriptor('v:ideaEventDescriptor::string') }} as idea_event,
-- value columns
v:eventBeginDate::date as event_begin_date,
v:eventEndDate::date as event_end_date,
v:beginDate::date as event_begin_date,
v:endDate::date as event_end_date,
v:eventNarrative::string as event_narrative,
-- descriptors
{{ extract_descriptor('v:eventReasonDescriptor::string') }} as event_reason,
Expand Down
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 don't see this resource in the ed-fi handbook or api docs, is it not part of the 6.1 release?

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
with disabilities as (
{{ source_edfi3('student_iep_disability_collections')}}
),
renamed as (
select
tenant_code,
api_year,
pull_timestamp,
last_modified_timestamp,
file_row_number,
filename,
is_deleted,
v:id::string as record_guid,
ods_version,
data_model_version,
v:studentIEPReference:educationOrganizationId::int as ed_org_id,
v:studentIEPReference:iepFinalizedDate::date as iep_finalized_date,
v:studentIEPReference:studentIEPAssociationID::string as student_iep_association_id,
v:studentIEPReference:studentUniqueId::string as student_unique_id,
-- references
v:studentIEPReference as student_iep_reference,
-- lists
v:disabilities as v_disabilities,

-- edfi extensions
v:_ext as v_ext
from disabilities
)
select * from renamed
4 changes: 4 additions & 0 deletions models/staging/sedm/stage/_sedm_stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ models:
config:
tags: ['sedm']
enabled: "{{ var('src:domain:sedm:enabled', False) }}"
- name: stg_sedm__student_iep_disability_collections
config:
tags: ['sedm']
enabled: "{{ var('src:domain:sedm:enabled', False) }}"

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
with base as (
select * from {{ ref('base_sedm__student_iep_disability_collections') }}
),
keyed as (
select
{{ dbt_utils.generate_surrogate_key(
[
'tenant_code',
'api_year',
'ed_org_id',
'iep_finalized_date',
'lower(student_iep_association_id)',
'lower(student_unique_id)'
]
) }} as k_student_iep,
api_year as school_year,
base.*,
{{ extract_extension(model_name=this.name, flatten=True) }}
from base
),
deduped as (
{{
dbt_utils.deduplicate(
relation='keyed',
partition_by='k_student_iep, ed_org_id',
order_by='last_modified_timestamp desc, pull_timestamp desc'
)
}}
),
flattened as (
select
tenant_code,
school_year,
k_student_iep,
ed_org_id,
student_iep_association_id,
{{ extract_descriptor('value:disabilityDescriptor::string') }} as disability_descriptor,
{{ extract_descriptor('value:disabilityDeterminationSourceTypeDescriptor::string') }} as disability_determination_source_type_descriptor,
{{ extract_descriptor('value:disabilityDiagnosis::string') }} as disability_diagnosis,
{{ extract_descriptor('value:orderOfDisability::int') }} as order_of_disability
from deduped
{{ json_flatten('v_disabilities') }}
where not is_deleted
)
select * from flattened
2 changes: 1 addition & 1 deletion models/staging/sedm/stage/stg_sedm__student_ieps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ keyed as (
[
'tenant_code',
'api_year',
'lower(student_iep_association_id)',
'ed_org_id',
'iep_finalized_date',
'lower(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.

thanks for this catch!

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.

the edfi handbook and api docs seem to call this StudentIEPIdentifier -- did that change?

'lower(student_unique_id)'
]
) }} as k_student_iep,
Expand Down