Skip to content

Commit

Permalink
Export the approver ORCID to JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
kimrutherford committed Oct 24, 2023
1 parent 47f7591 commit 3c700f8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/Canto/Curs/Serialise.pm
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,37 @@ sub _get_metadata

my $curator_name_re = qr/(curator|approver|initial_curator|first_contact)_name$/;

my $approver_orcid = undef;

my %ret = map {
my $key = $_->key();
$key = "canto_session" if $key eq "curs_key";

($key, _get_metadata_value($curs_schema, $_->key(), $_->value() ))
} grep {
my $key = $_->key();
if ($key eq 'approver_email' && $options->{export_curator_names}) {
my $approver_email = $_->value();

my $orcid_rs = $track_schema->resultset('Person')
->search({ email_address => $approver_email });

my $person = $orcid_rs->next();

if (defined $person && $person->orcid()) {
$approver_orcid = $person->orcid();
}
}

$key !~ /email$/ &&
($options->{export_curator_names} ||
$key !~ /$curator_name_re/)
} @results;

if (defined $approver_orcid) {
$ret{approver_orcid} = $approver_orcid;
}

if (!$ret{canto_session}) {
warn "can't for curs_key in CursDB metadata\n";
confess();
Expand Down

0 comments on commit 3c700f8

Please sign in to comment.