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

Show canonical dataset in MetadataView #2546

Merged
merged 16 commits into from
Dec 2, 2024

Conversation

robyngit
Copy link
Member

@robyngit robyngit commented Oct 3, 2024

This PR introduces a feature that a visually identifies a dataset as essentially a duplicate of another in the MetadataView. It does this by adding and modifying some components of the view.

New CanonicalDatasetHandlerView

Added a new view, CanonicalDatasetHandlerView that handles identifying and displaying the canonical dataset within a Metadata view.

This new view is a "scoped subview", a self-contained view that is responsible for managing a specific part of UI within a larger parent view. In this case, the CanonicalDatasetHandlerView handles inspecting and modifying specific parts of the already-rendered DOM within the MetadataView. Creating a new view for this purpose avoids adding more complexity to the already very large MetadataView.

The CanonicalDatasetHandlerView is responsible for the following tasks:

  • Inspects the annotations in the MetadataView to identify a canonical dataset.
    • When annotations include both schema.org:sameAs and prov:derivedFrom annotations that have the value, this is assumed to be a reference the DOI of the canonical dataset.
  • Modifies the MetadataView when a canonical dataset is detected, by:
    • Hiding the annotation views that identify the canonical dataset
    • Adding a "info icon" that indicates the dataset is essential a duplicate of another dataset. (An info icon is like the "private" or "archived" icons near the title).
    • Adds a second citation to the citation modal
    • Adds a blue alert box at the top of the page, under the title, that includes the citation to the original dataset
canonical screenshot

New CrossRef model

  • Introduced a new model to handle querying the CrossRef API for metadata about a DOI, including methods for caching responses and clearing the cache.

Changes to other components

Citation Model

  • Added properties for issue and methods to extract volume and issue from the source model. Updated getJournalFromSourceModel and getPidFromSourceModel to handle getting these values from a CrossRefModel.

Citation View

  • Updated the template to include issue and adjust the formatting of the journal, volume, and page information.

Metadata View

  • Deprecated the metadataInfoIcons template in favour of rendering icons directly in the MetadataView methods. This allows us to reuse the logic for adding a "duplicate" icon in the MetadataView along side the private and archived icons.
  • Added checks to avoid re-rendering issue
  • Insert and render the CanonicalDatasetHandlerView

@robyngit robyngit changed the title Add view to show source dataset in MetadataView Show canonical dataset in MetadataView Oct 3, 2024
- Add a new view, CanonicalDatasetHandlerView, to handle identifying and displaying the canonical dataset for a given dataset
- The view removes the annotations that identify the canonical dataset from the metadata view and adds a field to display the canonical dataset url
- The view has shell methods to fill in that will make further modifications to the metadata view

Issue #2541
- Deprecate the template that rendered the icons previously
- Add new methods to MetadataView to render the icons
- Call new methods to render the duplicate icon with the CanonicalDatasetHandlerView

Issue #2541
@robyngit robyngit force-pushed the feature-2541-show-source-dataset branch from 922c13b to 6741949 Compare October 3, 2024 23:12
The metadata view re-renders when a users' logged in status changes. Depending on the timing of this change,
re-rendering may occur in the middle of a previous render. This causes elements of the view to break, especially the
new CanonicalDatasetHandlerView. This commit fixes the issue by adding a check to see if the view is already
rendering before re-rendering.

Issue #2541
And show the citation modal when the "duplicate" info icon is clicked.

Issue #2541
and add rendering of issue & volume for journal articles in the citation APA template

Issue #2541
using the new CrossRef model

Issue #2541
@robyngit robyngit force-pushed the feature-2541-show-source-dataset branch from 63195fd to 5c124bd Compare October 14, 2024 19:23
Handle datasets that have multiple annotations with the sameAs and/or derivedFrom property.

Issue #2541
In Metadata view, show the full citation for the canonical dataset in the "Canonical Dataset" section in the general metadata view.

Issue #2541
@robyngit robyngit marked this pull request as ready for review October 14, 2024 23:02
@robyngit
Copy link
Member Author

robyngit commented Oct 17, 2024

Changes to do based on feedback from @mbjones:

  • Move the canonical citation above the "this version" citation in the citation modal
  • Make the canonical citation on the landing page more prominent, and somewhere near/at the top of the page

Canonical dataset citation is now before the "this version" citation in the citation modal on dataset landing pages.

Issue #2541
@robyngit
Copy link
Member Author

robyngit commented Oct 17, 2024

Also fix a problem found in testing:

  • datasets that are private but that the logged in user has authorization to view are sometimes shown as private anyways.

In the MetadataView. This ensures that if the logged in status changes, the view will re-render to show the correct information.

Issue #2541
@robyngit robyngit force-pushed the feature-2541-show-source-dataset branch from 029f128 to ded5b86 Compare October 17, 2024 19:11
Remove the Canonical Dataset field in the General section of dataset landing pages, and instead show a more prominent blue info box at the top of the page with the citation.

Issue #2541
Even if we can't fetch DOI info

Issue #2541
* @returns {string} Returns the main identifier for the citation or an
* empty string.
* @since 2.23.0
*/
getID() {
const idSources = ["pid", "seriesId", "source_url"];
const idSources = ["pid", "seriesId", "source_url", "doi", "DOI"];
for (let i = 0; i < idSources.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [eslint] <no-plusplus> reported by reviewdog 🐶
Unary operator '++' used.

Copy link
Member

@rushirajnenuji rushirajnenuji left a comment

Choose a reason for hiding this comment

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

Hi @robyngit, this looks great! 🎉

It is great to have the functionality to query Crossref! Tested this on demo ADC and the new elements show up for datasets with source information.

I ran into some unit tests failing, but @robyngit has already added a fix for the same here - #2557

@rushirajnenuji rushirajnenuji merged commit 6e26e2a into develop Dec 2, 2024
1 check failed
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.

Prominently indicate when a data package is essentially a duplicate of an external version
2 participants