Skip to content
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

Create base/stage models (iteration) #10

Merged
merged 12 commits into from
Aug 1, 2024
3 changes: 3 additions & 0 deletions models/staging/edfi_3/base/_edfi_3__base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,6 @@ models:
- name: base_ef3__survey_section_responses
config:
tags: ['survey']
- name: base_ef3__peoples
config:
tags: ['core']
20 changes: 20 additions & 0 deletions models/staging/edfi_3/base/base_ef3__peoples.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
with peoples as (
zaharenka marked this conversation as resolved.
Show resolved Hide resolved
{{ source_edfi3('peoples') }}
),
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:personId::int as person_id,
-- descriptors
{{ extract_descriptor('v:sourceSystemDescriptor::string') }} as source_system
from peoples
)
select * from renamed
39 changes: 39 additions & 0 deletions models/staging/tpdm/base/_tpdm__base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,42 @@ models:
- name: base_tpdm__evaluation_element_ratings
config:
tags: ['tpdm']
- name: base_tpdm__applicant_profiles
config:
tags: ['tpdm']
- name: base_tpdm__applications
config:
tags: ['tpdm']
- name: base_tpdm__candidate_relationship_to_staff_associations
config:
tags: ['tpdm']
- name: base_tpdm__certification_exam_results
config:
tags: ['tpdm']
- name: base_tpdm__certification_exams
config:
tags: ['tpdm']
- name: base_tpdm__certifications
config:
tags: ['tpdm']
- name: base_tpdm__fieldwork_experiences
config:
tags: ['tpdm']
- name: base_tpdm__survey_response_education_organization_target_associations
config:
tags: ['tpdm']
- name:
config:
tags: ['tpdm']
- name:
config:
tags: ['tpdm']
- name:
config:
tags: ['tpdm']
- name:
config:
tags: ['tpdm']
- name:
config:
tags: ['tpdm']
38 changes: 38 additions & 0 deletions models/staging/tpdm/base/base_tpdm__applicant_profiles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
with applicant_profiles as (
{{ source_edfi3('applicant_profiles') }}
),
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:applicantProfileIdentifier::string as applicant_profile_id,
v:firstName::string as first_name,
v:lastSurname::string as last_name,
-- descriptors
{{ extract_descriptor('v:sexDescriptor::string') }} as sex,
-- unnested lists
v:addresses as v_addresses,
v:applicantCharacteristics as v_applicant_characteristics,
v:backgroundChecks as v_background_checks,
v:disabilities as v_disabilities,
v:educatorPreparationProgramNames as v_educator_preparation_program_names,
v:electronicMails as v_electronic_mails,
v:gradePointAverages as v_grade_point_averages,
v:highlyQualifiedAcademicSubjects as v_highly_qualified_academic_subjects,
v:identificationDocuments as v_identification_documents,
v:internationalAddresses as v_international_addresses,
v:languages as v_languages,
v:personalIdentificationDocuments as v_personal_identification_documents,
v:races as v_races,
v:telephones as v_telephones,
v:visas as v_visas
from applicant_profiles
)
select * from renamed
32 changes: 32 additions & 0 deletions models/staging/tpdm/base/base_tpdm__applications.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
with applications as (
{{ source_edfi3('applications') }}
),
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:applicationIdentifier::string as application_id,
v:applicantProfileReference:applicantProfileIdentifier::string as applicant_id,
v:educationOrganizationReference:educationOrganizationId::int as ed_org_id,
v:educationOrganizationReference:link:rel::string as ed_org_type,
v:acceptedDate::date as accepted_date,
v:applicationDate::date as application_date,
-- descriptors
{{ extract_descriptor('v:applicationStatusDescriptor::string') }} as application_status,
-- references
v:applicantProfileReference as applicant_profile_reference,
v:educationOrganizationReference as education_organization_reference,
-- unnested lists
v:recruitmentEventAttendances as v_recruitment_event_attendances,
v:scoreResults as v_score_results,
v:terms as v_terms
from applications
)
select * from renamed
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
with base_tpdm__candidate_relationship_to_staff_associations as (
{{ source_edfi3('base_tpdm__candidate_relationship_to_staff_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:staffReference:staffUniqueId::string as staff_unique_id,
v:beginDate::date as begin_date,
-- descriptors
{{ extract_descriptor('v:staffToCandidateRelationshipDescriptor::string') }} as staff_to_candidate_relationship,
-- references
v:candidateReference as candidate_reference,
v:staffReference as staff_reference
from base_tpdm__candidate_relationship_to_staff_associations
)
select * from renamed
27 changes: 27 additions & 0 deletions models/staging/tpdm/base/base_tpdm__certification_exam_results.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
with certification_exam_results as (
{{ source_edfi3('certification_exam_results') }}
),
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:certificationExamReference:certificationExamIdentifier::string as certification_exam_id,
v:personReference:personId::string as person_id,
v:certificationExamDate::date as certification_exam_date,
v:attemptNumber::int as attempt_number,
v:certificationExamPassIndicator::boolean as certification_exam_pass_indicator,
-- descriptors
{{ extract_descriptor('v:personReference:sourceSystemDescriptor::string') }} as person_source_system_descriptor,
-- references
v:certificationExamReference as certification_exam_reference,
v:personReference as person_reference
from certification_exam_results
)
select * from renamed
24 changes: 24 additions & 0 deletions models/staging/tpdm/base/base_tpdm__certification_exams.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
with certification_exams as (
{{ source_edfi3('certification_exams') }}
),
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:certificationExamIdentifier::string as certification_exam_id,
v:namespace::string as namespace,
v:certificationExamTitle::string as certification_exam_title,
v:effectiveDate::date as effective_date,
v:endDate::date as end_date,
-- descriptors
{{ extract_descriptor('v:certificationExamTypeDescriptor::string') }} as certification_exam_type
from certification_exams
)
select * from renamed
32 changes: 32 additions & 0 deletions models/staging/tpdm/base/base_tpdm__certifications.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
with certifications as (
{{ source_edfi3('certifications') }}
),
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:certificationIdentifier::string as certification_id,
v:namespace::string as namespace,
v:certificationTitle::string as certification_title,
-- descriptors
{{ extract_descriptor('v:certificationFieldDescriptor::string') }} as certification_field,
{{ extract_descriptor('v:certificationLevelDescriptor::string') }} as certification_level,
{{ extract_descriptor('v:certificationStandardDescriptor::string') }} as certification_standard,
{{ extract_descriptor('v:educatorRoleDescriptor::string') }} as educator_role,
{{ extract_descriptor('v:instructionalSettingDescriptor::string') }} as instructional_setting,
{{ extract_descriptor('v:minimumDegreeDescriptor::string') }} as minimum_degree,
{{ extract_descriptor('v:populationServedDescriptor::string') }} as population_served,
-- unnested lists
v:certificationExams as v_certification_exams,
v:gradeLevels as v_grade_levels,
v:routes as v_routes
from certifications
)
select * from renamed
28 changes: 28 additions & 0 deletions models/staging/tpdm/base/base_tpdm__fieldwork_experiences.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
with fieldwork_experiences as (
{{ source_edfi3('fieldwork_experiences') }}
),
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:fieldworkIdentifier::string as fieldwork_id,
v:educatorPreparationProgramReference:educationOrganizationId::int as ed_org_id,
v:educatorPreparationProgramReference:link:rel::string as ed_org_type,
v:studentReference:studentUniqueId::string as student_id,
v:beginDate::date as begin_date,
v:endDate::date as end_date,
-- descriptors
{{ extract_descriptor('v:fieldworkTypeDescriptor::string') }} as fieldwork_type,
-- references
v:educatorPreparationProgramReference as educator_preparation_program_reference,
v:studentReference as student_reference
from fieldwork_experiences
)
select * from renamed
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
with survey_response_education_organization_target_associations as (
{{ source_edfi3('survey_response_education_organization_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:educationOrganizationReference:educationOrganizationId::int as ed_org_id,
v:educationOrganizationReference:link:rel::string as ed_org_type,
v:surveyResponseReference:surveyIdentifier::string as survey_id,
v:surveyResponseReference:surveyResponseIdentifier::string as survey_response_id,
-- references
v:educationOrganizationReference as education_organization_reference,
v:surveyResponseReference as survey_response_reference
from survey_education_organization_responses
)
select * from renamed