forked from edanalytics/edu_edfi_source
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
297 additions
and
0 deletions.
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
35 changes: 35 additions & 0 deletions
35
models/staging/tpdm/base/base_tpdm__candidate_educator_preparation_program_associations.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,35 @@ | ||
with candidate_educator_preparation_program_associations as ( | ||
{{ source_edfi3('candidate_educator_preparation_program_associations') }} | ||
), | ||
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:candidateReference:candidateIdentifier::string as candidate_id, | ||
v:educatorPreparationProgramReference:programId::string as program_id, | ||
v:applicationReference:applicationIdentifier::string as application_id, | ||
v:beginDate::date as begin_date, | ||
v:endDate::date as end_date, | ||
-- descriptors | ||
{{ extract_descriptor('v:reasonExitedDescriptor::string') }} as reason_exited, | ||
{{ extract_descriptor('v:eppProgramPathwayDescriptor::string') }} as epp_program_pathway, | ||
-- unnested lists | ||
v:identificationCodes as v_identification_codes, | ||
v:candidateIndicators as v_candidate_indicators, | ||
v:degreeSpecializations as v_degree_specializations, | ||
v:cohortYears as v_cohort_years, | ||
-- references | ||
v:candidateReference as candidate_reference, | ||
v:educatorPreparationProgramReference as educator_preparation_program_reference, | ||
v:applicationReference as application_reference | ||
from candidate_educator_preparation_program_associations | ||
) | ||
|
||
select * from renamed |
31 changes: 31 additions & 0 deletions
31
models/staging/tpdm/base/base_tpdm__education_organizations.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,31 @@ | ||
with education_organizations as ( | ||
{{ source_edfi3('education_organizations') }} | ||
), | ||
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:educationOrganizationId:int as education_organization_id, | ||
v:nameOfInstitution::string as name_of_institution, | ||
v:shortNameOfInstitution::string as short_name_of_institution, | ||
v:webSite::string as web_site, | ||
-- descriptors | ||
{{ extract_descriptor('v:operationalStatusDescriptor::string') }} as operational_tatus, | ||
-- unnested lists | ||
v:identificationCodes as identification_codes, | ||
v:categories as categories, | ||
v:addresses as addresses, | ||
v:internationalAddresses as international_addresses, | ||
v:institutionTelephones as institution_telephones, | ||
v:indicators as indicators | ||
from education_organization | ||
) | ||
|
||
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,20 @@ | ||
with persons as ( | ||
{{ source_edfi3('persons') }} | ||
), | ||
renamed as ( | ||
select | ||
tenant_code, | ||
api_year, | ||
pull_timestamp, | ||
last_modified_timestamp, | ||
file_row_number, | ||
filename, | ||
is_deleted, | ||
|
||
v:personId::string as person_id, | ||
-- descriptors | ||
{{ extract_descriptor('v:sourceSystemDescriptor::string') }} as source_system | ||
from persons | ||
) | ||
|
||
select * from |
25 changes: 25 additions & 0 deletions
25
models/staging/tpdm/base/base_tpdm__post_secondary_institutions.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,25 @@ | ||
with post_secondary_institutions as ( | ||
{{ source_edfi3('post_secondary_institutions') }} | ||
), | ||
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:postSecondaryInstitutionId::int as post_secondary_institution_id, | ||
-- descriptors | ||
{{ extract_descriptor('v:postSecondaryInstitutionLevelDescriptor::string')}} as post_secondary_institution_level, | ||
{{ extract_descriptor('v:administrativeFundingControlDescriptor::string')}} as administrative_funding_control, | ||
{{ extract_descriptor('v:federalLocaleCodeDescriptor::string')}} as federal_locale_code, | ||
-- unflattened lists | ||
v:mediumOfInstructions as v_medium_of_instructions | ||
from student_academic_records | ||
) | ||
|
||
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,37 @@ | ||
with schools as ( | ||
{{ source_edfi3('schools') }} | ||
), | ||
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:schoolId::int as school_id, | ||
v:localEducationAgencyReference:localEducationAgencyId::int as lea_id, | ||
-- descriptors | ||
{{ extract_descriptor('v:schoolTypeDescriptor::string') }} as school_type, | ||
{{ extract_descriptor('v:postSecondaryInstitutionLevelDescriptor::string')}} as post_secondary_institution_level, | ||
{{ extract_descriptor('v:administrativeFundingControlDescriptor::string')}} as administrative_funding_control, | ||
{{ extract_descriptor('v:federalLocaleCodeDescriptor::string')}} as federal_locale_code, | ||
{{ extract_descriptor('v:internetAccessDescriptor::string') }} as internet_access, | ||
{{ extract_descriptor('v:charterApprovalAgencyTypeDescriptor::string') }} as charter_approval_agency, | ||
{{ extract_descriptor('v:magnetSpecialProgramEmphasisSchoolDescriptor::string') }} as magnet_type, | ||
{{ extract_descriptor('v:titleIPartASchoolDesignationDescriptor::string') }} as title_i_part_a_school_designation, | ||
{{ extract_descriptor('v:charterStatusDescriptor::string') }} as charter_status, | ||
{{ extract_descriptor('v:accreditationStatusDescriptor::string') }} as accreditation_status, | ||
-- references | ||
v:localEducationAgencyReference as local_education_agency_reference, | ||
-- unflattened lists | ||
v:gradeLevels as v_grade_levels, | ||
v:schoolCategories as v_school_categories, | ||
v:mediumOfInstructions as v_medium_of_instructions | ||
from student_academic_records | ||
) | ||
|
||
select * from renamed |
40 changes: 40 additions & 0 deletions
40
models/staging/tpdm/base/base_tpdm__student_academic_records.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,40 @@ | ||
with student_academic_records as ( | ||
{{ source_edfi3('student_academic_records') }} | ||
), | ||
|
||
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:studentReference:studentUniqueId::string as student_unique_id, | ||
v:educationOrganizationReference:educationOrganizationId::int as ed_org_id, | ||
v:educationOrganizationReference:link:rel::string as ed_org_type, | ||
v:schoolYearTypeReference:schoolYear::int as school_year, | ||
v:projectedGraduationDate::date as projected_graduation_date, | ||
-- descriptors | ||
{{ extract_descriptor('v:termDescriptor::string') }} as term, | ||
-- unflattened lists | ||
v:cumulativeEarnedCredits as v_cumulative_earned_credits, | ||
v:cumulativeAttemptedCredits as v_cumulative_attempted_credits, | ||
v:classRanking as v_class_ranking, | ||
v:academicHonors as v_academic_honors, | ||
v:recognitions as v_recognitions, | ||
v:sessionEarnedCredits as v_session_earned_credits, | ||
v:sessionAttemptedCredits as v_session_attempted_credits, | ||
v:gradePointAverages as v_grade_point_averages, | ||
v:diplomas as v_diplomas, | ||
v:reportCards as v_report_cards, | ||
-- references | ||
v:studentReference as student_reference, | ||
v:educationOrganizationReference as ed_org_reference | ||
from student_academic_records | ||
) | ||
|
||
select * from renamed |
23 changes: 23 additions & 0 deletions
23
models/staging/tpdm/base/base_tpdm__survey_response_person_target_associations.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,23 @@ | ||
with survey_response_person_target_associations as ( | ||
{{ source_edfi3('survey_response_person_target_associations') }} | ||
), | ||
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:surveyResponseReference:surveyResponseIdentifier::string as survey_response_id, | ||
v:personReference:personId:string as person_id, | ||
-- references | ||
v:surveyResponseReference as survey_response_reference, | ||
v:personReference as person_reference | ||
from survey_response_person_target_associations | ||
) | ||
|
||
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,33 @@ | ||
with survey_responses as ( | ||
{{ source_edfi3('survey_responses') }} | ||
), | ||
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:surveyReference:surveyIdentifier::string as survey_id, | ||
v:surveyReference:namespace::string as namespace, | ||
v:surveyResponseIdentifier::string as survey_response_id, | ||
v:studentReference:studentUniqueId as student_unique_id, | ||
v:electronicMailAddress::string as electronic_mail_address, | ||
v:fullName::string as full_name, | ||
v:location::string as location, | ||
v:responseDate::date as response_date, | ||
v:responseTime::int as completion_time_seconds, | ||
--references | ||
v:surveyReference as survey_reference, | ||
v:studentReference as student_reference, | ||
v:staffReference as staff_reference, | ||
v:contactReference as contact_reference, | ||
-- lists | ||
v:surveyLevels as v_survey_levels | ||
from survey_responses | ||
) | ||
select * from renamed |
26 changes: 26 additions & 0 deletions
26
models/staging/tpdm/base/base_tpdm__survey_section_responses.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,26 @@ | ||
with base_tpdm__survey_section_responses as ( | ||
{{ source_edfi3('base_tpdm__survey_section_responses') }} | ||
), | ||
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:surveyReference:surveyIdentifier::string as survey_id, | ||
v:surveyResponseReference:surveyResponseIdentifier::string as survey_response_id, | ||
v:surveySectionReference:surveySectionTitle::string as survey_section_title, | ||
v:sectionRating:int as section_rating, | ||
-- references | ||
v:surveySectionReference as survey_section_reference, | ||
v:surveyResponseReference as survey_response_reference, | ||
v:surveyReference as survey_reference | ||
from base_tpdm__survey_section_responses | ||
) | ||
|
||
select * from renamed |