Skip to content

DAIA: make accepted service list configurable #2060

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

Open
wants to merge 25 commits into
base: dev
Choose a base branch
from

Conversation

hajoseng
Copy link
Contributor

…uration is in DAIA.ini, default loan and presentation (interloan can be added). Limitations are only regarded if the belong to an accepted service. There is as well a bit of code restructured in order to be able to include electronic holdings. Holdings without holding services are skipped.
This is the first part which should solve pr #2026. I'd like to add the electronic holdings functionality as well, but I have to do some more considerations on this topic.

…uration is in DAIA.ini, default loan and presentation (interloan can be added). Limitations are only regarded if the belong to an accepted service. There is as well a bit of code restructured in order to be able to include electronic holdings. Holdings without holding services are skipped.
@hajoseng
Copy link
Contributor Author

There is a failure of the CI-tests I don't understand; can anybody give me a hint?

@demiankatz demiankatz requested a review from olli-gold August 18, 2021 13:22
@demiankatz
Copy link
Member

Thanks, @hajoseng. I have requested a review from @olli-gold since I think he is better qualified to comment on this than I am... but if either of you need my input, just let me know and I'll take a closer look. I will certainly follow your conversation as it unfolds.

Thanks also for fixing the CI failure. Sorry I didn't get a chance to look before you solved it. Was it just a php-cs-fixer failure, or something different? Let me know if you had to spend a lot of time on the solution, and perhaps I can offer you a shortcut for future reference.

@hajoseng
Copy link
Contributor Author

@demiankatz: Thank you; it was a php-cs-fixer failure. I was a bit irritated because it only showed a diff-output instead of pointing on errors or warnings und - moreover - it showed these diffs at placed where I haven't changed anything. I guess the rules have become more strict.

@demiankatz
Copy link
Member

@hajoseng, when you get php-cs-fixer diff output, you can just run vendor/bin/phing php-cs-fixer to apply those diffs; you don't have to do anything by hand. I hope that saves you trouble in the future!

(And it's likely that the new problems were caused by the recent upgrade to php-cs-fixer 3, which is more strict about argument lists than php-cs-fixer 2 was).

@hajoseng
Copy link
Contributor Author

@demiankatz, thank you for your hint on php-cs-fixer as command tool. Just tried it.

'storageid' => '',
'storagehref' => '',
'item_notes' => ['mit Zustimmung'],
'services' => ['presentation', 'loan'],
Copy link
Contributor

@olli-gold olli-gold Aug 19, 2021

Choose a reason for hiding this comment

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

It's not clear, to which service the item_note is related. Maybe we need generic item_notes and should add a new field for service-related item_notes?

Copy link
Member

Choose a reason for hiding this comment

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

Could this also be handled by appending/prepending service-specific text to the notes in the general field? (I don't mind adding something new, but if we can keep the ILS driver spec simpler and less specific without losing functionality, that's probably preferable).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I thought about that as well and it may be a workaround if we do not want to introduce a new field .

Copy link
Member

Choose a reason for hiding this comment

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

I'll be interested to hear what @hajoseng has to say! The other consideration with either solution is that, since translation for 8.0 is already underway, we don't have the ability to add new translation strings right now... (Though in this case, if it's absolutely necessary, I could live with adding new strings in just English and German for now, since I don't think DAIA is widely used in other language communities yet... but correct me if I'm wrong about that!)

Copy link
Contributor

@olli-gold olli-gold left a comment

Choose a reason for hiding this comment

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

Thank you @hajoseng! Overall I am happy with that PR, although it breaks with some of our customizations in our VuFind instance (which are expecting to have electronic holdings in the DAIA response, if electronic holdings are applicable at all). But I guess, those customizations can easily deal with the new array key for electronic holdings instead of the holdings key.

Before eventually approving this, I would like to discuss the effects of the introduction of the new array key, though. The DAIA driver would be the only driver handling it this way so far and I guess this might be a reason to postpone these changes to VuFind 9, as it might affect some display logics and templates as well...

I do also not see, that this PR really solves the problem of mixed limitations for different services, which was the original problem in #2026 - it just skips limitations, if they are related to services, which are not in the onSiteServices, as I noted here: https://github.com/vufind-org/vufind/pull/2060/files#r691956985... For instance, it's still not clear, to which service an item_note is related. Maybe we need a new item_note field to indicate relations between services and notes (ie. limitations)?

@hajoseng
Copy link
Contributor Author

Just did another commit to include electronic holdings as well. Those holdings can be connected to several remote services and several remote-links for each item - each with different limitations (e.g. one for within university scope and one for externals provided with a login). I just put those links and limitation remarks into item_notes; maybe - or hopefully - there show up nicer solutions. Showing remote services is configurable as well; it is skipped by leaving the daiaRemoteServices list empty.

@hajoseng
Copy link
Contributor Author

@olli-gold, thank you for your answer. Important issues which we have to work out. Maybe you have a look at the way the driver handles remote services after my last commit.
I'm going to work more on this pr from next week monday. Until then I'll make up my mind and hopefully get more ideas.

@demiankatz
Copy link
Member

@olli-gold, the electronic_holdings key is not new to this PR or unique to the DAIA driver; it is also supported by the Alma driver and the Demo driver. It's definitely worth confirming that what is added here works consistently with the other implementations. (I haven't studied the code closely, so I have no reason to believe that there are any problems -- just saying that on general principle).

@olli-gold
Copy link
Contributor

Ah, ok, thanks for that notice - I did not know, that this electronic_holdings key already exists. That definitely changes my mind about approving this PR :) However, I'll test the latest development again.

@olli-gold olli-gold self-requested a review August 19, 2021 13:24
…lled als locations (just like the related template expects them to be). As there might be several links per item, several locations are displayed if there are; otherwise everything is kept as is in order not to break backwards compatibility.
@hajoseng
Copy link
Contributor Author

@demiankatz: It doesn't look like a real merge conflict; or have I missed something?

Copy link
Member

@demiankatz demiankatz left a comment

Choose a reason for hiding this comment

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

@hajoseng, there were some merge conflicts related to @EreMaijala's recent work to improve consistency of HTML escaping. I think I've resolved the direct conflicts, but there also seem to be some other related issues in the template, which I've commented on below.

I also suspect it may be possible to simplify this code (perhaps by casting the data structure to an array) but I didn't analyze it in depth to confirm this suspicion.

@@ -23,7 +40,7 @@
<b><?=$this->transEsc("Item Notes")?>:</b>
<ul>
<?php foreach ($item['item_notes'] as $item_note): ?>
<li><?=$this->escapeHtml($item_note) ?></li>
<li><?=$item_note ?></li>
Copy link
Member

Choose a reason for hiding this comment

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

Was this reverted intentionally, or just a merge error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a merge error.

<?php if ($item['locationhref'][$index] ?? false): ?>
<p>
<a href="<?=$this->escapeHtmlAttr($item['locationhref'][$index])?>" target="_blank"><?=$locationTextEsc?></a>
<?=$item['locationnote'] ?? ''?>
Copy link
Member

Choose a reason for hiding this comment

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

This probably needs HTML escaping.

<?php else: ?>
<p>
<?=$locationTextEsc?>
<?=$item['locationnote'] ?? ''?>
Copy link
Member

Choose a reason for hiding this comment

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

This probably needs HTML escaping.

'storage' => 'Abteilung III',
'storageid' => '',
'storagehref' => '',
'item_notes' => ['mit Zustimmung'],
Copy link
Contributor

Choose a reason for hiding this comment

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

I just notice, that this might be a limitation_type rather than an item_note...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@olli-gold: a limitation_type contains the id of a limitation, which is in any case should be a purl. Only the contents of limitations are mapped to item_notes. In fact I've never seen a limitation id in real DAIA; limitations seem to be announced only in a free-text style.

Copy link
Contributor

@olli-gold olli-gold Aug 25, 2021

Choose a reason for hiding this comment

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

I see the problem, that we do not get an ID from our DAIA provider, but the specification recommends to set IDs (cf. https://gbv.github.io/daia/daia.html#limitations). Maybe we should ask for IDs at our DAIA provider, but it will certainly take much time until we really have them. In the meantime we could choose to either add IDs in the driver (at least for some known free text limitations) or to keep the status of just showing the limitations as item_notes (if this is common practice for the most drivers in VuFind)...

Copy link
Contributor

Choose a reason for hiding this comment

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

But maybe we should open a different PR for that development, as it really does not need to be addressed here.

@hajoseng
Copy link
Contributor Author

hajoseng commented Nov 8, 2021

Now on-site and remote services are no longer distiguished. Instead electronic holdings are identified by a method using service-related criteria. As well there are some more information gathered as item_notes (e.g. about issues of newspapers or magazines and licence notes). Additionally some minor changes (empty notes shouldn't be shown as well as holding informations lacking basic items). See comments.
I'll try to fix the unit-text issue tomorrow.

@hajoseng
Copy link
Contributor Author

hajoseng commented Nov 9, 2021

Changes so far are:

  • which services to analyze is made configurable
  • if service loan is available and href is given, addLink is set to true (see 2.6 od DAIA documentation)
  • if service remote is given and delay is set to PT0S, this service is assumed to be an electronic service (see 2.5)
  • content of chronology is gathered as it provides crucial informations in many cases (see 2.8)
  • item['about'] is gathered because sometimes it contains licence-notes (not documented)
  • if no available service, no duedate and no service link is found the item returns just the information that it is not holdable
  • if no item_notes are found, no item_notes are displayed

But anyhow there's maybe more work to do:

  • if several services are available there is still no link between a service and the related notes
  • the configuration of preferred service has still no effect on displayed services in a record view
  • in my installation I get quite weird results in the result list view; I haven't investigated in this issue yet

@lahmann @olli-gold: I would be glad, if you have another look at this PR and leave some comments.

@demiankatz
Copy link
Member

@lahmann / @olli-gold, I just happened to notice that this PR has been inactive for several months. Did either of you have a chance to look at it? I realize that @hajoseng is not available right now, but I just wanted to see if we can do anything to keep this moving forward.

);
} else {
$this->debug(
'Accepting loan, presentation, remote and openaccess as services.'
Copy link
Contributor

Choose a reason for hiding this comment

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

Improved debugging message: "No services configured - accepting loan, presentation, remote and openaccess as services by default."

$isElectronic = $this->serviceIsElectronic($status);
// add result_item to the result array: either to electronic_
// holdings if it is electronic or to holdings otherwise
if ($this->serviceIsElectronic($status)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Check can be done on $isElectronic.

$item_notes[] = $item['about'];
}

// If no useful availability service is found, return only the
Copy link
Contributor

Choose a reason for hiding this comment

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

The added logic block below will introduce very strict requirements for DAIA items in terms of availablity modelling: according to this if-conditional the unavailability information of an unavailable item will be shown to the user only if either a link, a duedate or an available service exists. Otherwise this item will simply be shown as unavailable. This is too strict as according to DAIA specification (http://gbv.github.io/daia/daia.html#availability) the only required field for defining an unavailable service is service. E.g. the availability of an unavailable item could be further specified by a given limitation, but any limitation will be ignored if the above mentioned conditions are not met.

@lahmann
Copy link
Contributor

lahmann commented Oct 18, 2022

I finished my review and would not recommend merging this pull request in its current state as the introduced changes will require a very specific and strict way of DAIA availability modelling which is not defined by the DAIA specification (see #2060 (review)).

My suggestion is to postpone this pull request to the VuFind 10 release.

It would be interesting to hear if @olli-gold has some thoughts on this.

@demiankatz demiankatz modified the milestones: 9.0, 10.0 Oct 18, 2022
@demiankatz
Copy link
Member

Thanks, @lahmann, I have changed the milestone to 10.0 for now. We can, of course, always merge this early if things get resolved sooner/more easily than anticipated.

olli-gold added a commit to tubhh/vufind that referenced this pull request Oct 20, 2022
@demiankatz
Copy link
Member

@hajoseng, @olli-gold and @lahmann: I see that this PR now has some conflicts that need to be resolved. Is there still a need for this work, and does anyone have time/interest to move it forward? Unfortunately, I am not in a good position to help resolve this one, but of course I'm always happy to support progress however I can!

@lahmann
Copy link
Contributor

lahmann commented Mar 6, 2024

I still have objections (see above) which I would like to discuss before merging this PR - feedback by @olli-gold and @hajoseng would be very much appreciated.

@demiankatz demiankatz modified the milestones: 10.0, 10.1 Mar 6, 2024
@demiankatz
Copy link
Member

demiankatz commented Mar 6, 2024

Since both @olli-gold and @hajoseng may have limited availability right now, I'm going to push this forward to the 10.1 milestone to give us more time for this conversation. Thanks, @lahmann!

(Of course, I'd still be happy to merge this in time for the 10.0 release if the work gets done faster than expected).

@demiankatz demiankatz changed the title makes the DAIA services which should be accepted configurable; config… DAIA: make accepted service list configurable Jun 25, 2024
@demiankatz demiankatz modified the milestones: 10.1, 11.0 Oct 8, 2024
@demiankatz
Copy link
Member

I'm moving this to the 11.0 milestone since significant work is still needed, and the 10.1 release is getting close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants