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

Updating allinson flex features #231

Merged
merged 9 commits into from
May 3, 2023
Merged

Conversation

kirkkwang
Copy link
Contributor

@kirkkwang kirkkwang commented Apr 29, 2023

Filter out admin_only fields

This commit will filter out metadata fields that are meant to be admin
only from displaying in the UV. This is done by adding a reject if the
Allinson Flex profile indicates that this field is admin_only.


Make QA work for allinson_flex

Allinson Flex profiles don't have an option other than indicating which
fields to be facetable. This commit will make QA work for Allinson Flex
by assuming the field names "rights_statement" and "license" will be QA
fields.


Add a way to sort Allinson Flex metadata

This configuration allows you to sort the metadata within an application
that uses Allinson Flex. In a non-Allinson Flex application, you would
use the IiifPrint.config.metadata_fields to sort the metadata. However,
in Allinson Flex, the fields come in according to the m3 profile. This
configuration allows you to use an Array of Symbols to sort the metadata
in an intentional way.

Some profiles have fields with the same name repeated. This commit will
remove repeated fields though this functionality just takes the first
field and ignores the rest. This isn't very controlled at the moment
but works for Essi's situation.

Ex. Imagine if you had fields of:

[
  #<AllinsonFlex::ProfileProperty id: nil, name: "title", indexing: ["stored_searchable"]>,
  #<AllinsonFlex::ProfileProperty id: nil, name: "title", indexing: ["stored_searchable"]>
 ]

The first object would yield
Title: My Sweet Title

and the second field would yield
Photograph Information: My Sweet Title

The second field would be ignored since the value is the same as the
first field. This is how Essi displays their metadata so we will use
this method until told otherwise.


Ensure we're using a SolrDcoument

For Essi to use the #manifest_metadata method, we need to ensure that
the model is a SolrDocument. We will now make a check to see if the
model is a SolrDocument, and if not, we will attempt to convert it to
one.

This commit will filter out metadata fields that are meant to be admin
only from displaying in the UV.  This is done by adding a reject if the
Allinson Flex profile indicates that this field is `admin_only`.
Allinson Flex profiles don't have an option other than indicating which
fields to be facetable.  This commit will make QA work for Allinson Flex
by assuming the field names "rights_statement" and "license" will be QA
fields.
This configuration allows you to sort the metadata within an application
that uses Allinson Flex.  In a non-Allinson Flex application, you would
use the IiifPrint.config.metadata_fields to sort the metadata.  However,
in Allinson Flex, the fields come in according to the m3 profile.  This
configuration allows you to use an Array of Symbols to sort the metadata
in an intentional way.

Some profiles have fields with the same name repeated.  This commit will
remove repeated fields though this functionality just takes the first
field and ignores the rest.  This isn't very controlled at the moment
but works for Essi's situation.

Ex. Imagine if you had fields of:
[
  #<AllinsonFlex::ProfileProperty id: nil, name: "title", indexing: ["stored_searchable"]>,
  #<AllinsonFlex::ProfileProperty id: nil, name: "title", indexing: ["stored_searchable"]>
 ]

The first object would yield
Title: My Sweet Title

and the second field would yield
Photograph Information: My Sweet Title

The second field would be ignored since the value is the same as the
first field.  This is how Essi displays their metadata so we will use
this method until told otherwise.
For Essi to use the #manifest_metadata method, we need to ensure that
the `model` is a SolrDocument.  We will now make a check to see if the
`model` is a SolrDocument, and if not, we will attempt to convert it to
one.
lib/iiif_print.rb Outdated Show resolved Hide resolved
lib/iiif_print.rb Outdated Show resolved Hide resolved
lib/iiif_print.rb Outdated Show resolved Hide resolved
lib/iiif_print.rb Outdated Show resolved Hide resolved
lib/iiif_print/metadata.rb Outdated Show resolved Hide resolved
lib/iiif_print/metadata.rb Outdated Show resolved Hide resolved
jeremyf and others added 4 commits May 1, 2023 15:31
Prior to this we might still do conversion work on the model; which was not
desirous.
This commit will add a method called #solr_document to the SolrDocument
to return itself.  This will be useful because in the
IiifManifestPresenterBehavior we want to ensure that we pass the
SolrDocument into IiifPrint#manifest_metadata_from.
This commit will remove any magic strings and move them to the
configuration.  This favors configuring questioning authority fields
over a hard coded set of defaults.

This commmit also, the #qa_field? call.
This commit gets rid of a lot of loops and consolidates it into fewer
calls to hopefully improve performance.
@kirkkwang kirkkwang force-pushed the updating-allinson-flex-features branch from 671f602 to fcca437 Compare May 2, 2023 02:11
This commits adds some much needed specs for the IiifPrint class
methods.
@kirkkwang kirkkwang requested a review from jeremyf May 3, 2023 15:13
@kirkkwang kirkkwang merged commit d8246e1 into main May 3, 2023
@kirkkwang kirkkwang deleted the updating-allinson-flex-features branch May 3, 2023 21:33
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.

2 participants