EPrints Technical Mailing List Archive
Message: #06988
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] REF Compliance Checker Plugin
- To: "eprints-tech@ecs.soton.ac.uk" <eprints-tech@ecs.soton.ac.uk>
- Subject: Re: [EP-tech] REF Compliance Checker Plugin
- From: Andrew Beeken <anbeeken@lincoln.ac.uk>
- Date: Thu, 30 Nov 2017 12:37:46 +0000
Ah, so if it’s setting the value incorrectly based on our set up then that value will always be incorrect unless we put in something to override that. Okay, so I’ve tested some things by commenting out that part of the logic and it’s definitely running my script. I think the issue is certainly that I was testing it on records that had already had
their values set. So, what we need to do, I guess, is make sure our custom logic is right, put the plugin on live, add our custom code and then hit recommit before anyone does anything that’s going to add these two dates? The logic we’re working on is: For First Compliant Deposit –
Is the document accepted or published? Set the date based on the datestamp of the record For First Compliant Open Access – Is the document a Whole Document? Is it accepted or published? Is it public? Set the date based on the embargo date of the document OR the datestamp of the record if there is no embargo date on the document And my code is: # date of first compliant deposit - this uses our value of "stage" $c->add_dataset_trigger( 'eprint', EPrints::Const::EP_TRIGGER_BEFORE_COMMIT, sub { my( %args ) = @_;
my( $repo, $eprint, $changed ) = @args{qw( repository dataobj changed )}; # trigger only applies to repos with hefce_oa plugin enabled return unless $eprint->dataset->has_field( "hoa_compliant" ); return if $eprint->is_set( "hoa_date_fcd" ); return if $eprint->value( "eprint_status" ) eq "inbox"; for( $eprint->get_all_documents ) { next unless $_->is_set( "stage" ); next unless $_->value( "stage" ) eq "accepted" || $_->value( "stage" ) eq "published"; $eprint->set_value( "hoa_date_fcd", $eprint->value( "datestamp" ) ); $eprint->set_value( "hoa_version_fcd", $_->value( "stage" ) eq "accepted" ? "AM" : "VoR" ); } }, priority => 100 ); # date of first compliant open access $c->add_dataset_trigger( 'eprint', EPrints::Const::EP_TRIGGER_BEFORE_COMMIT, sub { my( %args ) = @_;
my( $repo, $eprint, $changed ) = @args{qw( repository dataobj changed )}; # trigger only applies to repos with hefce_oa plugin enabled return unless $eprint->dataset->has_field( "hoa_compliant" ); return unless $eprint->is_set( "hoa_date_fcd" ); return if $eprint->is_set( "hoa_date_foa" ); for( $eprint->get_all_documents ) { next unless $_->is_set( "content" ); next unless $_->value( "content" ) eq " whole_document"; next unless $_->is_set( "stage" ); next unless $_->value( "stage" ) eq "accepted" || $_->value( "stage" ) eq "published"; next unless $_->is_public; if($_->isset( "date_embargo" )) { $eprint->set_value( "hoa_date_foa", $_->value( "date_embargo" ) ); } else { $eprint->set_value( "hoa_date_foa", $eprint->value( "datestamp" ) ); } } }, priority => 200 ); However I can’t seem to get the trigger for the foa to register anything. I’ll try your suggestion of dropping some outputs into the loop to see what steps it’s hitting but if you can see anything
glaring in my logic please let me know. I’m also not sure if the logic will really work with embargo dates as they need to be in the future – if that is the case then the document won’t be public and won’t satisfy that step of the logic… I think I’m finally starting to understand some of this, though… literally weeks before I’m due to move away from it… :rolleyes: From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Alan.Stiles It does exactly that – it sets it the first time and then doesn’t change it. The easiest (dirty) way I’ve found to check it’s processing my override code is to put a
print STDERR “My Local Override_Function_Name: Doing this bit now\n”; in the function, which should then appear in the apache error log. From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Andrew Beeken Actually, looking at the code in more detail, for example this trigger (my modified version): # date of first compliant deposit - this uses our value of "stage" $c->add_dataset_trigger( 'eprint', EPrints::Const::EP_TRIGGER_BEFORE_COMMIT, sub { my( %args ) = @_;
my( $repo, $eprint, $changed ) = @args{qw( repository dataobj changed )}; # trigger only applies to repos with hefce_oa plugin enabled return unless $eprint->dataset->has_field( "hoa_compliant" ); return if $eprint->is_set( "hoa_date_fcd" ); return if $eprint->value( "eprint_status" ) eq "inbox"; for( $eprint->get_all_documents ) { next unless $_->is_set( "stage" ); next unless $_->value( "stage" ) eq "accepted" || $_->value( "stage" ) eq "published"; $eprint->set_value( "hoa_date_fcd", $_->value( "datestamp" ) ); $eprint->set_value( "hoa_version_fcd", $_->value( "stage" ) eq "accepted" ? "AM" : "VoR" ); } }, priority => 100 ); Does the line return if $eprint->is_set( "hoa_date_fcd" ); mean that if the date is already set, it won’t be recalculated? From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of Andrew Beeken Thanks John! Okay, I’ve made some progress on this but I’m coming a little unstuck on the Date of First Compliant Deposit and Date of First Compliant Open Access. So, for both of these I’ve needed to make a alight adjustment as we store our “accepted”, “published” etc in a variable called “stage”. No problem, I’ve switched “content” up for “stage” and I’m
getting a date through now based, looking at the code, on EPrints::Time::get_iso_date(). The issue I have is that in all instances this is showing as todays date. Speaking to Bev about how she wants this to work, she’s expecting to see: First Compliant Deposit – the date the record was created, so I assume the datestamp value of the record? First Compliant Open Access – the date the record was created OR the embargo date if one is set. Once I’ve got these setting as expected I think I can get this deployed. Any thoughts? From:
eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk]
On Behalf Of John Salter Hi Andrew, From:
eprints-tech-bounces@ecs.soton.ac.uk <eprints-tech-bounces@ecs.soton.ac.uk>
on behalf of Andrew Beeken <anbeeken@lincoln.ac.uk> Hi all! Putting some final bits into place before I retire from the repository work in 2018, I’m now looking at the REF Compliance Checker Plugin (http://eprintsug.github.io/hefce_oa/). One of
the things I’ve noticed is that the plugin doesn’t seem to be picking up some of our specific workflow modifications which is to be expected. With the RIOXX plugin I was able to change the fields that were being looked at however I can’t seem to see an obvious
way to do this in the documentation. Any thoughts? Cheers! Andrew
-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority
in relation to its secondary activity of credit broking. |
- References:
- [EP-tech] REF Compliance Checker Plugin
- From: Andrew Beeken <anbeeken@lincoln.ac.uk>
- Re: [EP-tech] REF Compliance Checker Plugin
- From: John Salter <J.Salter@leeds.ac.uk>
- Re: [EP-tech] REF Compliance Checker Plugin
- From: Andrew Beeken <anbeeken@lincoln.ac.uk>
- Re: [EP-tech] REF Compliance Checker Plugin
- From: Andrew Beeken <anbeeken@lincoln.ac.uk>
- Re: [EP-tech] REF Compliance Checker Plugin
- From: "Alan.Stiles" <alan.stiles@open.ac.uk>
- [EP-tech] REF Compliance Checker Plugin
- Prev by Date: Re: [EP-tech] REF Compliance Checker Plugin
- Next by Date: Re: [EP-tech] validation on upload field
- Previous by thread: Re: [EP-tech] REF Compliance Checker Plugin
- Next by thread: Re: [EP-tech] REF Compliance Checker Plugin
- Index(es):