Select Git revision
sample_testing.pm 11.77 KiB
package SLUB::LZA::TA::Command::sample_testing;
use SLUB::LZA::TA -command;
use v5.36;
use utf8;
use SLUB::LZA::TA::Archivematica::Elasticsearch;
use SLUB::LZA::TA::Archivematica::Elasticsearch::PrepareQuery;
use SLUB::LZA::TA::Output;
use Archive::BagIt::Fast;
use Date::Calc qw(Date_to_Time Today Add_Delta_YM Add_Delta_YMD Day_of_Week);
use List::Util qw(sample);
use namespace::autoclean -except => qr{SLUB::LZA::TA::.*};
# VERSION
# ABSTRACT: sample testing module for ta-tool
sub abstract { return "tests samples of AIPs in current Archival Information System (AIS)";}
my $base_cmd = "$0 sample-test";
my $dummycmd = " "x length($base_cmd);
my $description=<<"DESCR";
Ask an AIS for a sample of AIPs and tests them.
Overview:
$base_cmd [--daily| --weekly | --monthly | --yearly] [--workflow WORKFLOW] [--factor FACTOR]
$dummycmd --version
$dummycmd --help
Examples:
* Report sample testing statistics of AIPs last month for workflow Kitodo
'$base_cmd --monthly --workflow Kitodo'
* Report 1‰ sample statistics of AIPs last year
'$base_cmd --yearly --factor 0.001'
A printable PDF version could be generated using ff. commands:
'$base_cmd | asciidoctor-pdf - > report.pdf'
HINT: If you want lists, use the 'search' command instead!
HINT: ensure the ElasticSearch server allows to return >10.000 results if your archive is large
DESCR
sub description {
return "$description"
}
sub opt_spec {
my @global_opts= SLUB::LZA::TA::common_global_opt_spec();
my @local_opts = (
[ 'datemode' => hidden => {
one_of => [
[ 'daily|d' => 'sample based on last day'],
[ 'weekly|W' => 'sample based on last week'],
[ 'monthly|m' => 'sample based on last month' ],
[ 'yearly|y' => 'sample based on last year' ],
[ 'ldpyearly' => 'sample based on last LDP year 01.11. - 31.10.'],
[ 'complete|c'=> 'sample based on all AIPs (default)'],
[ 'date-from=s' => 'sample based on date range, beginning date in format "YYYY-MM-DD", implies "--date-to"'],
],
},
],
[ 'date-to=s' => 'report based on date range, end date in format "YYYY-MM-DD", implies "--date-from"'],
[],
[ 'output-format' => hidden => {
one_of => [
[ 'output-as-csv|C' => 'prints output as Comma Separated Values (CSV)' ],
[ 'output-as-raw|R' => 'print raw hash output' ],
[ 'output-as-rsv|r' => 'prints output as Raw Strings Values (RSV)' ],