Skip to content

Conversation

@adamshire123
Copy link
Contributor

@adamshire123 adamshire123 commented Oct 24, 2025

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?

  • Follow the steps in the README to produce a new set of input files in our stage environment.
  • look at the student file and note that preferred names are populated but only when they differ from legal names

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

  • 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 and verified
  • New dependencies are appropriate or there were no changes

adamshire123 and others added 7 commits October 20, 2025 14:14
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
@adamshire123 adamshire123 requested a review from a team as a code owner October 24, 2025 20:24
@adamshire123 adamshire123 requested review from ehanson8 and ghukill and removed request for a team October 24, 2025 20:24
@ehanson8 ehanson8 self-assigned this Oct 27, 2025
Copy link
Contributor

@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.

Ran in stage and observed the new fields in the file, great work!

Comment on lines 225 to 227
patron_template.pref_middle_name.string = ( # type: ignore[union-attr]
patron_dict["PREFERRED_MIDDLE_NAME"] or ""
)
Copy link
Contributor

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 ""?

Copy link
Contributor

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

Comment on lines +220 to +230
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 ""
)
Copy link
Contributor

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!

Copy link
Contributor

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
Copy link
Contributor

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!

Comment on lines +220 to +230
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 ""
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Seconded.

@adamshire123 adamshire123 merged commit 531ec14 into main Oct 28, 2025
3 checks passed
@adamshire123 adamshire123 deleted the ENSY-430-patronload-preferred-names-project-update-patron-load-app branch October 28, 2025 13:16
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.

4 participants