Skip to content

Conversation

@jazairi
Copy link
Contributor

@jazairi jazairi commented Sep 29, 2025

Why these changes are being introduced:

The first iteration of USE UI will include the
ability to toggle between Ex Libris CDI and
TIMDEX results.

Relevant ticket(s):

How this addresses that need:

This adds a Primo Search model that calls the
Primo Search API, and a Normalize Primo model that parses the each result and returns a normalized
record.

Side effects of this change:

  • For better or worse, much of the normalization code has been repurposed from Bento. This felt
    acceptable as we do not anticipate this to be a
    long-term solution.
  • While working on this, I noticed that most of the TIMDEX normalization logic happens in the
    views. It would be better to move this to
    a normalization model, as we've done here with
    Primo. I opened USE-73 to address this.
  • It's not technically a side effect of this changeset, but it's worth noting that we still
    periodically see some GeoData test failures on
    random test runs. I've documented this in USE-72.

Developer

Accessibility
  • ANDI or WAVE has been run in accordance to our guide.
  • This PR contains no changes to the view layer.
  • New issues flagged by ANDI or WAVE have been resolved.
  • New issues flagged by ANDI or WAVE have been ticketed (link in the Pull Request details above).
  • No new accessibility issues have been flagged.
New ENV
  • All new ENV is documented in README.
  • All new ENV has been added to Heroku Pipeline, Staging and Prod.
  • ENV has not changed.
Approval beyond code review
  • UXWS/stakeholder approval has been confirmed.
  • UXWS/stakeholder review will be completed retroactively.
  • UXWS/stakeholder review is not needed.
Additional context needed to review

Unfortunately, since this doesn't touch views or controllers, the best way to confirm functionality is through manually testing in the Rails console. You can try running a new search (search = PrimoSearch.new.search('popcorn', 10)), then grabbing a record from it (search['docs'].first), and looking at the normalized record (NormalizePrimo.new(record).normalize).

Code Reviewer

Code
  • I have confirmed that the code works as intended.
  • Any CodeClimate issues have been fixed or confirmed as
    added technical debt.
Documentation
  • The commit message is clear and follows our guidelines
    (not just this pull request message).
  • The documentation has been updated or is unnecessary.
  • New dependencies are appropriate or there were no changes.
Testing
  • There are appropriate tests covering any new functionality.
  • No additional test coverage is required.

@mitlib mitlib temporarily deployed to timdex-ui-pi-use-30-pri-jj9dhr September 29, 2025 19:18 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-30-pri-jj9dhr September 29, 2025 21:03 Inactive
@coveralls
Copy link

coveralls commented Sep 29, 2025

Pull Request Test Coverage Report for Build 18170449977

Details

  • 185 of 185 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.3%) to 98.976%

Totals Coverage Status
Change from base Build 17475582805: 0.3%
Covered Lines: 773
Relevant Lines: 781

💛 - Coveralls

@JPrevost JPrevost self-assigned this Sep 30, 2025
Copy link
Member

@JPrevost JPrevost left a comment

Choose a reason for hiding this comment

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

Initial feedback. Will formalize the review when you make the changes to normalizer you noted in Slack yesterday.

@jazairi jazairi temporarily deployed to timdex-ui-pi-use-30-pri-jj9dhr September 30, 2025 19:39 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-30-pri-jj9dhr September 30, 2025 20:02 Inactive
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-30-pri-jj9dhr September 30, 2025 20:03 Inactive
@jazairi
Copy link
Contributor Author

jazairi commented Sep 30, 2025

@JPrevost I ended up pushing the changes in a few separate commits. The first fixes the bulk of the initial feedback. The second involved renaming the NormalizePrimo model, so it felt useful to make it a separate commit for ease of review. The last two commits are just things I forgot to address in the first commit. 🙂

Let me know if I missed anything, or if anything else comes up in the remainder of the review. Thanks!

@jazairi jazairi temporarily deployed to timdex-ui-pi-use-30-pri-jj9dhr September 30, 2025 21:56 Inactive
Why these changes are being introduced:

The first iteration of USE UI will include the
ability to toggle between Ex Libris CDI and
TIMDEX results.

Relevant ticket(s):

* [USE-30](https://mitlibraries.atlassian.net/browse/USE-30)

How this addresses that need:

This adds a Primo Search model that calls the
Primo Search API, a Normalize Primo Record model
parses the each result and returns a normalized
record, and a Normalize Primo Results model that
batches record normalization.

Side effects of this change:

* For better or worse, much of the normalization
code has been repurposed from Bento. This felt
acceptable as we do not anticipate this to be a
long-term solution. However, when we also
normalize TIMDEX records, we'll want to revisit
the normalized fields.
* While working on this, I noticed that most of
the TIMDEX normalization logic happens in the
views. It would be better to move this to
a normalization model, as we've done here with
Primo. I opened [USE-73](https://mitlibraries.atlassian.net/browse/USE-73)
to address this.
* It's not technically a side effect of this
changeset, but it's worth noting that we still
periodically see some GeoData test failures on
random test runs. I've documented this in [USE-72](https://mitlibraries.atlassian.net/browse/USE-72).
* We'll want to keep on eye on which methods
error in case more guard clases are needed. We
may also want to refactor to use more safe
navigation.
@jazairi jazairi force-pushed the use-30-primo-models branch from 4add3a2 to bef712d Compare October 1, 2025 17:31
@jazairi jazairi temporarily deployed to timdex-ui-pi-use-30-pri-jj9dhr October 1, 2025 17:31 Inactive
@jazairi jazairi merged commit a86ecf7 into main Oct 1, 2025
5 checks passed
@jazairi jazairi deleted the use-30-primo-models branch October 1, 2025 17:35
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.

5 participants