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.
feature: create base tpdm/edfi_3 models iteration 2
- Loading branch information
Vasili Zakharko
committed
Jul 24, 2024
1 parent
aad2a1e
commit b27fdcf
Showing
33 changed files
with
823 additions
and
67 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
models/staging/edfi_3/base/base_ef3__school_year_types.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,21 @@ | ||
with school_year_types as ( | ||
{{ source_edfi3('school_year_types') }} | ||
), | ||
renamed as ( | ||
select | ||
tenant_code, | ||
api_year, | ||
pull_timestamp, | ||
last_modified_timestamp, | ||
filename, | ||
file_row_number, | ||
is_deleted, | ||
|
||
v:id::string as record_guid, | ||
v:schoolYear::string as school_year, | ||
v:currentSchoolYear::string as current_school_year, | ||
v:schoolYearDescription::string as school_year_description | ||
|
||
from school_year_types | ||
) | ||
select * from renamed |
37 changes: 37 additions & 0 deletions
37
models/staging/edfi_3/base/base_ef3__section_attendance_taken_events.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,37 @@ | ||
with section_attendance_taken_events as ( | ||
{{ source_edfi3('section_attendance_taken_events') }} | ||
), | ||
renamed as ( | ||
select | ||
tenant_code, | ||
api_year, | ||
pull_timestamp, | ||
last_modified_timestamp, | ||
filename, | ||
file_row_number, | ||
is_deleted, | ||
|
||
v:id::string as record_guid, | ||
-- fields | ||
v:eventDate::string as event_date, | ||
-- calendar date key | ||
v:calendarDateReference:calendarCode::string as calendar_date_local_course_code, | ||
v:calendarDateReference:date::date as calendar_date_date, | ||
v:calendarDateReference:schoolId::int as calendar_date_school_id, | ||
v:calendarDateReference:schoolYear::int as calendar_date_school_year, | ||
-- section key | ||
v:sectionReference:localCourseCode::string as local_course_code, | ||
v:sectionReference:schoolId::int as school_id, | ||
v:sectionReference:schoolYear::int as school_year, | ||
v:sectionReference:sectionIdentifier::string as section_id, | ||
v:sectionReference:sessionName::string as session_name, | ||
-- staff key | ||
v:staffReference:staffUniqueId::string as staff_unique_id, | ||
-- references | ||
v:calendarDateReference as calendar_date_reference, | ||
v:sectionReference as section_reference, | ||
v:staffReference as staff_reference | ||
|
||
from section_attendance_taken_events | ||
) | ||
select * from renamed |
26 changes: 26 additions & 0 deletions
26
models/staging/edfi_3/base/base_ef3__staff_absence_events.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 staff_absence_events as ( | ||
{{ source_edfi3('staff_absence_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:eventDate::date as event_date, | ||
v:absenceEventReason::string as absence_event_reason, | ||
v:hoursAbsent::integer as hours_absent, | ||
v:staffReference:staffUniqueId::integer as staff_unique_id, | ||
-- descriptors | ||
{{ extract_descriptor('v:absenceEventCategoryDescriptor::string') }} as absence_event_category, | ||
-- references | ||
v:staffReference as school_reference | ||
|
||
from staff_absence_events | ||
) | ||
select * from renamed |
27 changes: 27 additions & 0 deletions
27
models/staging/edfi_3/base/base_ef3__staff_cohort_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,27 @@ | ||
with staff_cohort_associations as ( | ||
{{ source_edfi3('staff_cohort_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:beginDate::date as begin_date, | ||
v:endDate::date as end_date, | ||
v:studentRecordAccess::boolean as student_record_access, | ||
v:staffReference:staffUniqueId::integer as staff_unique_id, | ||
v:cohortReference:cohortIdentifier::string as cohort_dentifier, | ||
v:cohortReference:educationOrganizationId::integer as education_organization_id, | ||
-- references | ||
v:cohortReference as cohort_reference, | ||
v:staffReference as staff_reference | ||
|
||
from staff_cohort_associations | ||
) | ||
select * from renamed |
25 changes: 25 additions & 0 deletions
25
models/staging/edfi_3/base/base_ef3__staff_discipline_incident_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,25 @@ | ||
with staff_discipline_incident_associations as ( | ||
{{ source_edfi3('staff_discipline_incident_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:disciplineIncidentParticipationCodes:disciplineIncidentParticipationCodeDescriptor::string as discipline_incident_participation_code_descriptor, | ||
v:staffReference:staffUniqueId::integer as staff_unique_id, | ||
v:disciplineIncidentReference:incidentIdentifier::string as incident_identifier, | ||
v:disciplineIncidentReference:schoolId::integer as school_id, | ||
-- references | ||
v:disciplineIncidentReference as discipline_incident_reference, | ||
v:staffReference as staff_reference | ||
|
||
from staff_discipline_incident_associations | ||
) | ||
select * from renamed |
71 changes: 71 additions & 0 deletions
71
models/staging/edfi_3/base/base_ef3__staff_education_organization_contact_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,71 @@ | ||
with staff_education_organization_contact_associations as ( | ||
{{ source_edfi3('staff_education_organization_contact_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:contactTitle::string as contact_title, | ||
v:contactTypeDescriptor::string as contact_type_descriptor, | ||
v:electronicMailAddress::string as electronic_mail_address, | ||
|
||
v:address:addressTypeDescriptor::string as address_type_descriptor, | ||
v:address:localeDescriptor::string as address_locale_descriptor, | ||
v:address:stateAbbreviationDescriptor::string as address_state_abbreviation_descriptor, | ||
v:address:apartmentRoomSuiteNumber::string as address_apartment_room_suite_number, | ||
v:address:buildingSiteNumber::string as address_building_site_number, | ||
v:address:city::string as address_city, | ||
v:address:congressionalDistrict::string as address_congressional_district, | ||
v:address:countyFIPSCode::string as address_county_fips_code, | ||
v:address:doNotPublishIndicator::boolean as is_address_do_not_publish_indicator, | ||
v:address:latitude::string as address_latitude, | ||
v:address:longitude::string as address_longitude, | ||
v:address:nameOfCounty::string as address_name_of_county, | ||
v:address:postalCode::string as address_postal_code, | ||
v:address:streetNumberName::string as address_street_number_name, | ||
|
||
v:educationOrganizationReference:educationOrganizationId::integer as ed_org_id, | ||
v:staffReference:staffUniqueId::integer as staff_unique_id, | ||
-- lists | ||
v:telephones as v_telephones, | ||
v:address:periods as v_address_periods, | ||
|
||
-- references | ||
v:educationOrganizationReference as educationOrganizationReference, | ||
v:staffReference as staff_reference | ||
|
||
from sessions | ||
) | ||
select * from renamed | ||
|
||
|
||
|
||
"address": { | ||
"addressTypeDescriptor": "string", | ||
"localeDescriptor": "string", | ||
"": "string", | ||
"": "string", | ||
"": "string", | ||
"": "string", | ||
"": "string", | ||
"": "string", | ||
"": true, | ||
"": "string", | ||
"": "string", | ||
"": "string", | ||
"": "string", | ||
"": "string", | ||
"periods": [ | ||
{ | ||
"beginDate": "2024-07-23", | ||
"endDate": "2024-07-23" | ||
} | ||
] | ||
}, |
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 staff_leaves as ( | ||
{{ source_edfi3('staff_leaves') }} | ||
), | ||
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:beginDate::date as begin_date, | ||
v:staffReference:staffUniqueId::string as staff_unique_id, | ||
v:endDate::date as end_date, | ||
v:reason::string as reason, | ||
v:substituteAssigned::boolean as is_substitute_assigned, | ||
-- descriptors | ||
{{ extract_descriptor('v:staffLeaveEventCategoryDescriptor') }} as staff_leave_event_ñategory, | ||
-- references | ||
v:staffReference as staff_reference | ||
|
||
from staff_leaves | ||
) | ||
select * from renamed |
28 changes: 28 additions & 0 deletions
28
models/staging/edfi_3/base/base_ef3__staff_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,28 @@ | ||
with staff_program_associations as ( | ||
{{ source_edfi3('staff_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:beginDate::date as begin_date, | ||
v:endDate::date as end_date, | ||
v:staffReference:staffUniqueId::string as staff_unique_id, | ||
v:programReference:educationOrganizationId::integer as education_organization_id, | ||
v:programReference:programName::string as program_name, | ||
v:programReference:programTypeDescriptor::string as program_type_descriptor, | ||
v:studentRecordAccess::boolean as is_studen_record_access, | ||
-- references | ||
v:programReference as program_reference, | ||
v:staffReference as staff_reference | ||
|
||
from staff_program_associations | ||
) | ||
select * from renamed |
38 changes: 38 additions & 0 deletions
38
models/staging/edfi_3/base/base_ef3__student_competency_objectives.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,38 @@ | ||
with student_competency_objectives as ( | ||
{{ source_edfi3('student_competency_objectives') }} | ||
), | ||
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:diagnosticStatement::string as diagnostic_statement, | ||
v:studentReference:studentUniqueId::string as student_unique_id, | ||
v:gradingPeriodReference:gradingPeriodDescriptor::integer as grading_period_descriptor, | ||
v:gradingPeriodReference:periodSequence::integer as period_sequence, | ||
v:gradingPeriodReference:schoolId::integer as school_id, | ||
v:gradingPeriodReference:schoolYear::integer as school_year, | ||
|
||
v:objectiveCompetencyObjectiveReference:educationOrganizationId::integer as education_organization_id, | ||
v:objectiveCompetencyObjectiveReference:objective::string as objective, | ||
v:objectiveCompetencyObjectiveReference:objectiveGradeLevelDescriptor::string as objective_grade_level_descriptor, | ||
-- descriptors | ||
{{ extract_descriptor('v:competencyLevelDescriptor::string') }} as competency_level, | ||
-- references | ||
v:studentReference as student_reference, | ||
v:gradingPeriodReference as grading_periodR_rference, | ||
-- lists | ||
v:generalStudentProgramAssociations as v_general_student_program_associations, | ||
v:studentSectionAssociations as v_student_section_associations, | ||
|
||
-- edfi extensions ???? | ||
v:_ext as v_ext | ||
|
||
from student_competency_objectives | ||
) | ||
select * from renamed |
47 changes: 47 additions & 0 deletions
47
models/staging/edfi_3/base/base_ef3__student_cte_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,47 @@ | ||
with student_cte_program_associations as ( | ||
{{ source_edfi3('student_cte_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:beginDate::date as begin_date, | ||
v:endDate::date as end_date, | ||
v:nonTraditionalGenderStatus::boolean as is_non_traditional_gender_status, | ||
v:privateCTEProgram::boolean as is_private_c_t_e_program, | ||
v:servedOutsideOfRegularSession::boolean as served_outside_of_regular_session, | ||
v:participationStatus:participationStatusDescriptor::string as participation_status_descriptor, | ||
v:participationStatus:designatedBy::string as designated_by | ||
v:participationStatus:statusBeginDate::date as status_begin_date | ||
v:participationStatus:statusEndDate::date as status_end_date, | ||
v:studentReference:studentUniqueId::string as student_unique_id, | ||
v:educationOrganizationReference:educationOrganizationId::integer as education_organization_id, | ||
v:programReference:educationOrganizationId::integer as education_organization_id | ||
v:programReference:programName::integer as program_name | ||
v:programReference:programTypeDescriptor::integer as program_type_descriptor | ||
-- descriptor | ||
{{ extract_descriptor('v:reasonExitedDescriptor::string') }} as reason_exited, | ||
{{ extract_descriptor('v:technicalSkillsAssessmentDescriptor::string') }} as technical_skills_assessment, | ||
-- references | ||
v:studentReference as student_reference, | ||
v:gradingPeriodReference as grading_period_reference, | ||
-- lists | ||
v:ctePrograms as v_cte_programs, | ||
v:cteProgramServices as v_cte_program_services, | ||
v:studentSectionAssociations as v_student_section_associations, | ||
v:programParticipationStatuses as v_programParticipationStatuses | ||
v:services as v_services, | ||
|
||
-- edfi extensions ???? | ||
v:_ext as v_ext | ||
|
||
from student_cte_program_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
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
Oops, something went wrong.