Difference between revisions of "SCONUL Report"

From EPrints Documentation
Jump to: navigation, search
(Number of full text items held in the institutional repository, available externally)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
'''Update''': I've written a [[Departmental report script]] based on this
 +
 
For our SCONUL return this year we were asked for:
 
For our SCONUL return this year we were asked for:
  
Line 9: Line 11:
 
  perl -I ../perl_lib/ report.pl <archive_name>
 
  perl -I ../perl_lib/ report.pl <archive_name>
  
<pre>
+
<source lang="perl">
 
 
 
#!/usr/bin/perl -I/opt/eprints/eprints3/perl_lib
 
#!/usr/bin/perl -I/opt/eprints/eprints3/perl_lib
  
Line 73: Line 74:
 
print Dumper $counts;
 
print Dumper $counts;
  
</pre>
+
</source>

Latest revision as of 14:19, 16 June 2015

Update: I've written a Departmental report script based on this

For our SCONUL return this year we were asked for:

Number of full text items held in the institutional repository, available externally

  • Include all items freely available to view as full text, including pre- and post- prints, reports, theses etc., and other complete works, e.g. artistic works, datasets, etc. Include all items, not just those added during the year.

Adam Field wrote the code below, which I copied into /eprints/eprints3/bin and ran with

perl -I ../perl_lib/ report.pl <archive_name>
#!/usr/bin/perl -I/opt/eprints/eprints3/perl_lib

use strict;
use warnings;

my $date_value = '-2014-06-31'; #all dates up to June 31st 2014
use EPrints;
binmode(STDOUT, ':utf8');

my $repositoryid = $ARGV[0];
die "report.pl *repositoryid*\n" unless $repositoryid;

my $ep = EPrints->new();
my $repo = $ep->repository( $repositoryid );

die "Could not create repository object for $repositoryid\n" unless $repositoryid;

my $ds = $repo->dataset('archive');

my $search = $ds->prepare_search();

$search->add_field($ds->field('eprint_status'), 'archive');
$search->add_field($ds->field('datestamp'), $date_value);
my $list = $search->perform_search;

my $counts = {};

$list->map( sub
{
        my ($repo, $ds, $dataobj, $counts) = @_;

        my @docs = $dataobj->get_all_documents;

        my $public = 0;
        my $private = 0;
        foreach my $doc (@docs)
        {
                if ($doc->value('security') eq 'public')
                {
                        $public++;
                }
                else
                {
                        $private++;
                }
        }

        if ($public)
        {
                $counts->{public}++;
        }
        elsif ($private)
        {
                $counts->{private}++;
        }
        $counts->{total}++;

}, $counts);

use Data::Dumper;
print Dumper $counts;