forked from edanalytics/edu_edfi_source
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Copy pull request #84 from original repository. #1
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: base_tpdm__candidates | ||
config: | ||
tags: ['tpdm'] | ||
- name: base_tpdm__educator_preparation_programs | ||
config: | ||
tags: ['tpdm'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
with candidates as ( | ||
{{ source_edfi3('candidates') }} | ||
), | ||
renamed as ( | ||
select | ||
tenant_code, | ||
api_year, | ||
pull_timestamp, | ||
last_modified_timestamp, | ||
file_row_number, | ||
filename, | ||
is_deleted, | ||
|
||
v:id::string as record_guid, | ||
v:candidateIdentifier::string as candidate_id, | ||
v:firstName::string as first_name, | ||
v:lastSurname::string as last_name, | ||
v:middleName::string as middle_name, | ||
v:maidenName::string as maiden_name, | ||
v:generationCodeSuffix::string as generation_code_suffix, | ||
v:personalTitlePrefix::string as personal_title_prefix, | ||
v:preferredFirstName::string as preferred_first_name, | ||
v:preferredLastSurname::string as preferred_last_name, | ||
v:birthCity::string as birth_city, | ||
v:birthDate::date as birth_date, | ||
v:birthInternationalProvince::string as birth_international_province, | ||
v:dateEnteredUS::date as date_entered_us, | ||
v:displacementStatus::string as displacement_status, | ||
v:economicDisadvantaged::boolean as is_economic_disadvantaged, | ||
v:firstGenerationStudent::boolean as is_first_generation_student, | ||
v:hispanicLatinoEthnicity::boolean as has_hispanic_latino_ethnicity, | ||
v:multipleBirthStatus::boolean as is_multiple_birth, | ||
-- descriptors | ||
{{ extract_descriptor('v:genderDescriptor::string') }} as gender, | ||
{{ extract_descriptor('v:sexDescriptor::string') }} as sex, | ||
{{ extract_descriptor('v:birthSexDescriptor::string') }} as birth_sex, | ||
{{ extract_descriptor('v:birthStateAbbreviationDescriptor::string') }} as birth_state, | ||
{{ extract_descriptor('v:birthCountyDescriptor::string') }} as birth_county, | ||
{{ extract_descriptor('v:englishLanguageExamDescriptor::string' )}} as english_language_exam, | ||
{{ extract_descriptor('v:limitedEnglishProficiencyDescriptor::string' )}} as lep_code, | ||
-- unflattened lists | ||
v:addresses as v_addresses, | ||
v:disabilities as v_disabilities, | ||
v:electronicMails as v_emails, | ||
v:languages as v_languages, | ||
v:otherNames as v_other_names, | ||
v:personalIdentificationDocuments as v_personal_identification_documents, | ||
v:races as v_races, | ||
v:telephones as v_telephones, | ||
|
||
-- references | ||
v:personReference as person_reference, | ||
|
||
from candidates | ||
) | ||
select * from renamed |
30 changes: 30 additions & 0 deletions
30
models/staging/tpdm/base/base_tpdm__educator_preparation_programs.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
with educator_prep_programs as ( | ||
{{ source_edfi3('educator_preparation_programs') }} | ||
), | ||
renamed as ( | ||
select | ||
tenant_code, | ||
api_year, | ||
pull_timestamp, | ||
last_modified_timestamp, | ||
file_row_number, | ||
filename, | ||
is_deleted, | ||
|
||
v:id::string as record_guid, | ||
v:programId::string as program_id, | ||
v:programName::string as program_name, | ||
v:educationOrganizationReference:educationOrganizationId::integer as ed_org_id, | ||
v:educationOrganizationReference:link:rel::string as ed_org_type, | ||
-- descriptors | ||
{{ extract_descriptor('v:programTypeDescriptor::string') }} as program_type, | ||
{{ extract_descriptor('v:accreditationStatusDescriptor::string') }} as accreditation_status, | ||
-- unflattened lists | ||
v:gradeLevels as v_grade_levels, | ||
-- references | ||
v:educationOrganizationReference as ed_org_reference, | ||
-- edfi extensions | ||
v:_ext as v_ext | ||
from educator_prep_programs | ||
) | ||
select * from renamed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
version: 2 | ||
|
||
referential_integrity_tests: | ||
- k_candidate: &ref_k_candidate | ||
- relationships: | ||
to: ref('stg_tpdm__candidates') | ||
field: k_candidate | ||
tags: ['ref_integrity'] | ||
|
||
- k_educator_prep_program: &ref_k_educator_prep_program | ||
- relationships: | ||
to: ref('stg_tpdm__educator_preparation_programs') | ||
field: k_educator_prep_program | ||
tags: ['ref_integrity'] | ||
|
||
|
||
models: | ||
- name: stg_tpdm__candidates | ||
config: | ||
tags: ['tpdm'] | ||
- name: stg_tpdm__educator_preparation_programs | ||
config: | ||
tags: ['tpdm'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
with base_candidates as ( | ||
select * from {{ ref('base_tpdm__candidates') }} | ||
where not is_deleted | ||
), | ||
keyed as ( | ||
select | ||
{{ dbt_utils.surrogate_key( | ||
[ | ||
'tenant_code', | ||
'api_year', | ||
'lower(candidate_id)' | ||
] | ||
) }} as k_candidate, | ||
base_candidates.* | ||
{{ extract_extension(model_name=this.name, flatten=True) }} | ||
from base_candidates | ||
), | ||
deduped as ( | ||
{{ | ||
dbt_utils.deduplicate( | ||
relation='keyed', | ||
partition_by='k_candidate', | ||
order_by='pull_timestamp desc' | ||
) | ||
}} | ||
) | ||
select * from deduped |
30 changes: 30 additions & 0 deletions
30
models/staging/tpdm/stage/stg_tpdm__educator_preparation_programs.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
with base_epp as ( | ||
select * from {{ ref('base_tpdm__educator_preparation_programs') }} | ||
where not is_deleted | ||
), | ||
keyed as ( | ||
select | ||
{{ dbt_utils.surrogate_key( | ||
[ | ||
'tenant_code', | ||
'api_year', | ||
'lower(ed_org_id)', | ||
'lower(program_name)', | ||
'lower(program_type)' | ||
] | ||
) }} as k_educator_prep_program, | ||
{{ edorg_ref(annualize=False) }}, | ||
base_epp.* | ||
{{ extract_extension(model_name=this.name, flatten=True) }} | ||
from base_epp | ||
) | ||
deduped as ( | ||
{{ | ||
dbt_utils.deduplicate( | ||
relation='keyed', | ||
partition_by='k_educator_prep_program', | ||
order_by='pull_timestamp desc' | ||
) | ||
}} | ||
) | ||
select * from deduped |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The whitespace formatting on this file does not match the original file. Please adjust it back to the original file's formatting.
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.
Hi @holdorph , I updated format