Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
Departmental report script
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
Now on github!! [[https://github.com/adammoore/ep-dept-report]] We're trying to track usage of our eprints repo by department. First, we made sure to refresh the user index with: <pre> ./epadmin reindex <REPOSITORY> user </pre> Then this script gives an output to STDOUT and a CSV file - we're interested in 'new' outputs that have an eprintID over 2,000,000 but I'm sure you could use another test, such as the date in the [[SCONUL_Report]] Apologies for hacky code! save as repo-department-report.pl in your eprints bin directory Run with the following - you can capture the output with something like '' > dept-report.txt'' '''perl repo-department-report.pl <REPOSITORY>''' <pre> #!/usr/bin/perl -I/eprints/eprints3/perl_lib use strict; use warnings; use Data::Dumper; open DEPTREPORT, ">dept-report.csv" or die " can't open report file dept-report.csv: $!"; print DEPTREPORT "Department Name, Number of Staff, Total Items, Items with ID over 2M, Public Docs, Private Docs\n"; my $date_value = '-2014-06-31'; #all dates up to June 31st 2014 use EPrints; binmode(STDOUT, ':utf8'); my $repositoryid = $ARGV[0]; die "USAGE: report.pl *repositoryid* \n" unless $repositoryid ; my $ep = EPrints->new(); my $repo = $ep->repository( $repositoryid ); my $deptid; die "Could not create repository object for $repositoryid\n" unless $repositoryid; my $sql = 'select distinct DEPT from "USER"'; my $sth = $repo->get_database->prepare( $sql ); $sth->execute; while(my @row = $sth->fetchrow_array) { $deptid = @row[0]; print "Department: $deptid\n"; my $us = $repo->dataset('user'); my $usearch = $us->prepare_search(); $usearch->add_field($us->field('dept'), $deptid); my $ulist = $usearch->perform_search; my $ids = $ulist->ids; #print Dumper $ids; print $ulist->count." members of staff\n"; my $ds = $repo->dataset('archive'); my $counts = {}; foreach my $id (@$ids){ my $search = $ds->prepare_search(); #print $id." . "; $search->add_field($ds->field('eprint_status'), 'archive'); $search->add_field($ds->field('userid'), $id); my $list = $search->perform_search; $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}++; } if ($dataobj->get_value("eprintid") >2000000) {$counts->{new}++;} $counts->{total}++; }, $counts); } print Dumper $counts; if ($counts->{total}){print DEPTREPORT "\""$deptid."\" , ".$usearch->count." , ".$counts->{total}." , ".$counts->{new}." , ".$counts->{public}." , ".$counts->{private}."\n";} } close DEPTREPORT; </pre>
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)