Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HRQB 35 - Generated Performance Review records from Employee Appointments #67

Merged
merged 3 commits into from
Jun 18, 2024

Conversation

ghukill
Copy link
Collaborator

@ghukill ghukill commented Jun 17, 2024

Purpose and background context

This PR adds ETL tasks to generate Performance Reviews records. These records do not contain the actual review, only the placeholder record in Quickbase that HR will manually complete.

Reviews come in three types:

  • 3 month review
  • 6 month review
  • Annual review: yearly after appointment begins

There is a bit of logic to skip annual reviews if they overlap with a 3 or 6 month review.

Additionally included in this PR is an added ability for the Quickbase client QBClient to delete records from a table (commit). As noted in the commit message, deletes are difficult in Quickbase. Mostly for good reason, this can hamper development where sometimes it's required to clear the table. This functionality should be exercised with caution as we move into production, but is generally quite safe given its functionality is not exposed via the CLI or any ETL tasks; only direct command line invocation can utilize it.

How can a reviewer manually see the effects of these changes?

As per usual, the only way to verify these changes at the moment are through the tests added.

Includes new or updated dependencies?

NO

Changes expectations for external applications?

NO

What are the relevant tickets?

Developer

  • All new ENV is documented in README
  • All new ENV has been added to staging and production environments
  • All related Jira tickets are linked in commit message(s)
  • Stakeholder approval has been confirmed (or is not needed)

Code Reviewer(s)

  • The commit message is clear and follows our guidelines (not just this PR message)
  • There are appropriate tests covering any new functionality
  • The provided documentation is sufficient for understanding any new functionality introduced
  • Any manual tests have been performed or provided examples verified
  • New dependencies are appropriate or there were no changes

ghukill added 2 commits June 17, 2024 13:48
Why these changes are being introduced:

For development, it is sometimes required that some or all records from a QB
table are deleted.  This is strangely not trivial in QB.  Paginated deletes in
the GUI are slow and time consuming, and the API requires a somewhat cryptic
query payload.  A testable, normalized way of deleting records is helpful.

How this addresses that need:
* QBClient gets two new methods, delete_records() and
delete_all_table_records()

Side effects of this change:
* None

Relevant ticket(s):
* None
Why these changes are being introduced:

Performance Reviews in Quickbase are based on Employee Appointments.  They
should be dynamically generated in the types of 3 month, 6 month, and
annual reviews.  This HRQBClient is responsible for making the performance
review record, but NOT the outcome of the review; this is manually filled in
by HR.

How this addresses that need:
* Adds new ETL tasks for Performance Reviews and Years (lookup table)

Side effects of this change:
* Performance Reviews loaded

Relevant ticket(s):
* https://mitlibraries.atlassian.net/browse/HRQB-35
@ghukill ghukill requested a review from ehanson8 June 17, 2024 19:22
return years_df[fields.keys()].rename(columns=fields)


class LoadYears(QuickbaseUpsertTask):
Copy link
Collaborator Author

@ghukill ghukill Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a little unusual that Quickbase has a table dedicated to just years... but that's how it was setup. This Load task ensures that all years from the Performance Reviews ETL tasks that will get written, have a value in the lookup table Years.

Copy link

@ehanson8 ehanson8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, one optional suggestion!

"""

def convert_to_date(
value: Any, # noqa: ANN401

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to do str | int | datetime.datetime | pd.Timestamp?

Copy link
Collaborator Author

@ghukill ghukill Jun 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a great call. I've updated to (commit):

value: str | datetime.datetime | pd.Timestamp,

The advantage here is that these are the expected types, which will get handled by logic arms, but if we get an oddball type, it'll just return None. In that way, the type hinting helps understand what it can/should handle. Thanks for the suggestion!

@ehanson8
Copy link

@ghukill Looks great!

@ghukill ghukill merged commit 9320bf7 into main Jun 18, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants