-
Notifications
You must be signed in to change notification settings - Fork 0
Ensy 430 patronload preferred names project update patron load app #157
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
Ensy 430 patronload preferred names project update patron load app #157
Conversation
Our data warehouse tables were updated with new fields for legal and preferred names for both staff and students. * updates BD query to pull in new legal name and preferred name fields * moves name mapping logic to populate_common_fields * updates tests and fixtures, notably using different names in staff and student fixtures * removes logic and associated tests to parse comma-separated staff names because now we are getting staff names in separate fields
libaio1 is no longer available Updated the Dockerfile to install libaio1t64 instead, which provides the same shared library needed by the Oracle Instant Client.
-removes fall back to legal name -updates tests and fixtures
- adds logic to compare legal and preferred names, only populating preferred name fields if they differ from the corresponding legal name field - updates tests
ehanson8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran in stage and observed the new fields in the file, great work!
patronload/patron.py
Outdated
| patron_template.pref_middle_name.string = ( # type: ignore[union-attr] | ||
| patron_dict["PREFERRED_MIDDLE_NAME"] or "" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this field rarely gets used but why does this break from the pattern of or patron_dict["LEGAL_MIDDLE_NAME"] or ""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregard, I saw this changed in a later commit
| for part in ["FIRST", "MIDDLE", "LAST"]: | ||
| pref = (patron_dict.get(f"PREFERRED_{part}_NAME") or "").strip() | ||
| legal = (patron_dict.get(f"LEGAL_{part}_NAME") or "").strip() | ||
|
|
||
| # Assign legal name | ||
| getattr(patron_template, f"{part.lower()}_name").string = legal | ||
|
|
||
| # Compare case-insensitively; assign only if different | ||
| getattr(patron_template, f"pref_{part.lower()}_name").string = ( | ||
| pref if pref.lower() != legal.lower() and pref else "" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent way to avoid repetition!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seconded.
| COPY vendor/instantclient-basiclite-linux.x64-21.9.0.0.0dbru.zip / | ||
| RUN unzip -j instantclient-basiclite-linux.x64-21.9.0.0.0dbru.zip -d /opt/lib/ | ||
| RUN apt-get install -y unzip libaio1t64 | ||
| RUN ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/libaio.so.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad this updated package worked!
| for part in ["FIRST", "MIDDLE", "LAST"]: | ||
| pref = (patron_dict.get(f"PREFERRED_{part}_NAME") or "").strip() | ||
| legal = (patron_dict.get(f"LEGAL_{part}_NAME") or "").strip() | ||
|
|
||
| # Assign legal name | ||
| getattr(patron_template, f"{part.lower()}_name").string = legal | ||
|
|
||
| # Compare case-insensitively; assign only if different | ||
| getattr(patron_template, f"pref_{part.lower()}_name").string = ( | ||
| pref if pref.lower() != legal.lower() and pref else "" | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seconded.
Purpose and background context
We want to add preferred names to the set of columns we pull in from the data warehouse to populate alma patron records.
In the data warehouse tables the app pulls from, columns for legal and preferred first, middle, and last names were added for us.
Because we now have parallel name columns in the student and employee tables, that mapping could be moved out of the student and employee mapping functions and into to the populate_common_fields function
In the DW tables, the preferred first and last name columns are always populated. If no preferred first or last name was specified by a user, the legal name is used to populate preferred name column in the table
We didn't want to populate preferred name fields in alma unless they were different than the legal name, so logic was added to compare the legal name with the corresponding preferred name column and only populate the preferred name field(s) in the Alma xml input file when they differ.
How can a reviewer manually see the effects of these changes?
Includes new or updated dependencies?
YES, we needed to update the libaio1 library to use libaio1t64
see 8adcfc6
Changes expectations for external applications?
NO - No changes to Alma or Primo are required
What are the relevant tickets?
https://mitlibraries.atlassian.net/browse/ENSY-430
Developer
Code Reviewer(s)