-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #597 from TEAMSchools/renewal_feed
renewal feed setup
- Loading branch information
Showing
2 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/dbt/kipptaf/models/extracts/tableau/rpt_tableau__staff_renewal_feed.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,54 @@ | ||
with | ||
pm_scores as ( | ||
select | ||
safe_cast(internal_id as int) as internal_id, | ||
avg(overall_score) as pm4_overall_score, | ||
from {{ ref("int_performance_management__observation_details") }} | ||
where | ||
academic_year = {{ var("current_academic_year") }} | ||
and overall_score is not null | ||
and form_term in ('PM2', 'PM3') | ||
group by internal_id | ||
) | ||
|
||
select | ||
b.employee_number as df_employee_number, | ||
b.legal_name_given_name as first_name, | ||
b.legal_name_family_name as last_name, | ||
b.preferred_name_given_name as preferred_first, | ||
b.preferred_name_family_name as preferred_last, | ||
b.preferred_name_lastfirst as preferred_name, | ||
b.business_unit_home_name as legal_entity_name, | ||
b.home_work_location_name as location_description, | ||
b.department_home_name as home_department_description, | ||
b.job_title as job_title_description, | ||
b.assignment_status as position_status, | ||
b.worker_original_hire_date as original_hire_date, | ||
b.worker_rehire_date as rehire_date, | ||
b.worker_termination_date as termination_date, | ||
b.worker_type as worker_category_description, | ||
b.worker_group_value as benefits_eligibility_class_description, | ||
b.wage_law_coverage_short_name as flsa_description, | ||
b.ethnicity_long_name as eeo_ethnic_description, | ||
b.mail as mail, | ||
b.user_principal_name as userprincipalname, | ||
b.report_to_employee_number as manager_df_employee_number, | ||
b.report_to_preferred_name_lastfirst as manager_name, | ||
b.report_to_mail as manager_mail, | ||
b.race_ethnicity_reporting, | ||
b.gender_identity, | ||
b.primary_grade_level_taught, | ||
b.base_remuneration_annual_rate_amount_amount_value as base_salary, | ||
|
||
s.salary_rule, | ||
s.scale_cy_salary, | ||
s.scale_ny_salary, | ||
s.scale_step, | ||
|
||
p.pm4_overall_score, | ||
from {{ ref("base_people__staff_roster") }} as b | ||
left join | ||
{{ ref("int_people__expected_next_year_salary") }} as s | ||
on b.employee_number = s.employee_number | ||
left join pm_scores as p on b.employee_number = p.internal_id | ||
where b.assignment_status not in ('Terminated', 'Deceased') |
26 changes: 26 additions & 0 deletions
26
src/dbt/kipptaf/models/people/intermediate/int_people__expected_next_year_salary.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 @@ | ||
select | ||
sr.employee_number, | ||
sr.job_title, | ||
sr.base_remuneration_annual_rate_amount_amount_value, | ||
|
||
pss.scale_cy_salary, | ||
pss.scale_ny_salary, | ||
pss.scale_step, | ||
|
||
case | ||
when pss.salary_rule is not null | ||
then pss.salary_rule | ||
when sr.job_title in ('Teacher', 'Teacher ESL', 'Learrning Specialist') | ||
then concat('Teacher PM - ', sr.business_unit_assigned_code) | ||
else 'Annual Adjustment' | ||
end as salary_rule, | ||
from {{ ref("base_people__staff_roster") }} as sr | ||
left join | ||
{{ ref("stg_people__salary_scale") }} as pss | ||
on sr.job_title = pss.job_title | ||
and sr.business_unit_assigned_name = pss.region | ||
and sr.home_work_location_grade_band | ||
= coalesce(pss.school_level, sr.home_work_location_grade_band) | ||
and (sr.base_remuneration_annual_rate_amount_amount_value + 150) | ||
between pss.scale_cy_salary and (pss.scale_ny_salary + 0.01) | ||
where sr.assignment_status not in ('Terminated', 'Deceased') |