Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samvera-labs/hyrax-orcid
Hyrax-Orcid is a Hyrax/Hyku based integration for ORCID.
https://github.com/samvera-labs/hyrax-orcid
hyku hyrax orcid orcid-api ruby ruby-gem ruby-on-rails samvera samvera-community
Last synced: about 2 months ago
JSON representation
Hyrax-Orcid is a Hyrax/Hyku based integration for ORCID.
- Host: GitHub
- URL: https://github.com/samvera-labs/hyrax-orcid
- Owner: samvera-labs
- License: apache-2.0
- Created: 2021-06-22T11:04:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-14T08:36:32.000Z (11 months ago)
- Last Synced: 2024-04-15T22:28:33.171Z (9 months ago)
- Topics: hyku, hyrax, orcid, orcid-api, ruby, ruby-gem, ruby-on-rails, samvera, samvera-community
- Language: Ruby
- Homepage:
- Size: 329 KB
- Stars: 2
- Watchers: 26
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# hyrax-orcid
Orcid integration for Hyrax/Hyku
## Install into your Hyrax/Hyku installation
Add the following to your Gemfile:
```ruby
gem 'hyrax-orcid', git: 'https://github.com/ubiquitypress/hyrax-orcid', branch: 'main'
```The installer will copy over any migrations and insert the assets into your applications asset pipeline. Just run the following:
```bash
bundle exec rails g hyrax:orcid:install
bundle exec rails db:migrate
```## Configuration
Add an initializer to your app with the following block:
```ruby
Hyrax::Orcid.configure do |config|
# :sandbox or :production
config.environment = :sandboxconfig.auth = {
client_id: "YOUR-APP-ID",
client_secret: "your-secret-token",
# The authorisation return URL you entered when creating the Orcid Application. Should be your repository URL and `/dashboard/orcid_identity/new`
redirect_url: "http://your-repo.com/dashboard/orcid_identity/new"
}config.bolognese = {
# The work reader method, excluding the _reader suffix
reader_method: "hyrax_json_work",
# The writer class that provides the XML body which is sent to Orcid
xml_writer_class_name: "Bolognese::Writers::Xml::WorkWriter"
}config.active_job_type = :perform_later
config.work_types = ["YourWorkType", "GenericWork"]
end
```You can also set the following ENV varibles before your app starts:
```bash
ORCID_ENVIRONMENT: sandbox
ORCID_CLIENT_ID: YOUR-APP-ID
ORCID_CLIENT_SECRET: your-secret-token
ORCID_AUTHORIZATION_REDIRECT: http://your-repo.com/dashboard/orcid_identity/new
```You can then access the values like so `reader_method = Hyrax::Orcid.configuration.bolognese[:reader_method]`
## Integration into Hyku
Hyrax Orcid is designed to be used with Hyrax, but you can also use it with Hyku if you perform a few manual tasks.
First, include the Helper methods into your application:
```ruby
include Hyrax::Orcid::HelperBehavior
```Add the assets to your application.{js, css}:
```js
//= require hyrax/orcid/application
``````css
*= require hyrax/orcid/application
```Within the Dashboard, go to `Settings/Features` and enable the Hyrax Orcid feature flipper.
### Integration into HykuAddons
HykuAddons is an opinionated addition to Hyku. Go to `Settings/Account Settings` and enter your Orcid application authorisation credentials into the correct fields under "Hyrax orcid settings".
## Activating for a model
Add the following to your work models, `include Hyrax::Orcid::WorkBehavior`.
## Testing
```bash
docker-compose exec web bundle exec rspec```
## Development
When cloning, you will need to bring in the Hyrax submodule by:
```bash
cd spec/internal_test_hyrax;
git submodule init && git submodule update
```Then you can build the application from the root folder (`cd ../../`):
```bash
docker-compose up --build web
```### First boot
By default and for the sake of simplicity, the migrations are checked each time the app starts. If you find this too slow, you can change the startup `command` in the docker-compose.yml file:
```yaml
# Comment out this line
# command: bash -c "rm -f spec/internal_test_hyrax/tmp/pids/server.pid && bundle exec rails db:create && bundle exec rails db:migrate && bundle exec rails server -b 0.0.0.0"
# Uncomment this line
command: bash -c "rm -f spec/internal_test_hyrax/tmp/pids/server.pid && bundle install && bundle exec rails server -b 0.0.0.0"
```### Potential Issues
The app uses an sqlite database which is stored inside `spec/internal_test_hyrax/db`. If you wish to nuke your app and start again, delete this file,
then you will need to ensure that the db is created, migrations are run and seeds imported before the app will start, by using something like this to start the web container:```
command: bash -c "rm -f spec/internal_test_hyrax/tmp/pids/server.pid && bundle exec rails db:create && bundle exec rails db:migrate && bundle exec rails server -b 0.0.0.0"
```You will need to create a new user before you can login. Admin users are found within the `spec/internal_test_hyrax/config/role_map.yml`. Login to the rails console and create a user:
```ruby
User.create(email: '[email protected]', password: 'test1234')
```If you get to a situation where you cannot create works, your admin set might be missing:
```ruby
rails app:hyrax:default_collection_types:create;
rails app:hyrax:default_admin_set:create
```I've had issues with the tasks, so if it's still not working, login with the Admin user and create a new Admin Set Collection manually with the title "admin_set/default"
## TODO
There are a number of outstanding items that should be addressed in the future:
### Hyrax Orcid Gem
+ JSON fields should be extracted into its own Gem allowing configuration via YML - this is on the HA developers list but time hasn't been found
### Hyku/HykuAddons related items
Because this Gem was developed to eventually work with Hyku Addons, there are a number of items that are Hyku/HykuAddons related:
+ Orcid Types are all 'other', there needs to be a map between Orcid Work Types and Hyrax Work Types, please see HyraxXmlBuilder for a list of types
+ The Orcid Contributor types need to be mapped to Hyrax Work Contributor types## To Investigate
+ What happens when a public work is published, then made restricted - I think it is likely it will fail to write the update because of the visibility check within the `PublishWorkActive`
## License
The gem is available as open source under the terms of the [Apache License 2.0](https://opensource.org/licenses/Apache-2.0).