diff --git a/models/staging/edfi_3/base/_edfi_3__base.yml b/models/staging/edfi_3/base/_edfi_3__base.yml index 50f4ff4..a7ef6cf 100644 --- a/models/staging/edfi_3/base/_edfi_3__base.yml +++ b/models/staging/edfi_3/base/_edfi_3__base.yml @@ -76,9 +76,27 @@ models: config: tags: ['assessment'] enabled: "{{ var('src:domain:assessment:enabled', True) }}" + - name: base_ef3__open_staff_positions + config: + tags: ['core'] + - name: base_ef3__organization_departments + config: + tags: ['core'] - name: base_ef3__parents config: tags: ['core'] + - name: base_ef3__payrolls + config: + tags: ['core'] + - name: base_ef3__post_secondary_events + config: + tags: ['core'] + - name: base_ef3__report_cards + config: + tags: ['core'] + - name: base_ef3__restraint_events + config: + tags: ['core'] - name: base_ef3__programs config: tags: ['core'] diff --git a/models/staging/edfi_3/base/base_ef3__open_staff_positions.sql b/models/staging/edfi_3/base/base_ef3__open_staff_positions.sql new file mode 100644 index 0000000..ceeeee9 --- /dev/null +++ b/models/staging/edfi_3/base/base_ef3__open_staff_positions.sql @@ -0,0 +1,37 @@ +with open_staff_positions as ( + {{ source_edfi3('open_staff_positions') }} +), +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:positionTitle::string as position_title, + v:requisitionNumber::string as requisition_number, + v:datePosted::date as date_posted, + v:datePostingRemoved::date as date_posting_removed, + case + when array_size(v:academicSubjects) > 1 + then False + else True + end as is_single_subject_identifier, + -- descriptors + {{ extract_descriptor('v:employmentStatusDescriptor::string') }} as employment_status, + {{ extract_descriptor('v:staffClassificationDescriptor::string') }} as staff_classification, + {{ extract_descriptor('v:programAssignmentDescriptor::string') }} as program_assignment, + {{ extract_descriptor('v:postingResultDescriptor::string') }} as posting_result, + -- references + v:educationOrganizationReference as education_organization, + -- unflattened lists + v:academicSubjects as v_academic_subjects, + v:instructionalGradeLevels as v_instructional_grade_levels + from open_staff_positions +) +select * from renamed diff --git a/models/staging/edfi_3/base/base_ef3__organization_departments.sql b/models/staging/edfi_3/base/base_ef3__organization_departments.sql new file mode 100644 index 0000000..883559f --- /dev/null +++ b/models/staging/edfi_3/base/base_ef3__organization_departments.sql @@ -0,0 +1,34 @@ +with organization_departments as ( + {{ source_edfi3('organization_departments') }} +), +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:parentEducationOrganizationReference:educationOrganizationId::int as ed_org_id, + v:organizationDepartmentId::int as ed_org_department_id, + v:nameOfInstitution::int as name_of_institution, + v:shortNameOfInstitution::int as short_name_of_institution, + v:webSite::int as web_site, + -- descriptors + {{ extract_descriptor('v:academicSubjectDescriptor::string') }} as academic_subject, + {{ extract_descriptor('v:operationalStatusDescriptor::string') }} as operational_status, + --references + v:parentEducationOrganizationReference as education_organization, + -- unflattened lists + v:categories as v_categories, + v:addresses as v_addresses, + v:identificationCodes as v_identification_codes, + v:indicators as v_indicators, + v:institutionTelephones as v_institution_telephones, + v:internationalAddresses as v_international_addresses + from organization_departments +) +select * from renamed diff --git a/models/staging/edfi_3/base/base_ef3__payrolls.sql b/models/staging/edfi_3/base/base_ef3__payrolls.sql new file mode 100644 index 0000000..ddf753e --- /dev/null +++ b/models/staging/edfi_3/base/base_ef3__payrolls.sql @@ -0,0 +1,25 @@ +with payrolls as ( + {{ source_edfi3('payrolls') }} +), +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:accountReference:educationOrganizationId::int as ed_org_id, + v:accountReference:accountIdentifier::string as account_id, + v:staffReference:staffUniqueId::string as staff_unique_id, + v:asOfDate::date as as_of_date, + v:amountToDate::int as amount_to_date, + -- references + v:accountReference as account, + v:staffReference as staff + from payrolls +) +select * from renamed diff --git a/models/staging/edfi_3/base/base_ef3__post_secondary_events.sql b/models/staging/edfi_3/base/base_ef3__post_secondary_events.sql new file mode 100644 index 0000000..c7126bf --- /dev/null +++ b/models/staging/edfi_3/base/base_ef3__post_secondary_events.sql @@ -0,0 +1,25 @@ +with post_secondary_events as ( + {{ source_edfi3('post_secondary_events') }} +), +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:postSecondaryInstitutionReference:postSecondaryInstitutionId::int as post_secondary_institution_id, + v:studentReference:studentUniqueId::int as student_unique_id, + v:eventDate::date as event_date, + -- descriptors + {{ extract_descriptor('v:postSecondaryEventCategoryDescriptor::string') }} as post_secondary_event_category, + -- references + v:postSecondaryInstitutionReference as post_secondary_institution, + v:studentReference as student + from post_secondary_events +) +select * from renamed diff --git a/models/staging/edfi_3/base/base_ef3__report_cards.sql b/models/staging/edfi_3/base/base_ef3__report_cards.sql new file mode 100644 index 0000000..822a6d9 --- /dev/null +++ b/models/staging/edfi_3/base/base_ef3__report_cards.sql @@ -0,0 +1,33 @@ +with report_cards as ( + {{ source_edfi3('report_cards') }} +), +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:studentReference:studentUniqueId::int as student_unique_id, + v:gpaCumulative::int as gpa_cumulative, + v:gpaGivenGradingPeriod::int as gpa_given_grading_period, + v:numberOfDaysAbsent::int as number_of_days_absent, + v:numberOfDaysInAttendance::int as number_of_days_in_attendance, + v:numberOfDaysTardy::int as number_of_days_tardy, + -- references + v:gradingPeriodReference as grading_period + v:studentReference as student + v:educationOrganizationReference as education_organization_reference + -- unflattened lists + v:gradePointAverages as v_grade_point_averages, + v:grades as v_grades, + v:studentCompetencyObjectives as v_student_competency_objectives, + v:studentLearningObjectives as v_student_learning_objectives + from report_cards +) +select * from renamed diff --git a/models/staging/edfi_3/base/base_ef3__restraint_events.sql b/models/staging/edfi_3/base/base_ef3__restraint_events.sql new file mode 100644 index 0000000..dbb7ac5 --- /dev/null +++ b/models/staging/edfi_3/base/base_ef3__restraint_events.sql @@ -0,0 +1,29 @@ +with restraint_events as ( + {{ source_edfi3('restraint_events') }} +), +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:restraintEventIdentifier::string as record_guid, + v:schoolReference:schoolId::int as school_id, + v:studentReference:studentUniqueId::string as student_unique_id, + v:eventDate::date as event_date, + -- descriptors + {{ extract_descriptor('v:educationalEnvironmentDescriptor::string')}} as educational_environment, + -- references + v:schoolReference as school + v:studentReference as student + -- unflattened lists + v:programs as v_programs + v:reasons as v_reasons + from restraint_events +) +select * from renamed