Enhanced Validation and Renovation of Links in Bib/Instance Records

Description

Purpose/Overview:
The purpose of this backend story is to enhance the PUT /links/instances/<id> endpoint in order to validate and update links in bib/instance records. This includes adding validation to reject saving links to deleted authorities and implementing a renovation process for controlled fields in the records.

Requirements/Scope:

  1. The links endpoint needs to validate links and reject saving links to deleted authorities.

  2. The endpoint should return a response with a 422 status code and include the UUIDs of the authorities that were not found in the system. This response will be used by the UI to display an error message, stop saving or show pop-ups, remove invalid links data, and allow for retrying. It will also be used by the mod-quick-marc module to remove invalid links and retry.

  3. After the links are successfully saved to the database, the existing logic of links update based on authority update should be used to renovate controlled fields in bib/instance records.

Approach:

  1. Implement validation in the mod-entities-links module by checking a flag in the authority_data table indicating whether the authority is actual or deleted. 

  2. Enhance the renovation logic by performing the following steps:
       a. Batch-fetch authority records using the search endpoint.
       b. Batch-fetch related source records using the source-record-storage endpoint.
       c. Combine the fetched data into one Kafka message using the existing logic for creating similar messages.
       d. Send the created message to the links.instance-authority Kafka topic.

  3. No entry needs to be created in the authority_data_stats table because there are currently no authority changes, and tracking the renovation process in the table is unnecessary.

Acceptance criteria:

  1. Validation is implemented in the mod-entities-links module, and it successfully rejects saving links to deleted authorities.

  2. The PUT links endpoint returns a response with a 422 status code and includes the UUIDs of the authorities that were not found in the system.

  3. The existing logic for renovating controlled fields in bib/instance records is triggered after the links are successfully saved to the database.

  4. Unit tests are created/updated to cover the validation and renovation processes.

  5. The module documentation is updated to reflect the changes made to the links endpoint, validation process, and renovation logic.

  6. Logging is well-defined, ensuring appropriate logging messages are generated to track the validation and renovation activities in the system.

Environment

None

Potential Workaround

None

CSP Request Details

None

CSP Rejection Details

None

Attachments

4

Checklist

hide

TestRail: Results

Activity

Show:

Yauhen Viazau June 30, 2023 at 12:59 PM

This functionality will be tested in scope of UIQM-501 when it is done

Pavlo Smahin June 30, 2023 at 10:30 AM

Hey , your verification does not check the acceptance criteria described in the story. Your verification could be done after future changes in mod-quick-marc and UI.

Yauhen Viazau June 26, 2023 at 7:49 AM

Initial verification on Snapshot-1 - not working

This ticket does not seem to be implemented yet.

See, for example:

1) When updating authority while linked bib is being edited (save and not saved links), optimistic locking upon bib save -

2) When deleting authority while linked bib is being edited (not saved link), Bib record is saved but field still displayed as linked (QuickMARC, Instance view, Source view) -

3) When updating 1XX tag in authority while linked bib is being edited (not saved link), Bib record is saved but field still displayed as linked (QuickMARC, Instance view, Source view) -

- please review and respond whether this ticket can be tested as of now

Done

Details

Assignee

Reporter

Priority

Story Points

Sprint

Development Team

Spitfire

Fix versions

Release

Poppy (R2 2023)

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created May 25, 2023 at 6:34 PM
Updated October 12, 2023 at 9:55 AM
Resolved June 30, 2023 at 1:50 PM
TestRail: Cases
TestRail: Runs