From EPrints Documentation
Jump to: navigation, search

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/ <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 " *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')

        if ($public)
        elsif ($private)

}, $counts);

use Data::Dumper;
print Dumper $counts;