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

awards/schema.py: read app config for alternate funding validation #429

Conversation

karkraeg
Copy link
Member

@karkraeg karkraeg commented Nov 11, 2024

❤️ Thank you for your contribution!

Description

Hi, in order to enable institutions to use a less strict validation for funding entries that still adheres to Datacite this PR adds a global conf variable that when set allows an alternative validation of a funding entry.

Right now Invenio wants if either an award number or title is entered the other:

image

This is not required by DataCite: https://datacite-metadata-schema.readthedocs.io/en/4.5/properties/fundingreference/

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

* Adds a new global conf variable that when set allows an alternative validation of a funding entry that is also permitted by datacite
except KeyError:
ALTERNATE_FUNDING_SCHEMA = None
if ALTERNATE_FUNDING_SCHEMA:
if not id_ and not (number or title):
Copy link
Member

Choose a reason for hiding this comment

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

something is missing here no? This block seems to not utilize the configured schema. Also, I am hesitating if adding a so specialized config variable is the way to go. Did you try to override the AwardRelationSchema class to provide your own validation? Thoughts @slint @ntarocco ?

Copy link
Contributor

Choose a reason for hiding this comment

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

If not required by DataCite, we might want to relax the constraint without adding extra conditions.
I also agree that a config for this specific part might not be the best solution. Let's discuss it quickly IRL.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was thinking if you set ALTERNATE_FUNDING_SCHEMA to True it would check for number or title. Else it would check as is for number and title.

Also I thought that making it configurable (I am with you that this is not the most elegant way) it wouldn't break stuff for everyone else while enabling us to change it ;)

@tmorrell
Copy link
Contributor

tmorrell commented Nov 11, 2024 via email

@ntarocco
Copy link
Contributor

ntarocco commented Nov 12, 2024

@karkraeg we quickly checked this internally, and we agree that we can simply align with the DataCite optional/requirements fields without adding a config variable ☺️

Can you share a screenshot of how the record landing page will look like when the title and/or the other optional info are not provided?

And also, given that you are changing this, would it be possible for you to change the Number label, and put something like Number or Persistent Identifier (or better naming, @tmorrell any idea?) and check if the fields allows PIDs? This is because it should clearly and explicitly show that you can paste a DOI.

@tmorrell
Copy link
Contributor

Here is how funding looks without a title

Screenshot 2024-11-12 at 8 11 25 AM.

It's alright but it particularly looks weird when you have a funder by itself (National Science Foundation is in bold, unlike others)

Screenshot 2024-11-12 at 8 15 56 AM

On our instance we've shifted the order and emphasis so that the funder comes first and is bolded, since there will always be a funder.

Screenshot 2024-11-12 at 8 11 51 AM

@tmorrell
Copy link
Contributor

@ntarocco I would say an award DOI should go in the URL field, and not the grant number field. Grant numbers have a really specific meaning, and grant DOIs are fairly different. It seems a bit weird to mix them in the same field.

@karkraeg
Copy link
Member Author

I think the problem on the record landing page is especially that an award with just a number doesn't show:

image

I will look into that!

@karkraeg
Copy link
Member Author

Hi @ntarocco, I'd go with @tmorrell here and say that any DOI or other PID should go into the URL field. You could still paste a DOI to the number field, it works.

I would say an award DOI should go in the URL field, and not the grant number field. Grant numbers have a really specific meaning, and grant DOIs are fairly different. It seems a bit weird to mix them in the same field.

@karkraeg
Copy link
Member Author

I will open another PR to adapt https://github.com/inveniosoftware/invenio-app-rdm/blob/35165ab5a0509dd7b7e83bad0af8e7c28b240297/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/detail.html#L98-L130 (eventhough the code looks like it should work the way it is...)

I think the problem on the record landing page is especially that an award with just a number doesn't show:

image

I will look into that!

@karkraeg
Copy link
Member Author

@ntarocco would you be okay with inveniosoftware/invenio-app-rdm@master...ulbmuenster:invenio-app-rdm:recordlandingpage_funding-display ? Looks like that on the record landing page:

image

@slint
Copy link
Member

slint commented Nov 13, 2024

I agree with @tmorrell 's variant that flips the order (since funder is required). This could also mean that we could e.g. "group" entries by funder in case there are multiple awards, like so:

European Commission

  • SciLake – Democratising and making sense out of heterogeneous scholarly content 101058573 (ext. link)
  • FAIRCORE4EOSC – Core Components Supporting a FAIR EOSC 101095129 (ext. link)
  • OSTrails – Open Science Plan-Track-Assess Pathways 101130187 (ext. link)

National Science Foundation

  • DMS-22049834

"MyCustomFunder"

@wgresshoff
Copy link
Contributor

That's a good, idea, @slint . But I think this is perhaps too much for this PR?! If there is some voting, I'm clearly 👍 for the grouping!

@ntarocco
Copy link
Contributor

@tmorrell @karkraeg I am sorry, I did not explain well.
There are some nice considerations here, see bullet points at page 20, that are worth reading, and apply to the limit of the current possibilities (and for what it makes sense) ☺️

@karkraeg
Copy link
Member Author

@tmorrell @karkraeg I am sorry, I did not explain well. There are some nice considerations here, see bullet points at page 20, that are worth reading, and apply to the limit of the current possibilities (and for what it makes sense) ☺️

How exactly does this relate to this PR? Shouldn't we tackle this in another issue since this one is primarily about relaxing the validation? Is there something missing still? I'd be happy to open a PR in app-rdm for the adaption of the display on the record detail page.

@karkraeg
Copy link
Member Author

Copy link
Contributor

@tmorrell tmorrell left a comment

Choose a reason for hiding this comment

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

Looks great!

invenio_vocabularies/contrib/awards/schema.py Outdated Show resolved Hide resolved
@tmorrell
Copy link
Contributor

@ntarocco I think those best practices suggest using a separate field for the DOI, and URL seems the be the best fit unless we want to add a new field. But I also agree it's a separate issue and we should probably move that to a new issue.

@karkraeg
Copy link
Member Author

Hi, is something still missing here that I could help with?

@ntarocco
Copy link
Contributor

@tmorrell @karkraeg I am sorry, I did not explain well. There are some nice considerations here, see bullet points at page 20, that are worth reading, and apply to the limit of the current possibilities (and for what it makes sense) ☺️

How exactly does this relate to this PR? Shouldn't we tackle this in another issue since this one is primarily about relaxing the validation? Is there something missing still? I'd be happy to open a PR in app-rdm for the adaption of the display on the record detail page.

It was related to my comment above that was not clear. I agree it is for another PR.

@ntarocco ntarocco merged commit 5cd64bb into inveniosoftware:master Nov 25, 2024
4 checks passed
slint added a commit to zenodo/zenodo-rdm that referenced this pull request Nov 28, 2024
📁 invenio-app-rdm (13.0.0b1.dev18 -> 13.0.0b1.dev20 🌈)

    📦 release: v13.0.0b1.dev20
    config: add subcommunity invitation request notifications
    requests: add subcommunity invitation request details page
    creatibutors: added config for identifiers scheme
    release: v13.0.0b1.dev19
    communities_ui: views: Add RecordPermissionDeniedError Handler
    semantic-ui: users: header: Pass entrypoint namespace in url_for
    fix: ui: escape journal title once
    package: remove unused AUTHORS.rst (inveniosoftware/invenio-app-rdm#2735)
    records-ui: fix removing community branding

    * Closes inveniosoftware/invenio-app-rdm#2869.
    * Passes "null" instead of empty string ("") as the "default" field
      value when removing community branding from a record.
    semantic-ui: users: header: Use endpoints from config
    upgrades: remove record JSONSchema version bump
    config: removed unecessary INDEXER_DEFAULT_INDEX

📁 invenio-celery (1.3.1 -> 1.3.2 🐛)

    release: v1.3.2
    setup: upper pin packages

    * step to go forwards with flask >= 3.0

    * to have clear boundaries on the invenio packages
    docs: Typo in the example

📁 invenio-communities (17.4.0 -> 17.5.0 🌈)

    📦 release: v17.5.0
    service: add data to inivitation req

    delete unused file and add expiry to email
    service: add create_subcommunity_invitation_request

    refactor and fix bugs in sending emails
    subcommunities: add invitation actions
    subcommunities: add invitation notifications
    request: add subcommunity invitation request
    config: add LogoNotFoundError

    previously it was a generic error
    communities: config: Update static page URLs to prevent name collisions

📁 invenio-files-rest (2.2.2 -> 2.2.3 🐛)

    release: v2.2.3
    setup: change to reusable workflows
    setup: pin dependencies

📁 invenio-i18n (2.1.2 -> 2.2.0 🌈)

    release: v2.2.0
    setup: upper pin packages
    fix: my-site not overriding packages

    * the way how babel picks the translations the my-site has to be the
      last option because it overrides the entries before
    ext: add bundle entrypoint
    github: update reusable workflows

📁 invenio-logging (2.1.1 -> 2.1.2 🐛)

    release: v2.1.2
    setup: change to reusable workflows
    setup: pin dependencies

📁 invenio-rdm-records (16.2.0 -> 16.3.0 🌈)

    📦 release: v16.3.0
    github: added default license from Github API
    deposit-ui: fix affiliations rendering during edits
    release: added custom_fields
    datacite: improve error logging formatting and grouping

    * Avoids f-strings in logging calls so that entries are easier to be
      grouped.
    * Adds exception info to the logged errors.
    config: added service schema from config

    * Added the swhid field to the bibtex schema
    requests: manage sending notifications

📁 invenio-records-resources (6.4.0 -> 6.5.0 🌈)

    📦 release: v6.5.0
    queryparser: add CompositeSuggestQueryParser

    * Introduces a new query parser focused on better accuracy for
      mappings that contain search-as-you-type or ngram-analyzed fields but
      also secondary information fields that helps to
      disambiquate/narrow-down results.

📁 invenio-requests (5.3.0 -> 5.4.0 🌈)

    📦 release: v5.4.0
    refactor: clean up duplicated imports
    UI: add seperator on list of requests
    ui: add subcommunity invitation facet and label
    ux: set tab title to request title
    requests: add missing facets and reorder

📁 invenio-vocabularies (6.6.0 -> 6.7.0 🌈)

    📦 release: v6.7.0
    contrib: improve search accuracy for names, funders, affiliations
    names: add affiliation acronym in mappings and schema

    * Dereferences the affiliation `acronym` when indexing names and serving
      REST API results. This is useful for disambiguating authors in search.
    affiliations: move RDF and SPARQL as extra dependencies

    * Moves `rdflib` and `SPARQLWrapper` to extras.
    affiliation: refactored edmo datastreams
    subjects: refactoring, updated schema and test
    subjects: added datastream for gemet vocab
    awards/schema.py: read app config for alternate funding validation (inveniosoftware/invenio-vocabularies#429)
    awards: fix description field and mappings
    awards: add fields start/end date and description
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.

6 participants