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

LWS-89: Loan status #1069

Merged
merged 19 commits into from
Aug 14, 2024
Merged

LWS-89: Loan status #1069

merged 19 commits into from
Aug 14, 2024

Conversation

jesperengstrom
Copy link
Contributor

@jesperengstrom jesperengstrom commented Jun 13, 2024

Description

Tickets involved

LWS-89

Description

Loan status information is now displayed in the holdings panel on demand when clicking a library.

It also supports multiple lookups in parallel if a library has holding of multiple editions/instances of a book (example). This results in somewhat different appearance.

A library with one copy of two different instances/editions:

Skärmavbild 2024-07-03 kl  13 21 29.

A library with multiple copies of the same edition:

Skärmavbild 2024-07-03 kl  13 53 13.

Don't know if this difference is important and needs to be conveyed further. A user interested in a specific edition can view it's holdings using the instances list.

Loan status strings are mapped the same way as in the POC to enable i18n etc:

Skärmavbild 2024-07-03 kl  14 01 03

Summary of changes

  • New env var: HOLDING_STATUS_URL=http://lanstatus.libris.kb.se/status/status.php
  • New component HoldingStatus.
  • New internal api route /holdingstatus that performs the real fetch, prevents CORS trouble.
  • Added unit test for a holding util function
  • Bump lint-staged, had an issue with the husky pre-commit hook that is resolved in 15.2.7.

Remaining Issues

  • Often when error "Lånestatus är ej tillgänglig" is shown, the message from the api reads "URL till lånestatus för {sigel} ej definierad i LIBRIS biblioteksdatabas!". In old Webbsök, the "Utlånad?" toggle is removed for these libraries. Clearly, a list of libraries connected to the service exist somewhere, but where?
  • For sigel Gbg loan status is displayed in old Webbsök, but not here. It has to with webbsök in this case sending the additional param isbn. Api documentation is needed here: when do we need to use it? Webbsök also uses param rp. What does it do?
  • Holdings list for type Electronic never seems to return any status (example), which makes sense. Same thing in webbsök (example). Should we remove status information altogether for electronic?

@jesperengstrom jesperengstrom changed the title WIP: LWA-89: Loan status LWS-89: Loan status Jul 4, 2024
@jesperengstrom jesperengstrom marked this pull request as ready for review July 4, 2024 09:33
Copy link
Contributor

@olovy olovy left a comment

Choose a reason for hiding this comment

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

Nice work! LGTM! 🔴 🟡 🟢

  • When viewing holdings by work type it would be nice to have a small indication which edition/instance the holding/status refers to. We can coordinate this with improved display of instances/editions on the resource page.
  • Perhaps holding/library info fits better on its own "screen" instead of as an expandable section. Let's see when we combine this with more holding information from the record and more Library information.
  • Some way to force refresh of loan status other that reloading the whole page? Even though that kind of real time update is almost never needed...

Often when error "Lånestatus är ej tillgänglig" is shown, the message from the api reads "URL till lånestatus för {sigel} ej definierad i LIBRIS biblioteksdatabas!". In old Webbsök, the "Utlånad?" toggle is removed for these libraries. Clearly, a list of libraries connected to the service exist somewhere, but where?

The URL for each library used by the lanstatus service/API for checking loan status is configured in bibdb.
bild
Webbsök actually checks if the item_status_url is set in the bibdb database through the webbsök libinfo service.
https://git.kb.se/libris/legacy/websearch2/-/blob/master/src/main/webapp/transformers/showrecord_libs_orgs.xsl#L437
https://git.kb.se/libris/legacy/libinfo2/-/blob/master/src/main/webapp/getxlibsinfo.jspx#L121
If we want to know if loan status is configured beforehand we need to sync more data from bibdb to the XL library descriptions (before following through on the long term plan and replace bibdb with XL).
A first step could be to catch this specific error and display a more specific message?
To distinguish loan status not implemented from loan status not working.

For sigel Gbg loan status is displayed in old Webbsök, but not here. It has to with webbsök in this case sending the additional param isbn. Api documentation is needed here: when do we need to use it? Webbsök also uses param rp. What does it do?

There are actually four parameters

The rp parameter seems to be the index in the holding list. Haven't investigated what it really does...
https://git.kb.se/libris/legacy/websearch2/-/blob/master/src/main/webapp/transformers/showrecord_libs_orgs.xsl#L453

See also the old Lånestatus spec https://www.kb.se/download/18.2705879d169b8ba882a43cc/1555822604043/lanestatus_11.pdf

Holdings list for type Electronic never seems to return any status (example), which makes sense. Same thing in webbsök (example). Should we remove status information altogether for electronic?

Good question. In guess in theory e-books can have a limited number of simultaneous loans. I haven't found an example where an Electronic returns a status. We will have to check with a system librarian. Perhaps the connection to "e-media" is just not implemented by any library.

lxl-web/src/lib/types/api.ts Show resolved Hide resolved
lxl-web/src/lib/utils/holdings.ts Outdated Show resolved Hide resolved
@jesperengstrom
Copy link
Contributor Author

Thanks for such detailed feedback :) I've fixed the following:

  • bib-ids extracted from record.controlNumber or instance.meta.controlNumber
  • onr param applied if LibrisIIINumber exists
  • isbn or issn params applied if available
  • Map key defined and shown in GUI (sigels La and O use it for example)
  • Clearer separation of messages when loan status is not available for this library (not defined) versus not available for an instance/item (error or whatever)

Agree with the other points too, maybe revisit them in the next iteration?

Copy link
Contributor

@olovy olovy left a comment

Choose a reason for hiding this comment

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

LGTM! 🚢 💨

Yes, let's revisit the other stuff in the next iteration.

@olovy
Copy link
Contributor

olovy commented Aug 7, 2024

Did some testing and realized that some libraries return ISO-8859-1 encoded strings 😞

e.g. "Umeå universitetsbibliotek (Q)" on 08364r83x33zmkk1

The old status_proxy.jspx just does a simple replace for å, ä and ö.
I think that is an ok workaround.

@jesperengstrom
Copy link
Contributor Author

Did some testing and realized that some libraries return ISO-8859-1 encoded strings 😞

Good call. Hope this will do it. We need to be on the lookout for more special chars (added é to the list as well).
Also made a wording tweak. "Utlånad" is nice and comprehensible, but clearly not always accurate:

Skärmavbild 2024-08-08 kl  11 00 04

@poacherone
Copy link

I think the ISO-8859-1 encoding might be from the (few) libraries that still use the Z39.50 option. Since we will be removing this option by the end of the year, don't make to much of a workaround for this (if I'm correct about the encoding).

Copy link
Contributor

@johanbissemattsson johanbissemattsson left a comment

Choose a reason for hiding this comment

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

Awesome! 🌟

I have just added a small fix for a breaking test but it looks great otherwise, and will act as a good stepping stone for future iterations. 👍

@jesperengstrom jesperengstrom merged commit 8fab1fd into develop Aug 14, 2024
1 check passed
@jesperengstrom jesperengstrom deleted the feature/LWS-89-loan-status branch August 14, 2024 11:03
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