Skip to content

Commit b27fdcf

Browse files
author
Vasili Zakharko
committed
feature: create base tpdm/edfi_3 models iteration 2
1 parent aad2a1e commit b27fdcf

File tree

33 files changed

+823
-67
lines changed

33 files changed

+823
-67
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
with school_year_types as (
2+
{{ source_edfi3('school_year_types') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
filename,
11+
file_row_number,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
v:schoolYear::string as school_year,
16+
v:currentSchoolYear::string as current_school_year,
17+
v:schoolYearDescription::string as school_year_description
18+
19+
from school_year_types
20+
)
21+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
with section_attendance_taken_events as (
2+
{{ source_edfi3('section_attendance_taken_events') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
filename,
11+
file_row_number,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
-- fields
16+
v:eventDate::string as event_date,
17+
-- calendar date key
18+
v:calendarDateReference:calendarCode::string as calendar_date_local_course_code,
19+
v:calendarDateReference:date::date as calendar_date_date,
20+
v:calendarDateReference:schoolId::int as calendar_date_school_id,
21+
v:calendarDateReference:schoolYear::int as calendar_date_school_year,
22+
-- section key
23+
v:sectionReference:localCourseCode::string as local_course_code,
24+
v:sectionReference:schoolId::int as school_id,
25+
v:sectionReference:schoolYear::int as school_year,
26+
v:sectionReference:sectionIdentifier::string as section_id,
27+
v:sectionReference:sessionName::string as session_name,
28+
-- staff key
29+
v:staffReference:staffUniqueId::string as staff_unique_id,
30+
-- references
31+
v:calendarDateReference as calendar_date_reference,
32+
v:sectionReference as section_reference,
33+
v:staffReference as staff_reference
34+
35+
from section_attendance_taken_events
36+
)
37+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
with staff_absence_events as (
2+
{{ source_edfi3('staff_absence_events') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
v:eventDate::date as event_date,
16+
v:absenceEventReason::string as absence_event_reason,
17+
v:hoursAbsent::integer as hours_absent,
18+
v:staffReference:staffUniqueId::integer as staff_unique_id,
19+
-- descriptors
20+
{{ extract_descriptor('v:absenceEventCategoryDescriptor::string') }} as absence_event_category,
21+
-- references
22+
v:staffReference as school_reference
23+
24+
from staff_absence_events
25+
)
26+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
with staff_cohort_associations as (
2+
{{ source_edfi3('staff_cohort_associations') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
v:beginDate::date as begin_date,
16+
v:endDate::date as end_date,
17+
v:studentRecordAccess::boolean as student_record_access,
18+
v:staffReference:staffUniqueId::integer as staff_unique_id,
19+
v:cohortReference:cohortIdentifier::string as cohort_dentifier,
20+
v:cohortReference:educationOrganizationId::integer as education_organization_id,
21+
-- references
22+
v:cohortReference as cohort_reference,
23+
v:staffReference as staff_reference
24+
25+
from staff_cohort_associations
26+
)
27+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
with staff_discipline_incident_associations as (
2+
{{ source_edfi3('staff_discipline_incident_associations') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
v:disciplineIncidentParticipationCodes:disciplineIncidentParticipationCodeDescriptor::string as discipline_incident_participation_code_descriptor,
16+
v:staffReference:staffUniqueId::integer as staff_unique_id,
17+
v:disciplineIncidentReference:incidentIdentifier::string as incident_identifier,
18+
v:disciplineIncidentReference:schoolId::integer as school_id,
19+
-- references
20+
v:disciplineIncidentReference as discipline_incident_reference,
21+
v:staffReference as staff_reference
22+
23+
from staff_discipline_incident_associations
24+
)
25+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
with staff_education_organization_contact_associations as (
2+
{{ source_edfi3('staff_education_organization_contact_associations') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
v:contactTitle::string as contact_title,
16+
v:contactTypeDescriptor::string as contact_type_descriptor,
17+
v:electronicMailAddress::string as electronic_mail_address,
18+
19+
v:address:addressTypeDescriptor::string as address_type_descriptor,
20+
v:address:localeDescriptor::string as address_locale_descriptor,
21+
v:address:stateAbbreviationDescriptor::string as address_state_abbreviation_descriptor,
22+
v:address:apartmentRoomSuiteNumber::string as address_apartment_room_suite_number,
23+
v:address:buildingSiteNumber::string as address_building_site_number,
24+
v:address:city::string as address_city,
25+
v:address:congressionalDistrict::string as address_congressional_district,
26+
v:address:countyFIPSCode::string as address_county_fips_code,
27+
v:address:doNotPublishIndicator::boolean as is_address_do_not_publish_indicator,
28+
v:address:latitude::string as address_latitude,
29+
v:address:longitude::string as address_longitude,
30+
v:address:nameOfCounty::string as address_name_of_county,
31+
v:address:postalCode::string as address_postal_code,
32+
v:address:streetNumberName::string as address_street_number_name,
33+
34+
v:educationOrganizationReference:educationOrganizationId::integer as ed_org_id,
35+
v:staffReference:staffUniqueId::integer as staff_unique_id,
36+
-- lists
37+
v:telephones as v_telephones,
38+
v:address:periods as v_address_periods,
39+
40+
-- references
41+
v:educationOrganizationReference as educationOrganizationReference,
42+
v:staffReference as staff_reference
43+
44+
from sessions
45+
)
46+
select * from renamed
47+
48+
49+
50+
"address": {
51+
"addressTypeDescriptor": "string",
52+
"localeDescriptor": "string",
53+
"": "string",
54+
"": "string",
55+
"": "string",
56+
"": "string",
57+
"": "string",
58+
"": "string",
59+
"": true,
60+
"": "string",
61+
"": "string",
62+
"": "string",
63+
"": "string",
64+
"": "string",
65+
"periods": [
66+
{
67+
"beginDate": "2024-07-23",
68+
"endDate": "2024-07-23"
69+
}
70+
]
71+
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
with staff_leaves as (
2+
{{ source_edfi3('staff_leaves') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
v:beginDate::date as begin_date,
16+
v:staffReference:staffUniqueId::string as staff_unique_id,
17+
v:endDate::date as end_date,
18+
v:reason::string as reason,
19+
v:substituteAssigned::boolean as is_substitute_assigned,
20+
-- descriptors
21+
{{ extract_descriptor('v:staffLeaveEventCategoryDescriptor') }} as staff_leave_event_ñategory,
22+
-- references
23+
v:staffReference as staff_reference
24+
25+
from staff_leaves
26+
)
27+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
with staff_program_associations as (
2+
{{ source_edfi3('staff_program_associations') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
14+
v:id::string as record_guid,
15+
v:beginDate::date as begin_date,
16+
v:endDate::date as end_date,
17+
v:staffReference:staffUniqueId::string as staff_unique_id,
18+
v:programReference:educationOrganizationId::integer as education_organization_id,
19+
v:programReference:programName::string as program_name,
20+
v:programReference:programTypeDescriptor::string as program_type_descriptor,
21+
v:studentRecordAccess::boolean as is_studen_record_access,
22+
-- references
23+
v:programReference as program_reference,
24+
v:staffReference as staff_reference
25+
26+
from staff_program_associations
27+
)
28+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
with student_competency_objectives as (
2+
{{ source_edfi3('student_competency_objectives') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
v:id::string as record_guid,
14+
v:diagnosticStatement::string as diagnostic_statement,
15+
v:studentReference:studentUniqueId::string as student_unique_id,
16+
v:gradingPeriodReference:gradingPeriodDescriptor::integer as grading_period_descriptor,
17+
v:gradingPeriodReference:periodSequence::integer as period_sequence,
18+
v:gradingPeriodReference:schoolId::integer as school_id,
19+
v:gradingPeriodReference:schoolYear::integer as school_year,
20+
21+
v:objectiveCompetencyObjectiveReference:educationOrganizationId::integer as education_organization_id,
22+
v:objectiveCompetencyObjectiveReference:objective::string as objective,
23+
v:objectiveCompetencyObjectiveReference:objectiveGradeLevelDescriptor::string as objective_grade_level_descriptor,
24+
-- descriptors
25+
{{ extract_descriptor('v:competencyLevelDescriptor::string') }} as competency_level,
26+
-- references
27+
v:studentReference as student_reference,
28+
v:gradingPeriodReference as grading_periodR_rference,
29+
-- lists
30+
v:generalStudentProgramAssociations as v_general_student_program_associations,
31+
v:studentSectionAssociations as v_student_section_associations,
32+
33+
-- edfi extensions ????
34+
v:_ext as v_ext
35+
36+
from student_competency_objectives
37+
)
38+
select * from renamed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
with student_cte_program_associations as (
2+
{{ source_edfi3('student_cte_program_associations') }}
3+
),
4+
renamed as (
5+
select
6+
tenant_code,
7+
api_year,
8+
pull_timestamp,
9+
last_modified_timestamp,
10+
file_row_number,
11+
filename,
12+
is_deleted,
13+
v:id::string as record_guid,
14+
15+
v:beginDate::date as begin_date,
16+
v:endDate::date as end_date,
17+
v:nonTraditionalGenderStatus::boolean as is_non_traditional_gender_status,
18+
v:privateCTEProgram::boolean as is_private_c_t_e_program,
19+
v:servedOutsideOfRegularSession::boolean as served_outside_of_regular_session,
20+
v:participationStatus:participationStatusDescriptor::string as participation_status_descriptor,
21+
v:participationStatus:designatedBy::string as designated_by
22+
v:participationStatus:statusBeginDate::date as status_begin_date
23+
v:participationStatus:statusEndDate::date as status_end_date,
24+
v:studentReference:studentUniqueId::string as student_unique_id,
25+
v:educationOrganizationReference:educationOrganizationId::integer as education_organization_id,
26+
v:programReference:educationOrganizationId::integer as education_organization_id
27+
v:programReference:programName::integer as program_name
28+
v:programReference:programTypeDescriptor::integer as program_type_descriptor
29+
-- descriptor
30+
{{ extract_descriptor('v:reasonExitedDescriptor::string') }} as reason_exited,
31+
{{ extract_descriptor('v:technicalSkillsAssessmentDescriptor::string') }} as technical_skills_assessment,
32+
-- references
33+
v:studentReference as student_reference,
34+
v:gradingPeriodReference as grading_period_reference,
35+
-- lists
36+
v:ctePrograms as v_cte_programs,
37+
v:cteProgramServices as v_cte_program_services,
38+
v:studentSectionAssociations as v_student_section_associations,
39+
v:programParticipationStatuses as v_programParticipationStatuses
40+
v:services as v_services,
41+
42+
-- edfi extensions ????
43+
v:_ext as v_ext
44+
45+
from student_cte_program_associations
46+
)
47+
select * from renamed

models/staging/edfi_3/base/base_ef3__student_discipline_incident_behavior_associations.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ renamed as (
1919
{{ extract_descriptor('v:behaviorDescriptor::string') }} as behavior_type,
2020
-- references
2121
v:disciplineIncidentReference as discipline_incident_reference,
22-
v:studentReference as student_reference,
22+
v:studentReference as student_reference,
2323
-- lists
2424
v:disciplineIncidentParticipationCodes as v_discipline_incident_participation_codes,
2525

2626
-- edfi extensions
2727
v:_ext as v_ext
2828
from student_discipline_incident_behavior
2929
)
30-
select * from renamed
30+
select * from renamed

models/staging/edfi_3/base/base_ef3__student_discipline_incident_non_offender_associations.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ renamed as (
2424
v:_ext as v_ext
2525
from student_discipline_incident_nonoffender
2626
)
27-
select * from renamed
27+
select * from renamed

0 commit comments

Comments
 (0)