dspace-angular icon indicating copy to clipboard operation
dspace-angular copied to clipboard

Display Altmetric badges on simple item view

Open sergius02 opened this issue 1 year ago • 12 comments

References

  • Fixes #2400

Description

Displays the Altmetric donut in the simple item page. It use diferent identifiers to do that, DOI, Handle, PMID, ISBN, ARXIV or URI.

Instructions for Reviewers

List of changes in this PR:

  • item-page-altmetric-field.component: The new component with the donut.
  • item-page-atlmetric-field.directive: This directive adds the data-* to the div depending in the firs valid identifier found in the item. See https://badge-docs.altmetric.com/getting-started.html#quick-start
  • publication and untyped component to load the new component.
  • Translation files with the head of the new item page section
  • external-scripts-loader.service, this service loads dinamically the javascripts (from URLs) creating a script tag in the head of the html. It can be use to load other javascript from CDN and no need to download and use static javascript. See https://github.com/DSpace/dspace-angular/issues/2400#issuecomment-1710274843 . The idea for this service is from this comment https://stackoverflow.com/a/42766146

Checklist

  • [x] My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • [x] My PR passes ESLint validation using yarn lint
  • [x] My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • [x] My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • [x] My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • [ ] If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • [x] If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • [x] If my PR fixes an issue ticket, I've linked them together.

sergius02 avatar Sep 14 '23 10:09 sergius02

Hi @sergius02, Conflicts have been detected against the base branch. Please resolve these conflicts as soon as you can. Thanks!

github-actions[bot] avatar Oct 23 '23 17:10 github-actions[bot]

@sergius02 I'd like to test this on our dspace-7.6 instance. Could you please make a patch against dspace-7.6 tag? Thanks!

amtuannguyen avatar Oct 27 '23 15:10 amtuannguyen

@sergius02 I'd like to test this on our dspace-7.6 instance. Could you please make a patch against dspace-7.6 tag? Thanks!

Never mind, I applied the patch and it is working on dspace-7.6 tag. Thanks!

amtuannguyen avatar Oct 27 '23 17:10 amtuannguyen

We have this feature in DSpace-CRIS. It is part of a larger feature that allow to track/visualize metrics about the item so it is not something "small" to be ported so the fact that the feature exists in DSpace-CRIS should definitively not prevent us to consider this PR. That said, having this feature since a while we hear feedback from users and some of them raise concerns about privacy / GPDR. The point is that this kind of widget require the browser to sent data to a third-party service via an http request and this request could lead to "track the user". There is no cookie involved in this but in any case this is a grey area. On the DSpace-CRIS side we are finalizing an improvement that would allow to configure klaro to prevent the use of the badge until the user accept to use it (opt-in). If a such mechanism is not offered also in dspace I would like to keep this feature disabled by default and put a warning in the documentation about potential privacy issue if you enable it. In any case the feature should be configurable (turn on / off)

abollini avatar Jan 11 '24 16:01 abollini

Regarding GDPR, we are already loading fonts from Google Fonts, which was apparently found to be a breach of GDPR in January, 2022. So that's not great...

In any case the feature should be configurable (turn on / off)

Yes I agree that they should be off by default as they were in DSpace 6.x, see dspace/config/modules/altmetrics.cfg:

# Is the Altmetric.com badge enabled?
#altmetric.enabled = false

alanorth avatar Jan 12 '24 11:01 alanorth

Hi, just to help with the test, the article referenced by @alanorth in the issue related to the PR as a nice Altmetrics badge and have both a DOI (10.1126/science.1259855 ; to add in dc.identifier.doi metadata of an item) and a Pubmed ID (25592418 ; to add in a dc.identifier.pubmedid metadata of an item). Just 2 questions to test this feature: where on the page should the Altmetrics Badge be displayed? For the metadata, can both the ID and the URI (ex for DOI: 10.1126/science.1259855 or https://doi.org/10.1126/science.1259855) be used, or only the ID?

pilasou avatar Jan 16 '24 21:01 pilasou

Ok, i've made some changes.

There's a new configuration under item section in the config.yml named showAltmetricBadge (false by default).

When it's false the script will be never be loaded

sergius02 avatar Jan 30 '24 13:01 sergius02

Hi @sergius02, Conflicts have been detected against the base branch. Please resolve these conflicts as soon as you can. Thanks!

github-actions[bot] avatar Feb 14 '24 21:02 github-actions[bot]

@sergius02 : If you have a chance in the next few days, could you rebase this to resolve the merge conflicts? Our 8.0 feature PR merger deadline is Friday, Feb 23 and we are still hoping that we can include this PR. Thanks!

tdonohue avatar Feb 15 '24 16:02 tdonohue

Hi @sergius02, Conflicts have been detected against the base branch. Please resolve these conflicts as soon as you can. Thanks!

github-actions[bot] avatar Feb 27 '24 22:02 github-actions[bot]

Hi @tdonohue , sorry for the late response, im working on it now but with the migration to the new standalone components i have to do some changes to this PR.

Im facing a problem that i don't know why occurs and don't know how to solve. I've made the ItemPageMetricsFieldComponent standalone adding this to the Component decorator

standalone: true,
imports: [TranslateModule, MetadataFieldWrapperComponent, ItemPageAltmetricFieldComponent]

Then in PublicationComponent and UntypedComponent, i've added to the imports:

  imports: [..., AsyncPipe, TranslateModule, ItemPageMetricsFieldComponent],

Everything seems to be ok, but this error appears in publication.component.html and untyped.component.html

Error: src/app/item-page/simple/item-types/publication/publication.component.html:50:5 - error NG8001: 'ds-item-page-metrics-field' is not a known element:
1. If 'ds-item-page-metrics-field' is an Angular component, then verify that it is included in the '@Component.imports' of this component.
2. If 'ds-item-page-metrics-field' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message.

sergius02 avatar May 02 '24 12:05 sergius02

@sergius02 : This still has merge conflicts. If you have a chance to find a fix prior to 8.0, we can still consider this. Otherwise, if you still need help/support, we'll likely need to reschedule for 9.0 (unless anyone else finds time to help...I won't be available until 8.0 is complete unfortunately).

tdonohue avatar May 14 '24 16:05 tdonohue