ORCID
This page has been created to gather information about how different EPrints repositories have integrated ORCID. At this time (April 2016) there doesn't seem to be a 'best practice' approach that has been adopted widely - this will hopefully change over time.
If you are looking to retrieve publications from the ORCID service, the Import from ORCID (Tier 1 API) Bazaar package, or the ORCID Tier 2 api framework are good places to start.
Some aspects that need to be considered when adopting ORCIDs, and making them available to other systems are:
- storing the ORCID (see: http://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier)
- rendering the ORCID in abstract pages (see link above)
- exposing ORCIDs over OAI-PMH metadata profiles e.g. RIOXX
NB The examples below may refer to the 'creators' field - but the same approach could be used to extend other 'person' fields - e.g. contributors.
Contents
Re-using creators.id subfield
The creators.id field is labelled 'email' by default, but as it's an 'id' type field, it can be used to store ORCIDs.
To re-label the field, a simple addition to a phrase file in archives/ARCHIVEID/cfg/lang/en/phrases/
needs to be made:
<epp:phrase id="eprint_fieldname_creators_id">ORCID / Creators email (if known)</epp:phrase>
Rendering the ORCID in a citation
The rendering of this field then needs to be changed to accommodate an author with an ORCID. The following script adds methods that can be called via the EPScript language:
# add to e.g. ~/archives/ARCHIVEID/cfg/cfg.d/z_add_to_EPrints_Script_Compiled.pl
# Write into EPrints::Script::Compiled package to allow use of function in epscript
{
package EPrints::Script::Compiled;
use strict;
sub run_wrro_people_with_orcids
{
my( $self, $state, $value ) = @_;
my $session = $state->{session};
my $r = $state->{session}->make_doc_fragment;
my $creators = $value->[0];
foreach my $i (0..$#$creators){
my $creator = @$creators[$i];
if( $i > 0 ){
#not first item (or only one item)
if( $i == $#$creators ){
#last item
$r->appendChild( $session->make_text( " and " ) );
} else {
$r->appendChild( $session->make_text( ", " ) );
}
}
my $person_span = $session->make_element( "span", "class" => "person" );
$person_span->appendChild( $session->render_name( $creator->{name} ) );
my $id = $creator->{id};
if( defined $id && $id =~ m/^(?:orcid.org\/)?(\d{4}\-\d{4}\-\d{4}\-\d{3}(?:\d|X))$/ )
{
my $orcid_span = $session->make_element( "span", "class" => "orcid" );
# According to https://orcid.org/trademark-and-id-display-guidelines
# "recommended display is a hyperlinked URI preceded by the iD icon"
# This looks terrible in a citation. Removed for the time being.
#
# my $orcid_link = $session->make_element(
# "a",
# "href" => "http://orcid.org/",
# "target" => "_blank",
# "class" => "orcid-icon"
# );
# $orcid_link->appendChild( $session->make_element(
# "img",
# "src" => "/images/orcid_16x16.png",
# "title" => "ORCID"
# ) );
# $orcid_span->appendChild( $orcid_link );
my $link = $session->make_element(
"a",
"href" => "http://orcid.org/$1",
"target" => "_blank",
);
$link->appendChild( $session->make_text( "orcid.org/$1" ) );
$orcid_span->appendChild( $session->make_text( "(" ) );
$orcid_span->appendChild( $link );
$orcid_span->appendChild( $session->make_text( ")" ) );
$person_span->appendChild( $session->make_text( " " ) );
$person_span->appendChild( $orcid_span );
}
$r->appendChild( $person_span );
}
return [ $r, "XHTML" ];
}
}
# END EPrints::Script::Compiled additions
You may also want a bit of CSS to style ORCID links
/* Add to e.g. ~/archives/ARCHIVEID/cfg/static/style/auto/zzz_orcid.css */
.person:hover {border-bottom: 1px dashed #a6ce39;}
.orcid {}
.orcid a:hover {
color: #a6ce39;
}
.orcid-icon {}
.orcid-icon img { vertical-align: text-bottom; margin: 0 4px 0 2px; }
And finally, you have to call the new EPScript function from a citation file e.g. archives/ARCHIVEID/cfg/citations/eprint/default.xml
<!-- replace reference to e.g. <print expr="creators_name"/> with this: -->
<print expr="wrro_people_with_orcids(creators)" />
Exposing the ORCID in RIOXX
Based on re-using the creators.id field, this block of code over-writes the default rioxx2_value_author
function.
# Add to e.g. ~/archives/ARCHIVEID/cfg/cfg.d/zzz_rioxx2_overwrites.pl
$c->{rioxx2_value_author} = sub {
my( $eprint ) = @_;
my @authors;
for( @{ $eprint->value( "creators" ) } )
{
my $id = $_->{id};
if( defined $id && $id =~ m/^(?:orcid.org\/)?(\d{4}\-\d{4}\-\d{4}\-\d{3}(?:\d|X))$/ )
{
push @authors, {
author => EPrints::Utils::make_name_string( $_->{name} ),
id => "http://orcid.org/$1"
};
} else {
push @authors, {
author => EPrints::Utils::make_name_string( $_->{name} ),
};
}
}
#NB If your corp_creators has DOIs or ISNIs for the entries, a similar method could be used to include these here.
foreach my $corp ( @{ $eprint->value( "corp_creators" ) } )
{
my $entry = {};
$entry->{name} = $corp;
push @authors, { author => $corp };
}
return \@authors;
};
Add additional identifiers to creators
Another approach to storing ORCIDs is to add an additional sub-field to the creator field. This has been discussed on the Eprints tech list. If you know how to do this, please document it here!
This is how University of Bath has done it. We're getting the ORCID data from another system, so have used a text field to capture it for display. At present there is no special rendering on it, it's just displaying as a number.
{
name => 'creators',
type => 'compound',
multiple => 1,
fields => [
{
sub_name => 'name',
type => 'name',
hide_honourific => 1,
hide_lineage => 1,
family_first => 1,
},
{
sub_name => 'id',
type => 'text',
input_cols => 20,
allow_null => 1,
},
{
sub_name => 'orcid',
type => 'text',
input_cols => 20,
allow_null => 1,
}
],
input_boxes => 4,
},