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

Add ROR Support for Institutions #2135

Open
wants to merge 50 commits into
base: main
Choose a base branch
from
Open

Add ROR Support for Institutions #2135

wants to merge 50 commits into from

Conversation

whomingbird
Copy link
Contributor

ROR (Research Organization Registry) is an open, community-driven registry of research organizations worldwide. It provides a unique, persistent identifier (ROR ID) for institutions, making it easier to disambiguate organizations in research data. ROR IDs are openly available, interoperable with other identifier systems (like ORCID and CrossRef), and designed for integration into research workflows.

This PR introduces ROR support in the institutions module. Users can enter institution data in three ways:

  • Search by Institution Name – Type the institution's title and select it from the suggested list.
  • Enter a ROR ID – Retrieve institution data by entering its ROR ID.
  • Manual Entry – If the institution does not have a ROR ID, manually fill in the required fields.

The metadata for options 1 and 2 is fetched directly from ROR's API.

Additionally, ROR integration has been extended to project creation, enabling users to associate projects with institutions—either from locally stored data or dynamically fetched from ROR.

Improvements in Details

  • Database
    Added a new column ror_id to the institutions table.
    Ensured ror_id is unique for institutions.

  • UI
    Added the new input field of ROR ID
    The ROR ID is displayed as a clickable link in the institution details.
    Added a "clear fields" button when creating institutions.
    Disabled input fields when
    metadata is loaded either from locally stored data
    or dynamically fetched from ROR.
    or editing an institution with an existing ROR ID.
    Improved CSS and JavaScript for better responsiveness.

  • Functionality

Users can type an institution name and see a suggested list with ROR data.
ROR ID validation implemented to prevent incorrect entries.
Improved error messages when an invalid ROR ID is entered.
Users can fetch institution metadata via ROR ID.
When creating an institution along with a project, the ROR ID is now saved properly.
Converted country codes to full country names for better readability.

  • API

Added ror_id to the Institution API (Read/Write).
Updated API examples to include the new ror_id attribute.

…uggestion list. Automatically extract and populate metadata fields (e.g., ROR ID, city, country, webpage) based on the selected institution.
…itution search

- Modify the UI to allow users to select an existing institution or add a new one when creating a project.
- Integrate local institution search from SEEK system.
- Implement remote institution search via ROR API.
- Use typeahead for enhanced user experience with suggestions from both local and remote datasets.
@@ -83,4 +83,6 @@
//= require copasi/copasi_simulation
//= require plotly-2.27.0.min
//= require extended_metadata_type

//= require ror/ror-flat-min
//= require ror/typeahead
Copy link
Member

Choose a reason for hiding this comment

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

can be removed. typeahead.js.js in vendor is referenced above

@@ -0,0 +1,2451 @@
/*!
Copy link
Member

Choose a reason for hiding this comment

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

this already exists under vendor\assets as part of the rails-assets. It is a slightly older version but it may be possible to just copy this file over

@@ -0,0 +1,190 @@
/* scaffolding */
Copy link
Member

Choose a reason for hiding this comment

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

this should be stripped down to css that is relevant to the ROR work. A lot of it is css that will affect the entiire site - such body, html, a etc

# override with existing institution if already exists with same title, it could have been created since the request was made
@institution = Institution.find_by(title: @institution.title) if Institution.find_by(title: @institution.title)
# override with existing institution if already exists with same title or ROR ID, it could have been created since the request was made
@institution = Institution.find_by(ror_id: @institution.ror_id) if [email protected]_id.blank? && Institution.find_by(ror_id: @institution.ror_id)
Copy link
Member

Choose a reason for hiding this comment

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

this should be restructured into a clearer if and else, rather than checking if @institution.id is still nil

typeahead: { query_url: typeahead_institutions_path,
handlebars_template:'typeahead/institution' },
limit: 1, allow_new: true, class: 'form-control') -%>
<label class="control-label">Type the name of the <%= t('institution'.downcase) %> </label><span class="required">*</span>
Copy link
Member

Choose a reason for hiding this comment

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

.downcase should be outside the bracket

@whomingbird whomingbird requested a review from stuzart February 10, 2025 18:15
</div>
<div class="form-group">
<%= f.label :country -%>
<%= f.text_field :country, value: @institution.nil? ? nil:CountryCodes.country(@institution.country), :class=>"form-control" -%>
Copy link
Member

Choose a reason for hiding this comment

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

wouldn't this be better using f.country_select to make it safter to select a valid country and country-code rather than typing it in?

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.

2 participants