Bugzilla – Attachment 186062 Details for
Bug 39345
Koha must support COUNTER 5.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39345: Add COUNTER 5.1 Tests
Bug-39345-Add-COUNTER-51-Tests.patch (text/plain), 83.12 KB, created by
Pedro Amorim
on 2025-09-03 09:41:37 UTC
(
hide
)
Description:
Bug 39345: Add COUNTER 5.1 Tests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-09-03 09:41:37 UTC
Size:
83.12 KB
patch
obsolete
>From c755ca87e9960296d1357e7370f722d882eefeff Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Tue, 12 Aug 2025 12:46:00 +0000 >Subject: [PATCH] Bug 39345: Add COUNTER 5.1 Tests > >JSON data files extracted from sample responses at: >https://counter5.cambridge.org/r51/sushi-docs/#/ > >Additional docs referenced: >https://cop5.projectcounter.org/en/5.1/appendices/g-sample-counter-reports-and-standard-views.html > >Run: >prove t/db_dependent/Koha/ERM/EUsage/* > >Signed-off-by: Eric Phetteplace <phette23@gmail.com> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t | 133 +++ > .../ERM/EUsage/COUNTER_5.1/SushiCounter.t | 1031 +++++++++++++++++ > .../data/erm/eusage/COUNTER_5.1/TR_B2.json | 101 ++ > .../data/erm/eusage/COUNTER_5.1/TR_B3.json | 147 +++ > .../data/erm/eusage/COUNTER_5.1/TR_J1.json | 104 ++ > .../data/erm/eusage/COUNTER_5.1/TR_J2.json | 96 ++ > .../data/erm/eusage/COUNTER_5.1/TR_J3.json | 170 +++ > .../data/erm/eusage/COUNTER_5.1/TR_J4.json | 83 ++ > 8 files changed, 1865 insertions(+) > create mode 100755 t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t > create mode 100755 t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/SushiCounter.t > create mode 100644 t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B2.json > create mode 100644 t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B3.json > create mode 100644 t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J1.json > create mode 100644 t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J2.json > create mode 100644 t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J3.json > create mode 100644 t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J4.json > >diff --git a/t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t b/t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t >new file mode 100755 >index 00000000000..05a603bbdf1 >--- /dev/null >+++ b/t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t >@@ -0,0 +1,133 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+# use Test::NoWarnings; >+use Test::More tests => 2; >+ >+use Koha::Database; >+use Koha::ERM::EUsage::CounterFile; >+ >+use JSON qw( decode_json ); >+use File::Basename qw( dirname ); >+use File::Slurp; >+ >+use t::lib::Mocks; >+use t::lib::TestBuilder; >+use Test::MockModule; >+ >+my $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+my $sushi_response_file_TR_J1 = dirname(__FILE__) . "/../../../../data/erm/eusage/COUNTER_5.1/TR_J1.json"; >+my $sushi_counter_51_response_TR_J1 = read_file($sushi_response_file_TR_J1); >+my $sushi_counter_report_TR_J1 = >+ Koha::ERM::EUsage::SushiCounter->new( { response => decode_json($sushi_counter_51_response_TR_J1) } ); >+ >+subtest 'store' => sub { >+ >+ plan tests => 3; >+ >+ $schema->storage->txn_begin; >+ >+ my $patron = Koha::Patrons->search()->last; >+ t::lib::Mocks::mock_userenv( { number => $patron->borrowernumber } ); # Is superlibrarian >+ >+ my $usage_data_provider = $builder->build_object( >+ { class => 'Koha::ERM::EUsage::UsageDataProviders', value => { name => 'TestProvider' } } ); >+ $usage_data_provider->{report_type} = 'TR_J1'; >+ >+ my $now_time = POSIX::strftime( "%Y%m%d%H%M%S", localtime ); >+ >+ my $counter_file = Koha::ERM::EUsage::CounterFile->new( >+ { >+ usage_data_provider_id => $usage_data_provider->erm_usage_data_provider_id, >+ file_content => $sushi_counter_report_TR_J1->get_COUNTER_from_SUSHI, >+ date_uploaded => $now_time, >+ filename => $usage_data_provider->name . "_" . $usage_data_provider->{report_type}, >+ } >+ )->store; >+ >+ # UsageTitles are added on CounterFile->store >+ my $titles_rs = Koha::ERM::EUsage::UsageTitles->search( >+ { usage_data_provider_id => $usage_data_provider->erm_usage_data_provider_id } ); >+ >+ # MonthlyUsages are added on CounterFile->store >+ my $mus_rs = Koha::ERM::EUsage::MonthlyUsages->search( >+ { usage_data_provider_id => $usage_data_provider->erm_usage_data_provider_id } ); >+ >+ # YearlyUsages are added on CounterFile->store >+ my $yus_rs = Koha::ERM::EUsage::YearlyUsages->search( >+ { usage_data_provider_id => $usage_data_provider->erm_usage_data_provider_id } ); >+ >+ is( $titles_rs->count, 2, '2 titles were added' ); >+ is( $mus_rs->count, 10, '10 monthly usages were added' ); >+ is( $yus_rs->count, 4, '4 yearly usages were added' ); >+ >+ $schema->storage->txn_rollback; >+ >+ #TODO: Test yop >+ #TODO: acccess_type >+ >+}; >+ >+subtest '_get_rows_from_COUNTER_file' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $usage_data_provider = $builder->build_object( >+ { class => 'Koha::ERM::EUsage::UsageDataProviders', value => { name => 'TestProvider' } } ); >+ $usage_data_provider->{report_type} = 'TR_J1'; >+ >+ my $now_time = POSIX::strftime( "%Y%m%d%H%M%S", localtime ); >+ >+ my $counter_file = $builder->build_object( >+ { >+ class => 'Koha::ERM::EUsage::CounterFiles', >+ value => { >+ usage_data_provider_id => $usage_data_provider->erm_usage_data_provider_id, >+ file_content => $sushi_counter_report_TR_J1->get_COUNTER_from_SUSHI, >+ date_uploaded => $now_time, >+ filename => $usage_data_provider->name . "_" . $usage_data_provider->{report_type}, >+ } >+ } >+ ); >+ >+ my $counter_file_rows = $counter_file->_get_rows_from_COUNTER_file; >+ >+ is( ref $counter_file_rows, 'ARRAY', '_get_rows_from_COUNTER_file returns array' ); >+ is( >+ scalar @{$counter_file_rows}, 4, >+ '_get_rows_from_COUNTER_file returns correct number of rows' >+ ); >+ is( >+ @{$counter_file_rows}[0]->{Title}, 'Education and Training', >+ 'first and second report row is about the same title' >+ ); >+ is( >+ @{$counter_file_rows}[1]->{Title}, 'Education and Training', >+ 'first and second report row is about the same title' >+ ); >+ >+ $schema->storage->txn_rollback; >+ >+}; >diff --git a/t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/SushiCounter.t b/t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/SushiCounter.t >new file mode 100755 >index 00000000000..da8beca5956 >--- /dev/null >+++ b/t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/SushiCounter.t >@@ -0,0 +1,1031 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+# use Test::NoWarnings; >+use Test::More tests => 18; >+ >+use Koha::ERM::EUsage::SushiCounter; >+use Koha::Database; >+use JSON qw( decode_json ); >+use File::Basename qw( dirname ); >+use File::Slurp; >+ >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+my $builder = t::lib::TestBuilder->new; >+ >+my $test_data_base_dir = "/../../../../data/erm/eusage/COUNTER_5.1"; >+my $sushi_response_file_TR_J1 = dirname(__FILE__) . $test_data_base_dir . "/TR_J1.json"; >+my $sushi_counter_51_response_TR_J1 = decode_json( read_file($sushi_response_file_TR_J1) ); >+my $sushi_counter_TR_J1 = >+ Koha::ERM::EUsage::SushiCounter->new( { version => '5.1', response => $sushi_counter_51_response_TR_J1 } ); >+ >+subtest 'TR_J1 _COUNTER_report_header' => sub { >+ >+ plan tests => 43; >+ >+ my @report_header = $sushi_counter_TR_J1->_COUNTER_report_header; >+ >+ # Header row #1 - Report_Name >+ is( $report_header[0][0], 'Report_Name', '1st row is report name' ); >+ is( $report_header[0][1], 'Journal Requests (Excluding OA_Gold)', '1st row is report name' ); >+ is( $report_header[0][2], undef, '1st row is report name' ); >+ >+ # Header row #2 - Report_ID >+ is( $report_header[1][0], 'Report_ID', '2nd row is report name' ); >+ is( $report_header[1][1], 'TR_J1', '2nd row is report name' ); >+ is( $report_header[1][2], undef, '2nd row is report name' ); >+ >+ # Header row #3 - Release >+ is( $report_header[2][0], 'Release', '3rd row is counter release' ); >+ is( $report_header[2][1], '5.1', '3rd row is counter release' ); >+ is( $report_header[2][2], undef, '3rd row is counter release' ); >+ >+ # Header row #4 - Institution_Name >+ is( $report_header[3][0], 'Institution_Name', '4th row is institution name' ); >+ is( $report_header[3][1], 'Test Institution', '4th row is institution name' ); >+ is( $report_header[3][2], undef, '4th row is institution name' ); >+ >+ # Header row #5 - Institution_ID >+ is( $report_header[4][0], 'Institution_ID', '5th row is institution id' ); >+ like( $report_header[4][1], qr/Proprietary:TInsti:EALTEST001|ISNI:0000000123456789/, '5th row is institution id' ); >+ is( $report_header[4][2], undef, '5th row is institution id' ); >+ >+ # Header row #6 - Metric_Types >+ is( $report_header[5][0], 'Metric_Types', '6th row is metric types' ); >+ is( $report_header[5][1], 'Total_Item_Requests; Unique_Item_Requests', '6th row is metric types' ); >+ is( $report_header[5][2], undef, '6th row is metric types' ); >+ >+ # Header row #7 - Report_Filters >+ is( $report_header[6][0], 'Report_Filters', '7th row is report filters' ); >+ like( $report_header[6][1], qr/End_Date:2022-09-30/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Access_Method:Regular/, '7th row is report filters' ); >+ like( >+ $report_header[6][1], qr/Metric_Type:Total_Item_Requests\|Unique_Item_Requests/, >+ '7th row is report filters' >+ ); >+ like( $report_header[6][1], qr/Data_Type:Journal/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Begin_Date:2021-09-01/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Access_Type:Controlled/, '7th row is report filters' ); >+ is( $report_header[6][2], undef, '7th row is report filters' ); >+ >+ # Header row #8 - Report_Attributes >+ is( $report_header[7][0], 'Report_Attributes', '8th row is report attributes' ); >+ is( $report_header[7][1], '', '8th row is report attributes' ); >+ is( $report_header[7][2], undef, '8th row is report attributes' ); >+ >+ # Header row #9 - Exceptions >+ is( $report_header[8][0], 'Exceptions', '9th row is exceptions' ); >+ is( $report_header[8][1], '', '9th row is exceptions' ); >+ is( $report_header[8][2], undef, '9th row is exceptions' ); >+ >+ # Header row #10 - Reporting_Period >+ is( $report_header[9][0], 'Reporting_Period', '10th row is reporting period' ); >+ is( $report_header[9][1], 'Begin_Date=2021-09-01; End_Date=2022-09-30', '10th row is reporting period' ); >+ is( $report_header[9][2], undef, '10th row is reporting period' ); >+ >+ # Header row #11 - Created >+ is( $report_header[10][0], 'Created', '11th row is created' ); >+ is( $report_header[10][1], '2023-08-29T07:11:41Z', '11th row is created' ); >+ is( $report_header[10][2], undef, '11th row is created' ); >+ >+ # Header row #12 - Created >+ is( $report_header[11][0], 'Created_By', '12th row is created by' ); >+ is( $report_header[11][1], 'Test Systems Inc.', '12th row is created by' ); >+ is( $report_header[11][2], undef, '12th row is created by' ); >+ >+ # Header row #13 - Registry_Record >+ is( $report_header[12][0], 'Registry_Record', '13th row is empty' ); >+ >+ # Header row #14 - This needs to be empty >+ is( $report_header[13][0], '', '14th row is empty' ); >+}; >+ >+subtest 'TR_J1 _COUNTER_report_column_headings' => sub { >+ >+ plan tests => 19; >+ >+ my @report_column_headings = $sushi_counter_TR_J1->_COUNTER_report_column_headings; >+ >+ # Standard TR_J1 column headings >+ is( $report_column_headings[0][0], 'Title', '1st column heading is title' ); >+ is( $report_column_headings[0][1], 'Publisher', '2nd column heading is publisher' ); >+ is( $report_column_headings[0][2], 'Publisher_ID', '3rd column heading is publisher ID' ); >+ is( $report_column_headings[0][3], 'Platform', '4th column heading is platform' ); >+ is( $report_column_headings[0][4], 'DOI', '5th column heading is DOI' ); >+ is( $report_column_headings[0][5], 'Proprietary_ID', '6th column heading is proprietary ID' ); >+ is( $report_column_headings[0][6], 'Print_ISSN', '7th column heading is print ISSN' ); >+ is( $report_column_headings[0][7], 'Online_ISSN', '8th column heading is online ISSN' ); >+ is( $report_column_headings[0][8], 'URI', '9th column heading is URI' ); >+ is( $report_column_headings[0][9], 'Metric_Type', '10th column heading is metric type' ); >+ is( $report_column_headings[0][10], 'Reporting_Period_Total', '11th column heading is reporting period total' ); >+ >+ # Months column headings >+ is( $report_column_headings[0][11], 'Sep 2021', '12th column is month column heading' ); >+ is( $report_column_headings[0][12], 'Oct 2021', '13th column is month column heading' ); >+ is( $report_column_headings[0][13], 'Nov 2021', '14th column is month column heading' ); >+ is( $report_column_headings[0][14], 'Dec 2021', '15th column is month column heading' ); >+ is( $report_column_headings[0][15], 'Jan 2022', '16th column is month column heading' ); >+ is( $report_column_headings[0][16], 'Feb 2022', '17th column is month column heading' ); >+ >+ # ... period is september 2021 to september 2022, i.e. 13 months >+ is( $report_column_headings[0][23], 'Sep 2022', '23rd column is the last month column heading' ); >+ is( $report_column_headings[0][24], undef, '24th column is empty, no more months' ); >+}; >+ >+subtest 'TR_J1 _COUNTER_report_body' => sub { >+ >+ plan tests => 16; >+ >+ my @report_body = $sushi_counter_TR_J1->_COUNTER_report_body; >+ >+ # The same title is sequential but for different metric types >+ is( $report_body[0][0], 'Education and Training', 'same title, different metric type' ); >+ is( $report_body[1][0], 'Education and Training', 'same title, different metric type' ); >+ is( $report_body[0][9], 'Total_Item_Requests', 'same title, different metric type' ); >+ is( $report_body[1][9], 'Unique_Item_Requests', 'same title, different metric type' ); >+ >+ # The data is in the correct column >+ is( $report_body[2][0], 'Test Journal', '1st column is title' ); >+ is( $report_body[2][1], 'Test Publisher', '2nd column is publisher' ); >+ is( $report_body[2][2], '0000000123456789', '3rd column heading is publisher ID' ); >+ is( $report_body[2][3], 'Unit Test Library', '4th column is platform' ); >+ is( $report_body[2][4], '10.1002/(ISSN)1111-2222', '5th column is DOI' ); >+ is( $report_body[2][5], 'TInsti:ABC1', '6th column is proprietary ID' ); >+ is( $report_body[2][6], '7777-8888', '7th column is print ISSN' ); >+ is( $report_body[2][7], '5555-6666', '8th column is online ISSN' ); >+ is( $report_body[2][8], '', '9th column is URI' ); >+ is( $report_body[2][9], 'Total_Item_Requests', '10th column is metric type' ); >+ is( $report_body[2][10], 2, '11th column is reporting period total' ); >+ >+ # The period total is the sum of all the month columns >+ my $stats_total = 0; >+ for ( my $i = 11 ; $i < 24 ; $i++ ) { >+ $stats_total += $report_body[0][$i]; >+ } >+ is( >+ $report_body[0][10], $stats_total, >+ 'Reporting period total matches the sum of all the monthly usage statistics' >+ ); >+}; >+ >+my $sushi_response_file_TR_J2 = dirname(__FILE__) . $test_data_base_dir . "/TR_J2.json"; >+my $sushi_counter_51_response_TR_J2 = decode_json( read_file($sushi_response_file_TR_J2) ); >+my $sushi_counter_TR_J2 = Koha::ERM::EUsage::SushiCounter->new( { response => $sushi_counter_51_response_TR_J2 } ); >+ >+subtest 'TR_J2 _COUNTER_report_header' => sub { >+ >+ plan tests => 42; >+ >+ my @report_header = $sushi_counter_TR_J2->_COUNTER_report_header; >+ >+ # Header row #1 - Report_Name >+ is( $report_header[0][0], 'Report_Name', '1st row is report name' ); >+ is( $report_header[0][1], 'Journal Access Denied', '1st row is report name' ); >+ is( $report_header[0][2], undef, '1st row is report name' ); >+ >+ # Header row #2 - Report_ID >+ is( $report_header[1][0], 'Report_ID', '2nd row is report name' ); >+ is( $report_header[1][1], 'TR_J2', '2nd row is report name' ); >+ is( $report_header[1][2], undef, '2nd row is report name' ); >+ >+ # Header row #3 - Release >+ is( $report_header[2][0], 'Release', '3rd row is counter release' ); >+ is( $report_header[2][1], '5.1', '3rd row is counter release' ); >+ is( $report_header[2][2], undef, '3rd row is counter release' ); >+ >+ # Header row #4 - Institution_Name >+ is( $report_header[3][0], 'Institution_Name', '4th row is institution name' ); >+ is( $report_header[3][1], 'Sample Institution', '4th row is institution name' ); >+ is( $report_header[3][2], undef, '4th row is institution name' ); >+ >+ # Header row #5 - Institution_ID >+ is( $report_header[4][0], 'Institution_ID', '5th row is institution id' ); >+ is( $report_header[4][1], 'ISNI:1234123412341234', '5th row is institution id' ); >+ is( $report_header[4][2], undef, '5th row is institution id' ); >+ >+ # Header row #6 - Metric_Types >+ is( $report_header[5][0], 'Metric_Types', '6th row is metric types' ); >+ is( $report_header[5][1], 'Limit_Exceeded; No_License', '6th row is metric types' ); >+ is( $report_header[5][2], undef, '6th row is metric types' ); >+ >+ # Header row #7 - Report_Filters >+ is( $report_header[6][0], 'Report_Filters', '7th row is report filters' ); >+ like( $report_header[6][1], qr/Metric_Type:Limit_Exceeded\|No_License/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Begin_Date:2022-01-01/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/End_Date:2022-03-31/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Access_Method:Regular/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Data_Type:Journal/, '7th row is report filters' ); >+ >+ is( $report_header[6][2], undef, '7th row is report filters' ); >+ >+ # Header row #8 - Report_Attributes >+ is( $report_header[7][0], 'Report_Attributes', '8th row is report attributes' ); >+ is( $report_header[7][1], '', '8th row is report attributes' ); >+ is( $report_header[7][2], undef, '8th row is report attributes' ); >+ >+ # Header row #9 - Exceptions >+ is( $report_header[8][0], 'Exceptions', '9th row is exceptions' ); >+ is( $report_header[8][1], '', '9th row is exceptions' ); >+ is( $report_header[8][2], undef, '9th row is exceptions' ); >+ >+ # Header row #10 - Reporting_Period >+ is( $report_header[9][0], 'Reporting_Period', '10th row is reporting period' ); >+ is( $report_header[9][1], 'Begin_Date=2022-01-01; End_Date=2022-03-31', '10th row is reporting period' ); >+ is( $report_header[9][2], undef, '10th row is reporting period' ); >+ >+ # Header row #11 - Created >+ is( $report_header[10][0], 'Created', '11th row is created' ); >+ is( $report_header[10][1], '2023-02-15T09:11:12Z', '11th row is created' ); >+ is( $report_header[10][2], undef, '11th row is created' ); >+ >+ # Header row #12 - Created >+ is( $report_header[11][0], 'Created_By', '12th row is created by' ); >+ is( $report_header[11][1], 'Sample Publisher', '12th row is created by' ); >+ is( $report_header[11][2], undef, '12th row is created by' ); >+ >+ # Header row #13 - Registry_Record >+ is( $report_header[12][0], 'Registry_Record', '13th row is Registry_Record' ); >+ >+ # Header row #14 - This needs to be empty >+ is( $report_header[13][0], '', '14th row is empty' ); >+}; >+ >+subtest 'TR_J2 _COUNTER_report_column_headings' => sub { >+ >+ plan tests => 15; >+ >+ my @report_column_headings = $sushi_counter_TR_J2->_COUNTER_report_column_headings; >+ >+ # Standard TR_J2 column headings >+ is( $report_column_headings[0][0], 'Title', '1st column heading is title' ); >+ is( $report_column_headings[0][1], 'Publisher', '2nd column heading is publisher' ); >+ is( $report_column_headings[0][2], 'Publisher_ID', '3rd column heading is publisher ID' ); >+ is( $report_column_headings[0][3], 'Platform', '4th column heading is platform' ); >+ is( $report_column_headings[0][4], 'DOI', '5th column heading is DOI' ); >+ is( $report_column_headings[0][5], 'Proprietary_ID', '6th column heading is proprietary ID' ); >+ is( $report_column_headings[0][6], 'Print_ISSN', '7th column heading is print ISSN' ); >+ is( $report_column_headings[0][7], 'Online_ISSN', '8th column heading is online ISSN' ); >+ is( $report_column_headings[0][8], 'URI', '9th column heading is URI' ); >+ is( $report_column_headings[0][9], 'Metric_Type', '10th column heading is metric type' ); >+ is( $report_column_headings[0][10], 'Reporting_Period_Total', '11th column heading is reporting period total' ); >+ >+ # Months column headings >+ is( $report_column_headings[0][11], 'Jan 2022', '12th column is month column heading' ); >+ is( $report_column_headings[0][12], 'Feb 2022', '13th column is another month column heading' ); >+ is( $report_column_headings[0][13], 'Mar 2022', '14th column is the last month column heading' ); >+ is( $report_column_headings[0][14], undef, '15th column is empty, no more months' ); >+}; >+ >+subtest 'TR_J2 _COUNTER_report_body' => sub { >+ >+ plan tests => 16; >+ >+ my @report_body = $sushi_counter_TR_J2->_COUNTER_report_body; >+ >+ # The same title is sequential but for different metric types >+ is( $report_body[0][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[1][0], 'Title 3', 'same title, same metric type' ); >+ is( $report_body[0][9], 'Limit_Exceeded', '1st title, different metric_type' ); >+ is( $report_body[1][9], 'No_License', '1sd title, different metric_type' ); >+ >+ # The data is in the correct column >+ is( $report_body[2][0], 'Another title', '1st column is title' ); >+ is( $report_body[2][1], 'Another publisher', '2nd column is publisher' ); >+ is( $report_body[2][2], '4321432143214321', '3rd column is publisher ID and shows because there is ISNI' ); >+ is( $report_body[2][3], 'Platform 1', '4th column is platform' ); >+ is( $report_body[2][4], '10.9999/xxxxt03', '5th column is DOI' ); >+ is( $report_body[2][5], 'P1:T03', '6th column is proprietary ID' ); >+ is( $report_body[2][6], '', '7th column is print ISSN' ); >+ is( $report_body[2][7], '1234-4321', '8th column is online ISSN' ); >+ is( $report_body[2][8], '', '9th column is URI' ); >+ is( $report_body[2][9], 'Limit_Exceeded', '10th column is metric type' ); >+ is( $report_body[2][10], 388, '11th column is reporting period total' ); >+ >+ # The period total is the sum of all the month columns >+ my $stats_total = 0; >+ for ( my $i = 11 ; $i < 14 ; $i++ ) { >+ $stats_total += $report_body[0][$i]; >+ } >+ >+ is( >+ $report_body[0][10], $stats_total, >+ 'Reporting period total matches the sum of all the monthly usage statistics' >+ ); >+}; >+ >+my $sushi_response_file_TR_J3 = dirname(__FILE__) . $test_data_base_dir . "/TR_J3.json"; >+my $sushi_counter_51_response_TR_J3 = decode_json( read_file($sushi_response_file_TR_J3) ); >+my $sushi_counter_TR_J3 = Koha::ERM::EUsage::SushiCounter->new( { response => $sushi_counter_51_response_TR_J3 } ); >+ >+subtest 'TR_J3 _COUNTER_report_header' => sub { >+ >+ plan tests => 42; >+ >+ my @report_header = $sushi_counter_TR_J3->_COUNTER_report_header; >+ >+ # Header row #1 - Report_Name >+ is( $report_header[0][0], 'Report_Name', '1st row is report name' ); >+ is( $report_header[0][1], 'Journal Usage by Access Type', '1st row is report name' ); >+ is( $report_header[0][2], undef, '1st row is report name' ); >+ >+ # Header row #2 - Report_ID >+ is( $report_header[1][0], 'Report_ID', '2nd row is report name' ); >+ is( $report_header[1][1], 'TR_J3', '2nd row is report name' ); >+ is( $report_header[1][2], undef, '2nd row is report name' ); >+ >+ # Header row #3 - Release >+ is( $report_header[2][0], 'Release', '3rd row is counter release' ); >+ is( $report_header[2][1], '5.1', '3rd row is counter release' ); >+ is( $report_header[2][2], undef, '3rd row is counter release' ); >+ >+ # Header row #4 - Institution_Name >+ is( $report_header[3][0], 'Institution_Name', '4th row is institution name' ); >+ is( $report_header[3][1], 'Sample Institution', '4th row is institution name' ); >+ is( $report_header[3][2], undef, '4th row is institution name' ); >+ >+ # Header row #5 - Institution_ID >+ is( $report_header[4][0], 'Institution_ID', '5th row is institution id' ); >+ is( $report_header[4][1], 'ISNI:1234123412341234', '5th row is institution id' ); >+ is( $report_header[4][2], undef, '5th row is institution id' ); >+ >+ # Header row #6 - Metric_Types >+ is( $report_header[5][0], 'Metric_Types', '6th row is metric types' ); >+ is( >+ $report_header[5][1], >+ 'Total_Item_Investigations; Total_Item_Requests; Unique_Item_Investigations; Unique_Item_Requests', >+ '6th row is metric types' >+ ); >+ is( $report_header[5][2], undef, '6th row is metric types' ); >+ >+ # Header row #7 - Report_Filters >+ is( $report_header[6][0], 'Report_Filters', '7th row is report filters' ); >+ like( >+ $report_header[6][1], >+ qr/Metric_Type:Total_Item_Investigations\|Total_Item_Requests\|Unique_Item_Investigations\|Unique_Item_Requests/, >+ '7th row is report filters' >+ ); >+ like( $report_header[6][1], qr/Access_Method:Regular/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/End_Date:2022-03-31/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Data_Type:Journal/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Begin_Date:2022-01-01/, '7th row is report filters' ); >+ >+ is( $report_header[6][2], undef, '7th row is report filters' ); >+ >+ # Header row #8 - Report_Attributes >+ is( $report_header[7][0], 'Report_Attributes', '8th row is report attributes' ); >+ is( $report_header[7][1], '', '8th row is report attributes' ); >+ is( $report_header[7][2], undef, '8th row is report attributes' ); >+ >+ # Header row #9 - Exceptions >+ is( $report_header[8][0], 'Exceptions', '9th row is exceptions' ); >+ is( $report_header[8][1], '', '9th row is exceptions' ); >+ is( $report_header[8][2], undef, '9th row is exceptions' ); >+ >+ # Header row #10 - Reporting_Period >+ is( $report_header[9][0], 'Reporting_Period', '10th row is reporting period' ); >+ is( $report_header[9][1], 'Begin_Date=2022-01-01; End_Date=2022-03-31', '10th row is reporting period' ); >+ is( $report_header[9][2], undef, '10th row is reporting period' ); >+ >+ # Header row #11 - Created >+ is( $report_header[10][0], 'Created', '11th row is created' ); >+ is( $report_header[10][1], '2023-02-15T09:11:12Z', '11th row is created' ); >+ is( $report_header[10][2], undef, '11th row is created' ); >+ >+ # Header row #12 - Created >+ is( $report_header[11][0], 'Created_By', '12th row is created by' ); >+ is( $report_header[11][1], 'Sample Publisher', '12th row is created by' ); >+ is( $report_header[11][2], undef, '12th row is created by' ); >+ >+ # Header row #13 - Registry_Record >+ is( $report_header[12][0], 'Registry_Record', '13th row is Registry_Record' ); >+ >+ # Header row #14 - This needs to be empty >+ is( $report_header[13][0], '', '14th row is empty' ); >+}; >+ >+subtest 'TR_J3 _COUNTER_report_column_headings' => sub { >+ >+ plan tests => 16; >+ >+ my @report_column_headings = $sushi_counter_TR_J3->_COUNTER_report_column_headings; >+ >+ # Standard TR_J3 column headings >+ is( $report_column_headings[0][0], 'Title', '1st column heading is title' ); >+ is( $report_column_headings[0][1], 'Publisher', '2nd column heading is publisher' ); >+ is( $report_column_headings[0][2], 'Publisher_ID', '3rd column heading is publisher ID' ); >+ is( $report_column_headings[0][3], 'Platform', '4th column heading is platform' ); >+ is( $report_column_headings[0][4], 'DOI', '5th column heading is DOI' ); >+ is( $report_column_headings[0][5], 'Proprietary_ID', '6th column heading is proprietary ID' ); >+ is( $report_column_headings[0][6], 'Print_ISSN', '7th column heading is print ISSN' ); >+ is( $report_column_headings[0][7], 'Online_ISSN', '8th column heading is online ISSN' ); >+ is( $report_column_headings[0][8], 'URI', '9th column heading is URI' ); >+ is( $report_column_headings[0][9], 'Access_Type', '10th column heading is access type' ); >+ is( $report_column_headings[0][10], 'Metric_Type', '11th column heading is access type' ); >+ is( $report_column_headings[0][11], 'Reporting_Period_Total', '12th column heading is reporting period total' ); >+ >+ # Months column headings >+ is( $report_column_headings[0][12], 'Jan 2022', '12th column is month column heading' ); >+ is( $report_column_headings[0][13], 'Feb 2022', '13th column is another month column heading' ); >+ is( $report_column_headings[0][14], 'Mar 2022', '13th column is the last month column heading' ); >+ is( $report_column_headings[0][25], undef, '14th column is empty, no more months' ); >+}; >+ >+subtest 'TR_J3 _COUNTER_report_body' => sub { >+ >+ plan tests => 25; >+ >+ my @report_body = $sushi_counter_TR_J3->_COUNTER_report_body; >+ >+ # The same title is sequential but for different metric types >+ is( $report_body[0][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[1][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[2][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[3][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[0][9], 'Controlled', 'same title, same access_type' ); >+ is( $report_body[1][9], 'Controlled', 'same title, same access_type' ); >+ is( $report_body[2][9], 'Controlled', 'same title, same access_type' ); >+ is( $report_body[3][9], 'Controlled', 'same title, same access_type' ); >+ is( $report_body[0][10], 'Total_Item_Investigations', 'same title, different metric type' ); >+ is( $report_body[1][10], 'Total_Item_Requests', 'same title, different metric type' ); >+ is( $report_body[2][10], 'Unique_Item_Investigations', 'same title, different metric type' ); >+ is( $report_body[3][10], 'Unique_Item_Requests', 'same title, different metric type' ); >+ >+ # The data is in the correct column >+ is( $report_body[2][0], 'Title 3', '1st column is title' ); >+ is( $report_body[2][1], 'Sample Publisher', '2nd column is publisher' ); >+ is( $report_body[2][2], '4321432143214321', '3rd column is publisher ID' ); >+ is( $report_body[2][3], 'Platform 1', '4th column is platform' ); >+ is( $report_body[2][4], '10.9999/xxxxt03', '5th column is DOI' ); >+ is( $report_body[2][5], 'P1:T03', '6th column is proprietary ID' ); >+ is( $report_body[2][6], '', '7th column is print ISSN' ); >+ is( $report_body[2][7], '1234-4321', '8th column is online ISSN' ); >+ is( $report_body[2][8], '', '9th column is URI' ); >+ is( $report_body[2][9], 'Controlled', '10th column is access type' ); >+ is( $report_body[2][10], 'Unique_Item_Investigations', '11th column is metric type' ); >+ is( $report_body[2][11], 1602, '12th column is reporting period total' ); # 608+618+376 >+ >+ # The period total is the sum of all the month columns >+ my $stats_total = 0; >+ for ( my $i = 12 ; $i < 15 ; $i++ ) { >+ $stats_total += $report_body[0][$i]; >+ } >+ is( >+ $report_body[0][11], $stats_total, >+ 'Reporting period total matches the sum of all the monthly usage statistics' >+ ); >+}; >+ >+my $sushi_response_file_TR_J4 = dirname(__FILE__) . $test_data_base_dir . "/TR_J4.json"; >+my $sushi_counter_51_response_TR_J4 = decode_json( read_file($sushi_response_file_TR_J4) ); >+my $sushi_counter_TR_J4 = Koha::ERM::EUsage::SushiCounter->new( { response => $sushi_counter_51_response_TR_J4 } ); >+ >+subtest 'TR_J4 _COUNTER_report_header' => sub { >+ >+ plan tests => 43; >+ >+ my @report_header = $sushi_counter_TR_J4->_COUNTER_report_header; >+ >+ # Header row #1 - Report_Name >+ is( $report_header[0][0], 'Report_Name', '1st row is report name' ); >+ is( $report_header[0][1], 'Journal Requests by YOP (Controlled)', '1st row is report name' ); >+ is( $report_header[0][2], undef, '1st row is report name' ); >+ >+ # Header row #2 - Report_ID >+ is( $report_header[1][0], 'Report_ID', '2nd row is report name' ); >+ is( $report_header[1][1], 'TR_J4', '2nd row is report name' ); >+ is( $report_header[1][2], undef, '2nd row is report name' ); >+ >+ # Header row #3 - Release >+ is( $report_header[2][0], 'Release', '3rd row is counter release' ); >+ is( $report_header[2][1], '5.1', '3rd row is counter release' ); >+ is( $report_header[2][2], undef, '3rd row is counter release' ); >+ >+ # Header row #4 - Institution_Name >+ is( $report_header[3][0], 'Institution_Name', '4th row is institution name' ); >+ is( $report_header[3][1], 'Sample Institution', '4th row is institution name' ); >+ is( $report_header[3][2], undef, '4th row is institution name' ); >+ >+ # Header row #5 - Institution_ID >+ is( $report_header[4][0], 'Institution_ID', '5th row is institution id' ); >+ is( $report_header[4][1], 'ISNI:1234123412341234', '5th row is institution id' ); >+ is( $report_header[4][2], undef, '5th row is institution id' ); >+ >+ # Header row #6 - Metric_Types >+ is( $report_header[5][0], 'Metric_Types', '6th row is metric types' ); >+ is( >+ $report_header[5][1], >+ 'Total_Item_Requests; Unique_Item_Requests', >+ '6th row is metric types' >+ ); >+ is( $report_header[5][2], undef, '6th row is metric types' ); >+ >+ # Header row #7 - Report_Filters >+ is( $report_header[6][0], 'Report_Filters', '7th row is report filters' ); >+ like( $report_header[6][1], qr/Metric_Type:Total_Item_Requests|Unique_Item_Requests/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Access_Method:Regular/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Begin_Date:2022-01-01/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Access_Type:Controlled/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/End_Date:2022-03-31/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Data_Type:Journal/, '7th row is report filters' ); >+ >+ is( $report_header[6][2], undef, '7th row is report filters' ); >+ >+ # Header row #8 - Report_Attributes >+ is( $report_header[7][0], 'Report_Attributes', '8th row is report attributes' ); >+ is( $report_header[7][1], '', '8th row is report attributes' ); >+ is( $report_header[7][2], undef, '8th row is report attributes' ); >+ >+ # Header row #9 - Exceptions >+ is( $report_header[8][0], 'Exceptions', '9th row is exceptions' ); >+ is( $report_header[8][1], '', '9th row is exceptions' ); >+ is( $report_header[8][2], undef, '9th row is exceptions' ); >+ >+ # Header row #10 - Reporting_Period >+ is( $report_header[9][0], 'Reporting_Period', '10th row is reporting period' ); >+ is( $report_header[9][1], 'Begin_Date=2022-01-01; End_Date=2022-03-31', '10th row is reporting period' ); >+ is( $report_header[9][2], undef, '10th row is reporting period' ); >+ >+ # Header row #11 - Created >+ is( $report_header[10][0], 'Created', '11th row is created' ); >+ is( $report_header[10][1], '2023-02-15T09:11:12Z', '11th row is created' ); >+ is( $report_header[10][2], undef, '11th row is created' ); >+ >+ # Header row #12 - Created >+ is( $report_header[11][0], 'Created_By', '12th row is created by' ); >+ is( $report_header[11][1], 'Sample Publisher', '12th row is created by' ); >+ is( $report_header[11][2], undef, '12th row is created by' ); >+ >+ # Header row #13 - Registry_Record >+ is( $report_header[12][0], 'Registry_Record', '13th row is Registry_Record' ); >+ >+ # Header row #14 - This needs to be empty >+ is( $report_header[13][0], '', '14th row is empty' ); >+}; >+ >+subtest 'TR_J4 _COUNTER_report_column_headings' => sub { >+ >+ plan tests => 16; >+ >+ my @report_column_headings = $sushi_counter_TR_J4->_COUNTER_report_column_headings; >+ >+ # Standard TR_J4 column headings >+ is( $report_column_headings[0][0], 'Title', '1st column heading is title' ); >+ is( $report_column_headings[0][1], 'Publisher', '2nd column heading is publisher' ); >+ is( $report_column_headings[0][2], 'Publisher_ID', '3rd column heading is publisher ID' ); >+ is( $report_column_headings[0][3], 'Platform', '4th column heading is platform' ); >+ is( $report_column_headings[0][4], 'DOI', '5th column heading is DOI' ); >+ is( $report_column_headings[0][5], 'Proprietary_ID', '6th column heading is proprietary ID' ); >+ is( $report_column_headings[0][6], 'Print_ISSN', '7th column heading is print ISSN' ); >+ is( $report_column_headings[0][7], 'Online_ISSN', '8th column heading is online ISSN' ); >+ is( $report_column_headings[0][8], 'URI', '9th column heading is URI' ); >+ is( $report_column_headings[0][9], 'YOP', '10th column heading is yop' ); >+ is( $report_column_headings[0][10], 'Metric_Type', '11th column heading is metric type' ); >+ is( $report_column_headings[0][11], 'Reporting_Period_Total', '12th column heading is reporting period total' ); >+ >+ # Months column headings >+ is( $report_column_headings[0][12], 'Jan 2022', '13th column is month column heading' ); >+ is( $report_column_headings[0][13], 'Feb 2022', '14th column is another month column heading' ); >+ is( $report_column_headings[0][14], 'Mar 2022', '15th column is the last month column heading' ); >+ is( $report_column_headings[0][15], undef, '16th column is empty, no more months' ); >+}; >+ >+subtest 'TR_J4 _COUNTER_report_body' => sub { >+ >+ plan tests => 25; >+ >+ my @report_body = $sushi_counter_TR_J4->_COUNTER_report_body; >+ >+ # The same title is sequential but for different metric types >+ is( $report_body[0][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[1][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[2][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[3][0], 'Title 3', 'same title, different metric type' ); >+ is( $report_body[0][10], 'Total_Item_Requests', '1st title, same yop' ); >+ is( $report_body[1][10], 'Unique_Item_Requests', '1st title, same yop' ); >+ is( $report_body[2][10], 'Total_Item_Requests', '1st title, same yop' ); >+ is( $report_body[3][10], 'Unique_Item_Requests', '1st title, same yop' ); >+ is( $report_body[0][9], '2022', '1st title, yop' ); >+ is( $report_body[1][9], '2022', '1st title, yop' ); >+ is( $report_body[2][9], '2021', '1st title, yop' ); >+ is( $report_body[3][9], '2021', '1st title, yop' ); >+ >+ # The data is in the correct column >+ is( $report_body[2][0], 'Title 3', '1st column is title' ); >+ is( $report_body[2][1], 'Sample Publisher', '2nd column is publisher' ); >+ is( $report_body[2][2], '4321432143214321', '3rd column is publisher ID' ); >+ is( $report_body[2][3], 'Platform 1', '4th column is platform' ); >+ is( $report_body[2][4], '10.9999/xxxxt03', '5th column is DOI' ); >+ is( $report_body[2][5], 'P1:T03', '6th column is proprietary ID' ); >+ is( $report_body[2][6], '', '7th column is print ISSN' ); >+ is( $report_body[2][7], '1234-4321', '8th column is online ISSN' ); >+ is( $report_body[2][8], '', '9th column is URI' ); >+ is( $report_body[2][9], '2021', '10th column is yop' ); >+ is( $report_body[2][10], 'Total_Item_Requests', '10th column is metric type' ); >+ is( $report_body[2][11], 640, '11th column is reporting period total' ); #150+247+243 >+ >+ # The period total is the sum of all the month columns >+ my $stats_total = 0; >+ for ( my $i = 12 ; $i < 15 ; $i++ ) { >+ $stats_total += $report_body[0][$i]; >+ } >+ is( >+ $report_body[0][11], $stats_total, >+ 'Reporting period total matches the sum of all the monthly usage statistics' >+ ); >+}; >+ >+my $sushi_response_file_TR_B3 = dirname(__FILE__) . $test_data_base_dir . "/TR_B3.json"; >+my $sushi_counter_51_response_TR_B3 = decode_json( read_file($sushi_response_file_TR_B3) ); >+my $sushi_counter_TR_B3 = Koha::ERM::EUsage::SushiCounter->new( { response => $sushi_counter_51_response_TR_B3 } ); >+ >+subtest 'TR_B3 _COUNTER_report_header' => sub { >+ >+ plan tests => 47; >+ >+ my @report_header = $sushi_counter_TR_B3->_COUNTER_report_header; >+ >+ # Header row #1 - Report_Name >+ is( $report_header[0][0], 'Report_Name', '1st row is report name' ); >+ is( $report_header[0][1], 'Book Usage by Access Type', '1st row is report name' ); >+ is( $report_header[0][2], undef, '1st row is report name' ); >+ >+ # Header row #2 - Report_ID >+ is( $report_header[1][0], 'Report_ID', '2nd row is report name' ); >+ is( $report_header[1][1], 'TR_B3', '2nd row is report name' ); >+ is( $report_header[1][2], undef, '2nd row is report name' ); >+ >+ # Header row #3 - Release >+ is( $report_header[2][0], 'Release', '3rd row is counter release' ); >+ is( $report_header[2][1], '5.1', '3rd row is counter release' ); >+ is( $report_header[2][2], undef, '3rd row is counter release' ); >+ >+ # Header row #4 - Institution_Name >+ is( $report_header[3][0], 'Institution_Name', '4th row is institution name' ); >+ is( $report_header[3][1], 'Sample Institution', '4th row is institution name' ); >+ is( $report_header[3][2], undef, '4th row is institution name' ); >+ >+ # Header row #5 - Institution_ID >+ is( $report_header[4][0], 'Institution_ID', '5th row is institution id' ); >+ is( $report_header[4][1], 'ISNI:1234123412341234', '5th row is institution id' ); >+ is( $report_header[4][2], undef, '5th row is institution id' ); >+ >+ # Header row #6 - Metric_Types >+ is( $report_header[5][0], 'Metric_Types', '6th row is metric types' ); >+ like( $report_header[5][1], qr/Total_Item_Investigations/, '6th row is metric types' ); >+ like( $report_header[5][1], qr/Total_Item_Requests/, '6th row is metric types' ); >+ like( $report_header[5][1], qr/Unique_Item_Investigations/, '6th row is metric types' ); >+ like( $report_header[5][1], qr/Unique_Item_Requests/, '6th row is metric types' ); >+ like( $report_header[5][1], qr/Unique_Title_Investigations/, '6th row is metric types' ); >+ like( $report_header[5][1], qr/Unique_Title_Requests/, '6th row is metric types' ); >+ >+ is( $report_header[5][2], undef, '6th row is metric types' ); >+ >+ # Header row #7 - Report_Filters >+ is( $report_header[6][0], 'Report_Filters', '7th row is report filters' ); >+ like( $report_header[6][1], qr/Data_Type:Book/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Access_Method:Regular/, '7th row is report filters' ); >+ like( >+ $report_header[6][1], >+ qr/Metric_Type:Total_Item_Investigations\|Total_Item_Requests\|Unique_Item_Investigations\|Unique_Item_Requests\|Unique_Title_Investigations\|Unique_Title_Requests/, >+ '7th row is report filters' >+ ); >+ like( $report_header[6][1], qr/Begin_Date:2022-01-01/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/End_Date:2022-03-31/, '7th row is report filters' ); >+ >+ is( $report_header[6][2], undef, '7th row is report filters' ); >+ >+ # Header row #8 - Report_Attributes >+ is( $report_header[7][0], 'Report_Attributes', '8th row is report attributes' ); >+ is( $report_header[7][1], '', '8th row is report attributes' ); >+ is( $report_header[7][2], undef, '8th row is report attributes' ); >+ >+ # Header row #9 - Exceptions >+ is( $report_header[8][0], 'Exceptions', '9th row is exceptions' ); >+ is( $report_header[8][1], '', '9th row is exceptions' ); >+ is( $report_header[8][2], undef, '9th row is exceptions' ); >+ >+ # Header row #10 - Reporting_Period >+ is( $report_header[9][0], 'Reporting_Period', '10th row is reporting period' ); >+ is( $report_header[9][1], 'Begin_Date=2022-01-01; End_Date=2022-03-31', '10th row is reporting period' ); >+ is( $report_header[9][2], undef, '10th row is reporting period' ); >+ >+ # Header row #11 - Created >+ is( $report_header[10][0], 'Created', '11th row is created' ); >+ is( $report_header[10][1], '2023-02-15T09:11:12Z', '11th row is created' ); >+ is( $report_header[10][2], undef, '11th row is created' ); >+ >+ # Header row #12 - Created >+ is( $report_header[11][0], 'Created_By', '12th row is created by' ); >+ is( $report_header[11][1], 'Sample Publisher', '12th row is created by' ); >+ is( $report_header[11][2], undef, '12th row is created by' ); >+ >+ # Header row #13 - Registry_Record >+ is( $report_header[12][0], 'Registry_Record', '13th row is Registry_Record' ); >+ >+ # Header row #14 - This needs to be empty >+ is( $report_header[13][0], '', '14th row is empty' ); >+}; >+ >+subtest 'TR_B3 _COUNTER_report_column_headings' => sub { >+ >+ plan tests => 19; >+ >+ my @report_column_headings = $sushi_counter_TR_B3->_COUNTER_report_column_headings; >+ >+ # Standard TR_J4 column headings >+ is( $report_column_headings[0][0], 'Title', '1st column heading is title' ); >+ is( $report_column_headings[0][1], 'Publisher', '2nd column heading is publisher' ); >+ is( $report_column_headings[0][2], 'Publisher_ID', '3rd column heading is publisher ID' ); >+ is( $report_column_headings[0][3], 'Platform', '4th column heading is platform' ); >+ is( $report_column_headings[0][4], 'DOI', '5th column heading is DOI' ); >+ is( $report_column_headings[0][5], 'Proprietary_ID', '6th column heading is proprietary ID' ); >+ is( $report_column_headings[0][6], 'ISBN', '7th column heading is ISBN' ); >+ is( $report_column_headings[0][7], 'Print_ISSN', '8th column heading is print ISSN' ); >+ is( $report_column_headings[0][8], 'Online_ISSN', '9th column heading is online ISSN' ); >+ is( $report_column_headings[0][9], 'URI', '10th column heading is URI' ); >+ is( $report_column_headings[0][10], 'Data_Type', '11th column heading is data type' ); >+ is( $report_column_headings[0][11], 'YOP', '12th column heading is yop' ); >+ is( $report_column_headings[0][12], 'Access_Type', '13th column heading is access type' ); >+ is( $report_column_headings[0][13], 'Metric_Type', '14th column heading is metric type' ); >+ is( $report_column_headings[0][14], 'Reporting_Period_Total', '15th column heading is reporting period total' ); >+ >+ # Months column headings >+ is( $report_column_headings[0][15], 'Jan 2022', '16th column is month column heading' ); >+ is( $report_column_headings[0][16], 'Feb 2022', '17th column another month column heading' ); >+ is( $report_column_headings[0][17], 'Mar 2022', '18th column is the last month column heading' ); >+ is( $report_column_headings[0][18], undef, '19th column is empty, no more months' ); >+}; >+ >+subtest 'TR_B3 _COUNTER_report_body' => sub { >+ >+ plan tests => 49; >+ >+ my @report_body = $sushi_counter_TR_B3->_COUNTER_report_body; >+ >+ # The same title is sequential but for different metric types >+ is( >+ $report_body[0][0], 'Title 1', >+ 'first title, different metric type' >+ ); >+ is( >+ $report_body[1][0], 'Title 1', >+ 'first title, different metric type' >+ ); >+ is( >+ $report_body[2][0], 'Title 1', >+ 'first title, different metric type' >+ ); >+ is( >+ $report_body[3][0], 'Title 1', >+ 'first title, different metric type' >+ ); >+ is( >+ $report_body[4][0], 'Title 1', >+ 'first title, different metric type' >+ ); >+ is( >+ $report_body[5][0], 'Title 1', >+ 'first title, different metric type' >+ ); >+ is( >+ $report_body[6][0], 'Title 7', >+ 'second title, different metric type' >+ ); >+ is( >+ $report_body[7][0], 'Title 7', >+ 'second title, different metric type' >+ ); >+ is( >+ $report_body[8][0], 'Title 7', >+ 'second title, different metric type' >+ ); >+ is( $report_body[0][10], 'Book', '6 rows for 1st title' ); >+ is( $report_body[1][10], 'Book', '6 rows for 1st title' ); >+ is( $report_body[2][10], 'Book', '6 rows for 1st title' ); >+ is( $report_body[3][10], 'Book', '6 rows for 1st title' ); >+ is( $report_body[4][10], 'Book', '6 rows for 1st title' ); >+ is( $report_body[5][10], 'Book', '6 rows for 1st title' ); >+ is( $report_body[0][11], '2022', '1st title, yop' ); >+ is( $report_body[1][11], '2022', '1st title, yop' ); >+ is( $report_body[2][11], '2022', '1st title,yop' ); >+ is( $report_body[3][11], '2022', '1st title, 2nd yop has 6 metric types' ); >+ is( $report_body[4][11], '2022', '1st title, 2nd yop has 6 metric types' ); >+ is( $report_body[5][11], '2022', '1st title, 2nd yop has 6 metric types' ); >+ is( $report_body[0][12], 'Controlled', '6 rows for 1st title' ); >+ is( $report_body[1][12], 'Controlled', '6 rows for 1st title' ); >+ is( $report_body[2][12], 'Controlled', '6 rows for 1st title' ); >+ is( $report_body[3][12], 'Controlled', '6 rows for 1st title' ); >+ is( $report_body[4][12], 'Controlled', '6 rows for 1st title' ); >+ is( $report_body[5][12], 'Controlled', '6 rows for 1st title' ); >+ is( $report_body[0][13], 'Total_Item_Investigations', '1st title, metric type' ); >+ is( $report_body[1][13], 'Total_Item_Requests', '1st title, metric type' ); >+ is( $report_body[2][13], 'Unique_Item_Investigations', '1st title, metric type' ); >+ is( $report_body[3][13], 'Unique_Item_Requests', '1st title, metric type' ); >+ is( $report_body[4][13], 'Unique_Title_Investigations', '1st title, metric type' ); >+ is( $report_body[5][13], 'Unique_Title_Requests', '1st title, metric type' ); >+ >+ # The data is in the correct column >+ is( $report_body[2][0], 'Title 1', '1st column is title' ); >+ is( $report_body[2][1], 'Sample Publisher', '2nd column is publisher' ); >+ is( $report_body[2][2], '4321432143214321', '3rd column is publisher ID' ); >+ is( $report_body[2][3], 'Platform 1', '4th column is platform' ); >+ is( $report_body[2][4], '10.9999/xxxxt01', '5th column is DOI' ); >+ is( $report_body[2][5], 'P1:T01', '6th column is proprietary ID' ); >+ is( $report_body[2][6], '979-8-88888-888-8', '7th column is ISBN' ); >+ is( $report_body[2][7], '', '8th column is print ISSN' ); >+ is( $report_body[2][8], '', '9th column is online ISSN' ); >+ is( $report_body[2][9], '', '10th column is URI' ); >+ is( $report_body[2][10], 'Book', '11th column is data_type' ); >+ is( $report_body[2][11], '2022', '12th column is yop' ); >+ is( $report_body[2][12], 'Controlled', '12th column is access type' ); >+ is( $report_body[2][13], 'Unique_Item_Investigations', '13th column is metric type' ); >+ is( $report_body[2][14], 2760, '14th column is reporting period total' ); #828+935+997 >+ >+ # The period total is the sum of all the month columns >+ my $stats_total = 0; >+ for ( my $i = 15 ; $i < 18 ; $i++ ) { >+ $stats_total += $report_body[0][$i]; >+ } >+ is( >+ $report_body[0][14], $stats_total, >+ 'Reporting period total matches the sum of all the monthly usage statistics' >+ ); >+}; >+ >+my $sushi_response_file_TR_B2 = dirname(__FILE__) . $test_data_base_dir . "/TR_B2.json"; >+my $sushi_counter_51_response_TR_B2 = decode_json( read_file($sushi_response_file_TR_B2) ); >+my $sushi_counter_TR_B2 = Koha::ERM::EUsage::SushiCounter->new( { response => $sushi_counter_51_response_TR_B2 } ); >+ >+subtest 'TR_B2 _COUNTER_report_header' => sub { >+ >+ plan tests => 42; >+ >+ my @report_header = $sushi_counter_TR_B2->_COUNTER_report_header; >+ >+ # Header row #1 - Report_Name >+ is( $report_header[0][0], 'Report_Name', '1st row is report name' ); >+ is( $report_header[0][1], 'Book Access Denied', '1st row is report name' ); >+ is( $report_header[0][2], undef, '1st row is report name' ); >+ >+ # Header row #2 - Report_ID >+ is( $report_header[1][0], 'Report_ID', '2nd row is report name' ); >+ is( $report_header[1][1], 'TR_B2', '2nd row is report name' ); >+ is( $report_header[1][2], undef, '2nd row is report name' ); >+ >+ # Header row #3 - Release >+ is( $report_header[2][0], 'Release', '3rd row is counter release' ); >+ is( $report_header[2][1], '5.1', '3rd row is counter release' ); >+ is( $report_header[2][2], undef, '3rd row is counter release' ); >+ >+ # Header row #4 - Institution_Name >+ is( $report_header[3][0], 'Institution_Name', '4th row is institution name' ); >+ is( $report_header[3][1], 'Sample Institution', '4th row is institution name' ); >+ is( $report_header[3][2], undef, '4th row is institution name' ); >+ >+ # Header row #5 - Institution_ID >+ is( $report_header[4][0], 'Institution_ID', '5th row is institution id' ); >+ is( $report_header[4][1], 'ISNI:1234123412341234', '5th row is institution id' ); >+ is( $report_header[4][2], undef, '5th row is institution id' ); >+ >+ # Header row #6 - Metric_Types >+ is( $report_header[5][0], 'Metric_Types', '6th row is metric types' ); >+ is( >+ $report_header[5][1], >+ 'Limit_Exceeded; No_License', >+ '6th row is metric types' >+ ); >+ is( $report_header[5][2], undef, '6th row is metric types' ); >+ >+ # Header row #7 - Report_Filters >+ is( $report_header[6][0], 'Report_Filters', '7th row is report filters' ); >+ like( $report_header[6][1], qr/Data_Type:Book/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Access_Method:Regular/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Metric_Type:Limit_Exceeded\|No_License/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/Begin_Date:2022-01-01/, '7th row is report filters' ); >+ like( $report_header[6][1], qr/End_Date:2022-03-31/, '7th row is report filters' ); >+ >+ is( $report_header[6][2], undef, '7th row is report filters' ); >+ >+ # Header row #8 - Report_Attributes >+ is( $report_header[7][0], 'Report_Attributes', '8th row is report attributes' ); >+ is( $report_header[7][1], '', '8th row is report attributes' ); >+ is( $report_header[7][2], undef, '8th row is report attributes' ); >+ >+ # Header row #9 - Exceptions >+ is( $report_header[8][0], 'Exceptions', '9th row is exceptions' ); >+ is( $report_header[8][1], '', '9th row is exceptions' ); >+ is( $report_header[8][2], undef, '9th row is exceptions' ); >+ >+ # Header row #10 - Reporting_Period >+ is( $report_header[9][0], 'Reporting_Period', '10th row is reporting period' ); >+ is( $report_header[9][1], 'Begin_Date=2022-01-01; End_Date=2022-03-31', '10th row is reporting period' ); >+ is( $report_header[9][2], undef, '10th row is reporting period' ); >+ >+ # Header row #11 - Created >+ is( $report_header[10][0], 'Created', '11th row is created' ); >+ is( $report_header[10][1], '2023-02-15T09:11:12Z', '11th row is created' ); >+ is( $report_header[10][2], undef, '11th row is created' ); >+ >+ # Header row #12 - Created >+ is( $report_header[11][0], 'Created_By', '12th row is created by' ); >+ is( $report_header[11][1], 'Sample Publisher', '12th row is created by' ); >+ is( $report_header[11][2], undef, '12th row is created by' ); >+ >+ # Header row #13 - Registry_Record >+ is( $report_header[12][0], 'Registry_Record', '13th row is Registry_Record' ); >+ >+ # Header row #14 - This needs to be empty >+ is( $report_header[13][0], '', '14th row is empty' ); >+}; >+ >+subtest 'TR_B2 _COUNTER_report_column_headings' => sub { >+ >+ plan tests => 18; >+ >+ my @report_column_headings = $sushi_counter_TR_B2->_COUNTER_report_column_headings; >+ >+ # Standard TR_J4 column headings >+ is( $report_column_headings[0][0], 'Title', '1st column heading is title' ); >+ is( $report_column_headings[0][1], 'Publisher', '2nd column heading is publisher' ); >+ is( $report_column_headings[0][2], 'Publisher_ID', '3rd column heading is publisher ID' ); >+ is( $report_column_headings[0][3], 'Platform', '4th column heading is platform' ); >+ is( $report_column_headings[0][4], 'DOI', '5th column heading is DOI' ); >+ is( $report_column_headings[0][5], 'Proprietary_ID', '6th column heading is proprietary ID' ); >+ is( $report_column_headings[0][6], 'ISBN', '7th column heading is ISBN' ); >+ is( $report_column_headings[0][7], 'Print_ISSN', '8th column heading is print ISSN' ); >+ is( $report_column_headings[0][8], 'Online_ISSN', '9th column heading is online ISSN' ); >+ is( $report_column_headings[0][9], 'URI', '10th column heading is URI' ); >+ is( $report_column_headings[0][10], 'Data_Type', '11th column heading is data type' ); >+ is( $report_column_headings[0][11], 'YOP', '12th column heading is yop' ); >+ is( $report_column_headings[0][12], 'Metric_Type', '13th column heading is metric type' ); >+ is( $report_column_headings[0][13], 'Reporting_Period_Total', '14th column heading is reporting period total' ); >+ >+ # Months column headings >+ is( $report_column_headings[0][14], 'Jan 2022', '14th column is month column heading' ); >+ is( $report_column_headings[0][15], 'Feb 2022', '15th column is another column heading' ); >+ is( $report_column_headings[0][16], 'Mar 2022', '16th column is the last month column heading' ); >+ is( $report_column_headings[0][17], undef, '17th column is empty, no more months' ); >+}; >+ >+subtest 'TR_B2 _COUNTER_report_body' => sub { >+ >+ plan tests => 19; >+ >+ my @report_body = $sushi_counter_TR_B2->_COUNTER_report_body; >+ >+ # The same title is sequential but for different metric types >+ is( >+ $report_body[0][0], 'Title 1', >+ 'same title, different metric type' >+ ); >+ is( >+ $report_body[1][0], 'Title 1', >+ 'same title, different metric type' >+ ); >+ is( $report_body[0][12], 'Limit_Exceeded', '2 rows for 1st title, metric type' ); >+ is( $report_body[1][12], 'No_License', '2 rows for 1st title, metric type' ); >+ >+ # The data is in the correct column >+ is( $report_body[2][0], 'Title 7', '1st column is title' ); >+ is( $report_body[2][1], 'Sample Publisher', '2nd column is publisher' ); >+ is( $report_body[2][2], '4321432143214321', '3rd column heading is publisher ID' ); >+ is( $report_body[2][3], 'Platform 1', '4th column is platform' ); >+ is( $report_body[2][4], '10.9999/xxxxt07', '5th column is DOI' ); >+ is( $report_body[2][5], 'P1:T07', '6th column is proprietary ID' ); >+ is( $report_body[2][6], '979-8-88888-888-9', '7th column is ISBN' ); >+ is( $report_body[2][7], '', '8th column is print ISSN' ); >+ is( $report_body[2][8], '', '9th column is online ISSN' ); >+ is( $report_body[2][9], '', '10th column is URI' ); >+ is( $report_body[2][10], 'Reference_Work', '11th column is data type' ); >+ is( $report_body[2][11], '2019', '11th column is yop' ); >+ is( $report_body[2][12], 'Limit_Exceeded', '12th column is access type' ); >+ is( $report_body[2][13], 217, '13th column is reporting period total' ); #84+84+49 >+ >+ # The period total is the sum of all the month columns >+ my $stats_total = 0; >+ for ( my $i = 14 ; $i < 17 ; $i++ ) { >+ $stats_total += $report_body[0][$i]; >+ } >+ is( >+ $report_body[0][13], $stats_total, >+ 'Reporting period total matches the sum of all the monthly usage statistics' >+ ); >+}; >diff --git a/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B2.json b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B2.json >new file mode 100644 >index 00000000000..10a67ccbdab >--- /dev/null >+++ b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B2.json >@@ -0,0 +1,101 @@ >+{ >+ "Report_Header": { >+ "Release": "5.1", >+ "Report_ID": "TR_B2", >+ "Report_Name": "Book Access Denied", >+ "Created": "2023-02-15T09:11:12Z", >+ "Created_By": "Sample Publisher", >+ "Institution_ID": { >+ "ISNI": [ >+ "1234123412341234" >+ ] >+ }, >+ "Institution_Name": "Sample Institution", >+ "Registry_Record": "https://registry.projectcounter.org/platform/99999999-9999-9999-9999-999999999999", >+ "Report_Filters": { >+ "Metric_Type": [ >+ "Limit_Exceeded", >+ "No_License" >+ ], >+ "Begin_Date": "2022-01-01", >+ "End_Date": "2022-03-31", >+ "Data_Type": [ >+ "Book", >+ "Reference_Work" >+ ], >+ "Access_Method": [ >+ "Regular" >+ ] >+ } >+ }, >+ "Report_Items": [ >+ { >+ "Title": "Title 1", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt01", >+ "Proprietary": "P1:T01", >+ "ISBN": "979-8-88888-888-8", >+ "URI": "https://doi.org/10.9999/xxxxt01" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Data_Type": "Book", >+ "YOP": "2022", >+ "Performance": { >+ "Limit_Exceeded": { >+ "2022-01": 49, >+ "2022-02": 90, >+ "2022-03": 40 >+ }, >+ "No_License": { >+ "2022-01": 50, >+ "2022-02": 84, >+ "2022-03": 47 >+ } >+ } >+ } >+ ] >+ }, >+ { >+ "Title": "Title 7", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt07", >+ "Proprietary": "P1:T07", >+ "ISBN": "979-8-88888-888-9", >+ "URI": "https://doi.org/10.9999/xxxxt07" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Data_Type": "Reference_Work", >+ "YOP": "2019", >+ "Performance": { >+ "Limit_Exceeded": { >+ "2022-01": 84, >+ "2022-02": 84, >+ "2022-03": 49 >+ }, >+ "No_License": { >+ "2022-01": 70, >+ "2022-02": 74, >+ "2022-03": 54 >+ } >+ } >+ } >+ ] >+ } >+ ] >+} >\ No newline at end of file >diff --git a/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B3.json b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B3.json >new file mode 100644 >index 00000000000..945d609359d >--- /dev/null >+++ b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_B3.json >@@ -0,0 +1,147 @@ >+{ >+ "Report_Header": { >+ "Release": "5.1", >+ "Report_ID": "TR_B3", >+ "Report_Name": "Book Usage by Access Type", >+ "Created": "2023-02-15T09:11:12Z", >+ "Created_By": "Sample Publisher", >+ "Institution_ID": { >+ "ISNI": [ >+ "1234123412341234" >+ ] >+ }, >+ "Institution_Name": "Sample Institution", >+ "Registry_Record": "https://registry.projectcounter.org/platform/99999999-9999-9999-9999-999999999999", >+ "Report_Filters": { >+ "Metric_Type": [ >+ "Total_Item_Investigations", >+ "Total_Item_Requests", >+ "Unique_Item_Investigations", >+ "Unique_Item_Requests", >+ "Unique_Title_Investigations", >+ "Unique_Title_Requests" >+ ], >+ "Begin_Date": "2022-01-01", >+ "End_Date": "2022-03-31", >+ "Data_Type": [ >+ "Book", >+ "Reference_Work" >+ ], >+ "Access_Method": [ >+ "Regular" >+ ] >+ } >+ }, >+ "Report_Items": [ >+ { >+ "Title": "Title 1", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt01", >+ "Proprietary": "P1:T01", >+ "ISBN": "979-8-88888-888-8", >+ "URI": "https://doi.org/10.9999/xxxxt01" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Data_Type": "Book", >+ "YOP": "2022", >+ "Access_Type": "Controlled", >+ "Performance": { >+ "Total_Item_Investigations": { >+ "2022-01": 1104, >+ "2022-02": 1246, >+ "2022-03": 1329 >+ }, >+ "Total_Item_Requests": { >+ "2022-01": 662, >+ "2022-02": 748, >+ "2022-03": 797 >+ }, >+ "Unique_Item_Investigations": { >+ "2022-01": 828, >+ "2022-02": 935, >+ "2022-03": 997 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 497, >+ "2022-02": 561, >+ "2022-03": 598 >+ }, >+ "Unique_Title_Investigations": { >+ "2022-01": 552, >+ "2022-02": 623, >+ "2022-03": 665 >+ }, >+ "Unique_Title_Requests": { >+ "2022-01": 414, >+ "2022-02": 467, >+ "2022-03": 499 >+ } >+ } >+ } >+ ] >+ }, >+ { >+ "Title": "Title 7", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt07", >+ "Proprietary": "P1:T07", >+ "ISBN": "979-8-88888-888-9", >+ "URI": "https://doi.org/10.9999/xxxxt07" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Data_Type": "Reference_Work", >+ "YOP": "2019", >+ "Access_Type": "Controlled", >+ "Performance": { >+ "Total_Item_Investigations": { >+ "2022-01": 1645, >+ "2022-02": 1022, >+ "2022-03": 1106 >+ }, >+ "Total_Item_Requests": { >+ "2022-01": 987, >+ "2022-02": 613, >+ "2022-03": 664 >+ }, >+ "Unique_Item_Investigations": { >+ "2022-01": 1234, >+ "2022-02": 767, >+ "2022-03": 830 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 740, >+ "2022-02": 460, >+ "2022-03": 498 >+ }, >+ "Unique_Title_Investigations": { >+ "2022-01": 301, >+ "2022-02": 283, >+ "2022-03": 217 >+ }, >+ "Unique_Title_Requests": { >+ "2022-01": 226, >+ "2022-02": 212, >+ "2022-03": 163 >+ } >+ } >+ } >+ ] >+ } >+ ] >+} >\ No newline at end of file >diff --git a/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J1.json b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J1.json >new file mode 100644 >index 00000000000..b38542432e3 >--- /dev/null >+++ b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J1.json >@@ -0,0 +1,104 @@ >+{ >+ "Report_Header": { >+ "Release": "5.1", >+ "Report_ID": "TR_J1", >+ "Report_Name": "Journal Requests (Excluding OA_Gold)", >+ "Created": "2023-08-29T07:11:41Z", >+ "Created_By": "Test Systems Inc.", >+ "Institution_ID": { >+ "Proprietary": [ >+ "TInsti:EALTEST001" >+ ], >+ "ISNI": [ >+ "0000000123456789" >+ ] >+ }, >+ "Institution_Name": "Test Institution", >+ "Registry_Record": "https://registry.projectcounter.org/platform/99999999-9999-9999-9999-999999999999", >+ "Report_Filters": { >+ "Metric_Type": [ >+ "Total_Item_Requests", >+ "Unique_Item_Requests" >+ ], >+ "Begin_Date": "2021-09-01", >+ "End_Date": "2022-09-30", >+ "Data_Type": [ >+ "Journal" >+ ], >+ "Access_Type": [ >+ "Controlled" >+ ], >+ "Access_Method": [ >+ "Regular" >+ ], >+ "Data_Type": [ >+ "Journal" >+ ] >+ } >+ }, >+ "Report_Items": [ >+ { >+ "Title": "Education and Training", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt03", >+ "Proprietary": "P1:T03", >+ "Online_ISSN": "1234-4321", >+ "URI": "https://doi.org/10.9999/xxxxt03" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Performance": { >+ "Total_Item_Requests": { >+ "2022-01": 526, >+ "2022-02": 866, >+ "2022-03": 852 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 226, >+ "2022-02": 372, >+ "2022-03": 366 >+ } >+ } >+ } >+ ] >+ }, >+ { >+ "Title": "Test Journal", >+ "Publisher": "Test Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "0000000123456789" >+ ] >+ }, >+ "Platform": "Unit Test Library", >+ "Item_ID": { >+ "DOI": "10.1002/(ISSN)1111-2222", >+ "Proprietary": "TInsti:ABC1", >+ "Online_ISSN": "5555-6666", >+ "URI": "https://doi.org/10.9999/xxxxt03", >+ "Print_ISSN": "7777-8888" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Performance": { >+ "Total_Item_Requests": { >+ "2022-01": 1, >+ "2022-06": 1 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 1, >+ "2022-06": 1 >+ } >+ } >+ } >+ ] >+ } >+ ] >+} >\ No newline at end of file >diff --git a/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J2.json b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J2.json >new file mode 100644 >index 00000000000..3d4ccf17e4e >--- /dev/null >+++ b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J2.json >@@ -0,0 +1,96 @@ >+{ >+ "Report_Header": { >+ "Release": "5.1", >+ "Report_ID": "TR_J2", >+ "Report_Name": "Journal Access Denied", >+ "Created": "2023-02-15T09:11:12Z", >+ "Created_By": "Sample Publisher", >+ "Institution_ID": { >+ "ISNI": [ >+ "1234123412341234" >+ ] >+ }, >+ "Institution_Name": "Sample Institution", >+ "Registry_Record": "https://registry.projectcounter.org/platform/99999999-9999-9999-9999-999999999999", >+ "Report_Filters": { >+ "Metric_Type": [ >+ "Limit_Exceeded", >+ "No_License" >+ ], >+ "Begin_Date": "2022-01-01", >+ "End_Date": "2022-03-31", >+ "Data_Type": [ >+ "Journal" >+ ], >+ "Access_Method": [ >+ "Regular" >+ ] >+ } >+ }, >+ "Report_Items": [ >+ { >+ "Title": "Title 3", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt03", >+ "Proprietary": "P1:T03", >+ "Online_ISSN": "1234-4321", >+ "URI": "https://doi.org/10.9999/xxxxt03" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Performance": { >+ "Limit_Exceeded": { >+ "2022-01": 174, >+ "2022-02": 176, >+ "2022-03": 90 >+ }, >+ "No_License": { >+ "2022-01": 96, >+ "2022-02": 160, >+ "2022-03": 74 >+ } >+ } >+ } >+ ] >+ }, >+ { >+ "Title": "Another title", >+ "Publisher": "Another publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt03", >+ "Proprietary": "P1:T03", >+ "Online_ISSN": "1234-4321", >+ "URI": "https://doi.org/10.9999/xxxxt03" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Performance": { >+ "Limit_Exceeded": { >+ "2022-01": 222, >+ "2022-02": 111, >+ "2022-03": 55 >+ }, >+ "No_License": { >+ "2022-01": 11, >+ "2022-02": 22, >+ "2022-03": 33 >+ } >+ } >+ } >+ ] >+ } >+ ] >+} >\ No newline at end of file >diff --git a/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J3.json b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J3.json >new file mode 100644 >index 00000000000..d90a45a5044 >--- /dev/null >+++ b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J3.json >@@ -0,0 +1,170 @@ >+{ >+ "Report_Header": { >+ "Release": "5.1", >+ "Report_ID": "TR_J3", >+ "Report_Name": "Journal Usage by Access Type", >+ "Created": "2023-02-15T09:11:12Z", >+ "Created_By": "Sample Publisher", >+ "Institution_ID": { >+ "ISNI": [ >+ "1234123412341234" >+ ] >+ }, >+ "Institution_Name": "Sample Institution", >+ "Registry_Record": "https://registry.projectcounter.org/platform/99999999-9999-9999-9999-999999999999", >+ "Report_Filters": { >+ "Metric_Type": [ >+ "Total_Item_Investigations", >+ "Total_Item_Requests", >+ "Unique_Item_Investigations", >+ "Unique_Item_Requests" >+ ], >+ "Begin_Date": "2022-01-01", >+ "End_Date": "2022-03-31", >+ "Data_Type": [ >+ "Journal" >+ ], >+ "Access_Method": [ >+ "Regular" >+ ] >+ } >+ }, >+ "Report_Items": [ >+ { >+ "Title": "Title 3", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt03", >+ "Proprietary": "P1:T03", >+ "Online_ISSN": "1234-4321", >+ "URI": "https://doi.org/10.9999/xxxxt03" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Access_Type": "Controlled", >+ "Performance": { >+ "Total_Item_Investigations": { >+ "2022-01": 500, >+ "2022-02": 824, >+ "2022-03": 812 >+ }, >+ "Total_Item_Requests": { >+ "2022-01": 300, >+ "2022-02": 494, >+ "2022-03": 486 >+ }, >+ "Unique_Item_Investigations": { >+ "2022-01": 376, >+ "2022-02": 618, >+ "2022-03": 608 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 226, >+ "2022-02": 372, >+ "2022-03": 366 >+ } >+ } >+ }, >+ { >+ "Access_Type": "Open", >+ "Performance": { >+ "Total_Item_Investigations": { >+ "2022-01": 1504, >+ "2022-02": 2476, >+ "2022-03": 2434 >+ }, >+ "Total_Item_Requests": { >+ "2022-01": 902, >+ "2022-02": 1486, >+ "2022-03": 1462 >+ }, >+ "Unique_Item_Investigations": { >+ "2022-01": 1128, >+ "2022-02": 1858, >+ "2022-03": 1826 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 676, >+ "2022-02": 1114, >+ "2022-03": 1096 >+ } >+ } >+ } >+ ] >+ }, >+ { >+ "Title": "Title 4", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999", >+ "Proprietary": "P1:T03", >+ "Online_ISSN": "1234-4321", >+ "URI": "https://doi.org/10.9999" >+ }, >+ "Attribute_Performance": [ >+ { >+ "Access_Type": "Controlled", >+ "Performance": { >+ "Total_Item_Investigations": { >+ "2022-01": 3, >+ "2022-02": 4, >+ "2022-03": 9 >+ }, >+ "Total_Item_Requests": { >+ "2022-01": 55, >+ "2022-02": 44, >+ "2022-03": 33 >+ }, >+ "Unique_Item_Investigations": { >+ "2022-01": 88, >+ "2022-02": 55, >+ "2022-03": 77 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 22, >+ "2022-02": 33, >+ "2022-03": 44 >+ } >+ } >+ }, >+ { >+ "Access_Type": "Open", >+ "Performance": { >+ "Total_Item_Investigations": { >+ "2022-01": 55, >+ "2022-02": 76, >+ "2022-03": 12 >+ }, >+ "Total_Item_Requests": { >+ "2022-01": 65, >+ "2022-02": 34, >+ "2022-03": 87 >+ }, >+ "Unique_Item_Investigations": { >+ "2022-01": 12, >+ "2022-02": 66, >+ "2022-03": 88 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 45, >+ "2022-02": 23, >+ "2022-03": 76 >+ } >+ } >+ } >+ ] >+ } >+ ] >+} >\ No newline at end of file >diff --git a/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J4.json b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J4.json >new file mode 100644 >index 00000000000..426cde5d04d >--- /dev/null >+++ b/t/db_dependent/data/erm/eusage/COUNTER_5.1/TR_J4.json >@@ -0,0 +1,83 @@ >+{ >+ "Report_Header": { >+ "Release": "5.1", >+ "Report_ID": "TR_J4", >+ "Report_Name": "Journal Requests by YOP (Controlled)", >+ "Created": "2023-02-15T09:11:12Z", >+ "Created_By": "Sample Publisher", >+ "Institution_ID": { >+ "ISNI": [ >+ "1234123412341234" >+ ] >+ }, >+ "Institution_Name": "Sample Institution", >+ "Registry_Record": "https://registry.projectcounter.org/platform/99999999-9999-9999-9999-999999999999", >+ "Report_Filters": { >+ "Metric_Type": [ >+ "Total_Item_Requests", >+ "Unique_Item_Requests" >+ ], >+ "Begin_Date": "2022-01-01", >+ "End_Date": "2022-03-31", >+ "Data_Type": [ >+ "Journal" >+ ], >+ "Access_Type": [ >+ "Controlled" >+ ], >+ "Access_Method": [ >+ "Regular" >+ ] >+ } >+ }, >+ "Report_Items": [ >+ { >+ "Title": "Title 3", >+ "Publisher": "Sample Publisher", >+ "Publisher_ID": { >+ "ISNI": [ >+ "4321432143214321" >+ ] >+ }, >+ "Platform": "Platform 1", >+ "Item_ID": { >+ "DOI": "10.9999/xxxxt03", >+ "Proprietary": "P1:T03", >+ "Online_ISSN": "1234-4321", >+ "URI": "https://doi.org/10.9999/xxxxt03" >+ }, >+ "Attribute_Performance": [ >+ { >+ "YOP": "2022", >+ "Performance": { >+ "Total_Item_Requests": { >+ "2022-01": 150, >+ "2022-02": 247, >+ "2022-03": 243 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 113, >+ "2022-02": 186, >+ "2022-03": 183 >+ } >+ } >+ }, >+ { >+ "YOP": "2021", >+ "Performance": { >+ "Total_Item_Requests": { >+ "2022-01": 150, >+ "2022-02": 247, >+ "2022-03": 243 >+ }, >+ "Unique_Item_Requests": { >+ "2022-01": 113, >+ "2022-02": 186, >+ "2022-03": 183 >+ } >+ } >+ } >+ ] >+ } >+ ] >+} >\ No newline at end of file >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39345
:
185593
|
185594
|
185595
|
185596
|
185618
|
185619
|
185620
|
185621
|
185658
|
185659
|
185660
|
185661
|
185662
|
185663
|
185664
|
185922
|
185923
|
185924
|
185925
|
185926
|
185927
|
185928
|
186016
|
186042
|
186043
|
186044
|
186060
|
186061
| 186062 |
186063
|
186064
|
186065
|
186066
|
186067
|
186068