From bd3e83d7753bd89d9c3b2bc7b2253145ace370c5 Mon Sep 17 00:00:00 2001 From: Graham Hukill Date: Mon, 6 Jan 2025 14:32:19 -0500 Subject: [PATCH] Remove end date as part of appointment unique key Why these changes are being introduced: An employee appointment's end date was used as part of its enduring unique key in Quickbase, but this was flawed. When an appointment ended, the end date was changed from 2999-12-31 to the actual end date, changing the unique key, and effectively leaving an extra row in Quickbase. How this addresses that need: Removing the end date as part of the employee appointment key is sufficient to make them enduringly unique. Side effects of this change: * This required dropping and recreating the Employee Appointments table via a manual run, but otherwise no changes. Relevant ticket(s): * None --- hrqb/tasks/employee_appointments.py | 3 --- hrqb/tasks/employee_leave.py | 1 - hrqb/tasks/employee_salary_history.py | 1 - tests/conftest.py | 2 +- tests/tasks/test_employee_appointments.py | 1 - 5 files changed, 1 insertion(+), 7 deletions(-) diff --git a/hrqb/tasks/employee_appointments.py b/hrqb/tasks/employee_appointments.py index 982b636..6a27230 100644 --- a/hrqb/tasks/employee_appointments.py +++ b/hrqb/tasks/employee_appointments.py @@ -104,7 +104,6 @@ def get_dataframe(self) -> pd.DataFrame: row.mit_id, row.position_id, row.appt_begin_date, - row.appt_end_date, ), axis=1, ) @@ -139,14 +138,12 @@ def generate_merge_key( mit_id: str, position_id: str, appt_begin_date: str, - appt_end_date: str, ) -> str: return md5_hash_from_values( [ mit_id, position_id, appt_begin_date, - appt_end_date, ] ) diff --git a/hrqb/tasks/employee_leave.py b/hrqb/tasks/employee_leave.py index a519966..17d40e6 100644 --- a/hrqb/tasks/employee_leave.py +++ b/hrqb/tasks/employee_leave.py @@ -56,7 +56,6 @@ def get_dataframe(self) -> pd.DataFrame: row.mit_id, row.position_id, row.appt_begin_date, - row.appt_end_date, ), axis=1, ) diff --git a/hrqb/tasks/employee_salary_history.py b/hrqb/tasks/employee_salary_history.py index b48212c..99f5c04 100644 --- a/hrqb/tasks/employee_salary_history.py +++ b/hrqb/tasks/employee_salary_history.py @@ -50,7 +50,6 @@ def get_dataframe(self) -> pd.DataFrame: row.mit_id, row.position_id, row.appt_begin_date, - row.appt_end_date, ), axis=1, ) diff --git a/tests/conftest.py b/tests/conftest.py index 1584b08..3858de0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -790,7 +790,7 @@ def task_shared_extract_qb_employee_appointments_complete(all_tasks_pipeline_nam "Related Employee Type": "Admin Staff", "Union Name": "Le Union", "Exempt / NE": "E", - "Key": "868ce513323c5391ae8afaa0ceb70c69", + "Key": "00f6099d6777bd9b6985bf86eeb3e449", } ] ) diff --git a/tests/tasks/test_employee_appointments.py b/tests/tasks/test_employee_appointments.py index d035ac8..7123be9 100644 --- a/tests/tasks/test_employee_appointments.py +++ b/tests/tasks/test_employee_appointments.py @@ -102,6 +102,5 @@ def test_task_transform_employee_appointments_key_expected_from_row_data( row["MIT ID"], row["Position ID"], row["Begin Date"], - row["End Date"], ] )