Skip to content

Commit 0bd87d8

Browse files
feature/academic honors flatten (#155)
* initial model * fix spacing * only include the columns necessary to join back to main stg table * add AchievementCategoryDescriptor * remove incompatible try_to_date function in databricks and add honor_award_expires_date * add comma * Add changelog entry for stg_ef3__student_academic_records__academic_honors --------- Co-authored-by: rlittle08 <rlittle@edanalytics.org>
1 parent dddf1d5 commit 0bd87d8

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Unreleased
2-
- Updated `gen_skey.sql` macro. Changed the order of `k_survey_section` column list. Changed survey_section_title from snake case to camel case.
3-
- Corrected `stg_ef3__survey_section_responses.sql` model `k_survey_section_response` variable. previously missing `survey_response_id` variable.
42
## New features
3+
- Add `stg_ef3__student_academic_records__academic_honors` to capture academic honors from student academic records
54
- Updated `extract_extension.sql` macro to allow for extensions to be defined in the edu_edfi_source `dbt_project.yml` and enabled per project.
65
- Added the tpdm/epdm predefined extension to `dbt_project.yml'
76
## Under the hood
87
## Fixes
98

10-
# edu_edfi_sourve v0.5.1
9+
# edu_edfi_source v0.5.1
1110
## New features
1211
- Add base/stage models `base_ef3__student_school_food_service_program_association`, `stg_ef3__student_school_food_service_program_association`, `stg_ef3__stu_school_food_service__program_services`
1312
- Add base/stage models `base_ef3__student_migrant_education_program_associations`, `stg_ef3__student_migrant_education_program_associations`, `stg_ef3__stu_migrant_edu__program_services`
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
with stg_academic_records as (
2+
select * from {{ ref('stg_ef3__student_academic_records') }}
3+
),
4+
flattened as (
5+
select
6+
tenant_code,
7+
api_year,
8+
k_student_academic_record,
9+
{{ extract_descriptor('value:academicHonorCategoryDescriptor::string') }} as academic_honor_category_code,
10+
value:"honorDescription"::string as honor_description,
11+
value:"honorAwardDate"::date as honor_award_date,
12+
value:"honorAwardExpiresDate"::date as honor_award_expires_date,
13+
{{ extract_descriptor('value:achievementCategoryDescriptor::string') }} as achievement_category_descriptor,
14+
value:achievementCategorySystem::string as achievement_category_system,
15+
value:achievementTitle::string as achievement_title,
16+
value:criteria::string as criteria,
17+
value:criteriaUrl::string as criteria_url,
18+
value:evidenceStatement::string as evidence_statement,
19+
value:imageURL::string as image_url,
20+
value:issuerName::string as issuer_name,
21+
value:issuerOriginURL::string as issuer_origin_url,
22+
-- edfi extensions
23+
value:_ext as v_ext
24+
from stg_academic_records
25+
{{ json_flatten('v_academic_honors') }}
26+
),
27+
-- pull out extensions from v_academic_honors.v_ext to their own columns
28+
extended as (
29+
select
30+
flattened.*
31+
{{ extract_extension(model_name=this.name, flatten=True) }}
32+
from flattened
33+
)
34+
select * from extended

0 commit comments

Comments
 (0)