-
Notifications
You must be signed in to change notification settings - Fork 7
1.9 IUCat Extraction
Adam Ploshay edited this page Dec 6, 2018
·
2 revisions
Pertinent to HPT-1344.
The current (curation_concerns) implementation uses this approach:
- A work's edit form contains an additional checkbox to optionally update with remote metadata
- The controller includes a module that checks whether parameters indicate:
- checkbox was filled, on an update action
- it's a create action (unconditionally)
- If the check passes, the controller adds a decorator to the work model that monkeypatches its
save
action to callapply_remote_metadata
immediately prior to save - That action uses a custom stack using
JSONLDRecord
and the content oflib/iu_metadata
Under Hyrax 2.1, but the more Hyrax-y approach is to replace step #3 -- having the controller decorate the work model -- with customization to the actor stack that all the controller actions are largely delegated to. The other steps can probably remain essentially the same, although their implementation details differ.
Necessary subtasks include:
- Add the
source_metadata
andsource_metadata_identifier
attributes
- A consideration here is stock Hyrax follows a pattern of required vs optional attributes. What we currently have is a notch more complicated, where at least one of of
title
orsource_metadata_identifier
is required -- but neither one, on its own, is strictly a required attribute. This impacts both model validations and the two part (required attributes, then optional attributes) structure of the edit form (below), and how much we might need to override it.
- Customize the field edit form for
source_metadata_identifier
to include the option to apply remote metadata - Modify the controller to check for create action or update with remote metadata, and pass that along to the actor stack
- Modify the actor stack with a new actor to pull and apply remote attributes, using the
iu_metadata
library content or modifications of it
The iu_metadata
libraries may benefit from refactoring, both to fit into the Hyrax 2.1 context, and to deprecate the METSRecord content we're not using.
There are a few inter-related questions on how to approach #4:
- Who modifies the parameters with the remote lookup results? The controller, the Environment, or the Actor?
- If the controller: we can use stock Environment and Actor components
- If the environment: we probably need to pair this with a modified Actor that knows to call a new method on the Environment to pull in remote attributes
- If the Actor: do we replace the standard model actor, or insert the remote-data actor afterwards? If we make the form field to indicate remote data update a "virtual attribute" on the model, we may be able to bypass controller modifications.