[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Re: ORCiD



All,

What we have done here at the University of Pittsburgh is added and 'orcid' field to both the user's record and the creator's field in our IR.  Additionally there are other "Author" type fields that could also use the 'orcid' field added as well such as composer, contributors, exhibitors, producers, and lyricists.  Which to me begs for these to be rolled into the creators field somehow.  

If you are going to use auto completion for the creators field make sure to tweak the lookup code to include adding the 'orcid' field or it won't populate as expected.  Additionally we've added an ORCID "pattern" validator (does not login to ORCID) to ensure we're not just accepting junk into the field.  What we haven't done yet is to validate the 'orcid' field in the user's record (just a variation of the theme), nor have we added anything into the issues_search.pl which would flag items as well (another variation). 

If the following is useful, please use as needed.  :-)

This is the code we put into eprint_validate.pl:

        # ORCID ID Validator for individuals
        # Reference: http://support.orcid.org/knowledgebase/articles/116780-structure-of-the-orcid-identifier
        # REGEX: ^\d{4}-\d{4}-\d{4}-(\d{3}X|\d{4})$
        #
        my @name_fields = qw( creators contributors etdcommittee exhibitors producers conductors lyricists );
        foreach my $name_field ( @name_fields )
        {
           if( $eprint->is_set( $name_field ) )
           {
              foreach my $creator ( @{ $eprint->value( $name_field ) } )
              {
                 my $orcid = $creator->{orcid};
                 next unless defined $orcid;
                 if ($session->get_repository->can_call ( "validators", "isValidORCID" ) )
                 {
                    if (!$session->get_repository->call( [ "validators", "isValidORCID" ], $orcid ))
                    {
                       my $field_text = $session->html_phrase( "eprint_fieldname_$name_field" );
                       my $field_frag = $session->make_element( "span", class=>"ep_problem_field:$name_field" );
                       $field_frag->appendChild($field_text);
                       push @problems, $session->html_phrase( "warnings:orcid_invalid",
                            orcid => $session->get_repository->make_text($orcid),
                            field => $field_frag,
                        );
                    }
                 } else {
                    $session->get_repository->log( "Can not call isValidORCID." );
                 }
              }
           }
        }

And we added this function after the last "};" in the file.

############################################
# Function:     isValidORCID
# Description:  Used to validate ORCID IDs
#
$c->{validators}->{isValidORCID} = sub {
   my $ORCID = $_[0];
   #Check for valid length of 19 characters.
   my $size = length($ORCID);
   if ($size > 19 )
   {
        return 0;
   } else {
      $ORCID =~ s/\-//g;
      my @chars = split(//, $ORCID);
      my $total = 0;
      for ( my $i=0; $i<15; $i++) {
         $total = ($total + $chars[$i]) *2;
      }
      my $remainder = $total % 11;
      my $result = (12 - $remainder) % 11;
      return ($chars[15] == ($result==10 ? 'X' : $result))
   }



Hope this helps someone.  
Cheers!
-Brian.

Brian D. Gregg
Solutions Architect | Manager Systems Development
University of Pittsburgh | University Library System
Address: 7500 Thomas Blvd.  Room 129 Pittsburgh, PA 15208
Tel: (412) 648-3264 | Email: bdgregg at pitt.edu | Fax: (412) 648-3585

-----Original Message-----
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of Lizz Jennings
Sent: Friday, January 16, 2015 9:13 AM
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] Re: ORCiD

I created an additional sub-field as I still wanted to capture email addresses, and ORCID isn't all that widely used here yet.

Lizz

--
Lizz Jennings BA MSc ACLIP MCLIP (Revalidated 2014) Technical Data Officer The Library 4.10, University of Bath, Bath, BA2 7AY UK Ext. 3570 (External 01225 383570) E.Jennings at bath.ac.uk Research Data Management: http://www.bath.ac.uk/research/data


-----Original Message-----
From: eprints-tech-bounces at ecs.soton.ac.uk [mailto:eprints-tech-bounces at ecs.soton.ac.uk] On Behalf Of John Salter
Sent: 16 January 2015 14:10
To: eprints-tech at ecs.soton.ac.uk
Subject: [EP-tech] ORCiD

Hi,
How is anyone storing an ORCiD in EPrints?

Out-of-the-box, EPrints has creators with a name component, and an id component.
The default name of this field is 'Email':
https://github.com/eprints/eprints/blob/3.3/lib/lang/en/phrases/system.xml#L396

I was thinking or using it to store the ORCiD instead of the email address, but didn't know if any 'best practice' was emerging yet?

Cheers,
John



*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/