Release 5.1 of the Code of Practice came into force in January 2025, with a requirement for reports to be delivered by the 28th of February. (https://www.countermetrics.org/live-r51/?searched=r5%20harveste) See for for the details : https://www.countermetrics.org/education/whats-new/ https://cop5.projectcounter.org/en/5.1/appendices/b-changes-from-r5.html
+1, yes, there are about 175 publishers, data hosts, and platforms that have migrated to R5.1.
Increasing the importance of this.
Just adding that since some vendors are dropping COUNTER 5 support (EBSCO, for instance) it makes it impossible to pull their usage statistics until Koha supports the 5.1 releases.
Created attachment 185593 [details] [review] Bug 39345: Preparation: Move original test files We are now considering more than one COUNTER release. Move test files accordingly. prove t/db_dependent/Koha/ERM/EUsage/*
Created attachment 185594 [details] [review] Bug 39345: Add COUNTER 5.1 support This moves the original SUSHI COUNTER logic to a new Koha::ERM::EUsage::COUNTER::5 class that extends Koha::ERM::EUsage::SushiCounter. Adds a new Koha::ERM::EUsage::COUNTER::5_1 class with COUNTER 5.1 specific logic. Keeps common logic in Koha::ERM::EUsage::SushiCounter. This ensures we support both COUNTER 5.0 and COUNTER 5.1, but should hopefully help us better maintain COUNTER 5.1 going forward, without having to worry about COUNTER 5.0, as the code is seperated. This should also better set us up for adding support for possible future COUNTER releases. Test plan, k-t-d: 1) Enable ERMModule 2) Add a new usage data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/add 3) Add the required credential parameters e.g. Customer ID and Requestor ID 4) Update the 'Report release' to '5.1', no single quote. (If you add anything other than '5', it'll default to '5.1') 5) Visit the list of data providers and click the 'Run now' button for your data provider: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers 6) Click the background job link at the top. Verify the background job runs as expected. 7) After the successful harvest, run a custom report at, ensure the data is all correct: <staff_url>/cgi-bin/koha/erm/eusage/reports 8) Visit the data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/<provider_id> 9) Click the 'Import logs' tab, download the COUNTER 5.1 counter file. Open the file and verify the data is correct.
Created attachment 185595 [details] [review] 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/*
Created attachment 185596 [details] [review] Bug 39345: Use data provider report release to establish service URL
I will test this today but also with steps to verify no regression to COUNTER v5 providers.
Unit tests failed but usage tests succeeded. kohadev-koha@kohadevbox:koha(main)$ prove t/db_dependent/Koha/ERM/EUsage/* t/db_dependent/Koha/ERM/EUsage/COUNTER_5/CounterFile.t ..... ok t/db_dependent/Koha/ERM/EUsage/COUNTER_5/SushiCounter.t .... ok t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t ... ok t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/SushiCounter.t .. ok t/db_dependent/Koha/ERM/EUsage/CounterLog.t ................ ok t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t ......... # Failed test at t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t line 73. # got: 'https://service_url.com/r51/reports/tr_j1?customer_id=ID123&requestor_id=REQID123&api_key=APIKEY&begin_date=2023-08&end_date=2023-09' # expected: 'https://service_url.com/reports/tr_j1?customer_id=ID123&requestor_id=REQID123&api_key=APIKEY&begin_date=2023-08&end_date=2023-09' # Failed test at t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t line 106. # got: 'https://service_url.com/r51/reports/tr_j1?customer_id=ID123&requestor_id=REQID123&api_key=APIKEY&begin_date=2023-08&end_date=2023-09&platform=www.whatever.com' # expected: 'https://service_url.com/reports/tr_j1?customer_id=ID123&requestor_id=REQID123&api_key=APIKEY&begin_date=2023-08&end_date=2023-09&platform=www.whatever.com' # Looks like you failed 2 tests of 2. t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t ......... 1/3 # Failed test '_build_url_query' # at t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t line 113. # Looks like you failed 1 test of 3. t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t ......... Dubious, test returned 1 (wstat 256, 0x100) Failed 1/3 subtests Test Summary Report ------------------- t/db_dependent/Koha/ERM/EUsage/UsageDataProvider.t (Wstat: 256 (exited 1) Tests: 3 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=6, Tests=47, 8 wallclock secs ( 0.02 usr 0.02 sys + 4.27 cusr 0.73 csys = 5.04 CPU) Result: FAIL
Created attachment 185618 [details] [review] Bug 39345: (QA follow-up): Fix data provider tests Update original tests to consider COUNTER 5 specifically. Add new test for COUNTER 5.1.
Created attachment 185619 [details] [review] Bug 39345: (QA follow-up): Fix QA complaints QA script still fails but I believe these are false positives caused by the tests files being moved
Created attachment 185620 [details] [review] Bug 39345: (QA follow-up) Add exception handling for unsupported counter release To test this on the UI, you can add the following line of code at the beginning on 'new' in SushiCounter.pm: ->{response}->{Report_Header}->{Release} = 6; This will force the release to be '6'. Then you can perform a harvest using the UI. The background job will fail with the error message saying that counter release 6 is not supported prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t
Created attachment 185621 [details] [review] Bug 39345: (QA follow-up): Add exception handling for unsupported counter release To test this on the UI, you can add the following line of code at the beginning on 'new' in SushiCounter.pm: ->{response}->{Report_Header}->{Release} = 6; This will force the release to be '6'. Then you can perform a harvest using the UI. The background job will fail with the error message saying that counter release 6 is not supported prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t
Created attachment 185658 [details] [review] Bug 39345: Preparation: Move original test files We are now considering more than one COUNTER release. Move test files accordingly. prove t/db_dependent/Koha/ERM/EUsage/* Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Created attachment 185659 [details] [review] Bug 39345: Add COUNTER 5.1 support This moves the original SUSHI COUNTER logic to a new Koha::ERM::EUsage::COUNTER::5 class that extends Koha::ERM::EUsage::SushiCounter. Adds a new Koha::ERM::EUsage::COUNTER::5_1 class with COUNTER 5.1 specific logic. Keeps common logic in Koha::ERM::EUsage::SushiCounter. This ensures we support both COUNTER 5.0 and COUNTER 5.1, but should hopefully help us better maintain COUNTER 5.1 going forward, without having to worry about COUNTER 5.0, as the code is seperated. This should also better set us up for adding support for possible future COUNTER releases. Test plan, k-t-d: 1) Enable ERMModule 2) Add a new usage data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/add 3) Add the required credential parameters e.g. Customer ID and Requestor ID 4) Update the 'Report release' to '5.1', no single quote. (If you add anything other than '5', it'll default to '5.1') 5) Visit the list of data providers and click the 'Run now' button for your data provider: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers 6) Click the background job link at the top. Verify the background job runs as expected. 7) After the successful harvest, run a custom report at, ensure the data is all correct: <staff_url>/cgi-bin/koha/erm/eusage/reports 8) Visit the data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/<provider_id> 9) Click the 'Import logs' tab, download the COUNTER 5.1 counter file. Open the file and verify the data is correct. Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Created attachment 185660 [details] [review] 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>
Created attachment 185661 [details] [review] Bug 39345: Use data provider report release to establish service URL Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Created attachment 185662 [details] [review] Bug 39345: (QA follow-up): Fix data provider tests Update original tests to consider COUNTER 5 specifically. Add new test for COUNTER 5.1. Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Created attachment 185663 [details] [review] Bug 39345: (QA follow-up): Fix QA complaints QA script still fails but I believe these are false positives caused by the tests files being moved Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Created attachment 185664 [details] [review] Bug 39345: (QA follow-up): Add exception handling for unsupported counter release To test this on the UI, you can add the following line of code at the beginning on 'new' in SushiCounter.pm: ->{response}->{Report_Header}->{Release} = 6; This will force the release to be '6'. Then you can perform a harvest using the UI. The background job will fail with the error message saying that counter release 6 is not supported prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Created attachment 185922 [details] [review] Bug 39345: Preparation: Move original test files We are now considering more than one COUNTER release. Move test files accordingly. prove t/db_dependent/Koha/ERM/EUsage/* Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 185923 [details] [review] Bug 39345: Add COUNTER 5.1 support This moves the original SUSHI COUNTER logic to a new Koha::ERM::EUsage::COUNTER::5 class that extends Koha::ERM::EUsage::SushiCounter. Adds a new Koha::ERM::EUsage::COUNTER::5_1 class with COUNTER 5.1 specific logic. Keeps common logic in Koha::ERM::EUsage::SushiCounter. This ensures we support both COUNTER 5.0 and COUNTER 5.1, but should hopefully help us better maintain COUNTER 5.1 going forward, without having to worry about COUNTER 5.0, as the code is seperated. This should also better set us up for adding support for possible future COUNTER releases. Test plan, k-t-d: 1) Enable ERMModule 2) Add a new usage data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/add 3) Add the required credential parameters e.g. Customer ID and Requestor ID 4) Update the 'Report release' to '5.1', no single quote. (If you add anything other than '5', it'll default to '5.1') 5) Visit the list of data providers and click the 'Run now' button for your data provider: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers 6) Click the background job link at the top. Verify the background job runs as expected. 7) After the successful harvest, run a custom report at, ensure the data is all correct: <staff_url>/cgi-bin/koha/erm/eusage/reports 8) Visit the data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/<provider_id> 9) Click the 'Import logs' tab, download the COUNTER 5.1 counter file. Open the file and verify the data is correct. Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 185924 [details] [review] 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>
Created attachment 185925 [details] [review] Bug 39345: Use data provider report release to establish service URL Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 185926 [details] [review] Bug 39345: (QA follow-up): Fix data provider tests Update original tests to consider COUNTER 5 specifically. Add new test for COUNTER 5.1. Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 185927 [details] [review] Bug 39345: (QA follow-up): Fix QA complaints QA script still fails but I believe these are false positives caused by the tests files being moved Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 185928 [details] [review] Bug 39345: (QA follow-up): Add exception handling for unsupported counter release To test this on the UI, you can add the following line of code at the beginning on 'new' in SushiCounter.pm: ->{response}->{Report_Header}->{Release} = 6; This will force the release to be '6'. Then you can perform a harvest using the UI. The background job will fail with the error message saying that counter release 6 is not supported prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This is marked as enhancement, but please consider for backporting to 24.11 LTS at least. Thank you!
(In reply to Katrin Fischer from comment #28) > This is marked as enhancement, but please consider for backporting to 24.11 > LTS at least. Thank you! Added the keyword, so that it can be looked at after pushed. Backporting to 24.11 may be annoying due to the tidy stuff but doable ofc.
Created attachment 186016 [details] [review] [24.11.x] Bug 39345: 24.11 SQUASH prove t/db_dependent/api/v1/erm_usa* prove t/db_dependent/Koha/ERM/EUsage/* prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This is causing the following tests to fail: prove t/db_dependent/api/v1/erm_custom_reports.t I'm working on it.
Created attachment 186042 [details] [review] [24.11.x] Bug 39345: 24.11 SQUASH prove t/db_dependent/api/v1/erm_usa* prove t/db_dependent/Koha/ERM/EUsage/* prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t prove t/db_dependent/api/v1/erm_custom_reports.t Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 186043 [details] [review] Bug 39345: (QA follow-up): Fix erm_custom_reports.t prove t/db_dependent/api/v1/erm_custom_reports.t
Created attachment 186044 [details] [review] [24.11.x] Bug 39345: 24.11 SQUASH prove t/db_dependent/api/v1/erm_usa* prove t/db_dependent/Koha/ERM/EUsage/* prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t prove t/db_dependent/api/v1/erm_custom_reports.t Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Submitted follow up patch for erm_custom_reports.t + added it to the squashed 24.11.x patch.
Created attachment 186060 [details] [review] Bug 39345: Preparation: Move original test files We are now considering more than one COUNTER release. Move test files accordingly. prove t/db_dependent/Koha/ERM/EUsage/* Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 186061 [details] [review] Bug 39345: Add COUNTER 5.1 support This moves the original SUSHI COUNTER logic to a new Koha::ERM::EUsage::COUNTER::5 class that extends Koha::ERM::EUsage::SushiCounter. Adds a new Koha::ERM::EUsage::COUNTER::5_1 class with COUNTER 5.1 specific logic. Keeps common logic in Koha::ERM::EUsage::SushiCounter. This ensures we support both COUNTER 5.0 and COUNTER 5.1, but should hopefully help us better maintain COUNTER 5.1 going forward, without having to worry about COUNTER 5.0, as the code is seperated. This should also better set us up for adding support for possible future COUNTER releases. Test plan, k-t-d: 1) Enable ERMModule 2) Add a new usage data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/add 3) Add the required credential parameters e.g. Customer ID and Requestor ID 4) Update the 'Report release' to '5.1', no single quote. (If you add anything other than '5', it'll default to '5.1') 5) Visit the list of data providers and click the 'Run now' button for your data provider: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers 6) Click the background job link at the top. Verify the background job runs as expected. 7) After the successful harvest, run a custom report at, ensure the data is all correct: <staff_url>/cgi-bin/koha/erm/eusage/reports 8) Visit the data provider at: <staff_url>/cgi-bin/koha/erm/eusage/usage_data_providers/<provider_id> 9) Click the 'Import logs' tab, download the COUNTER 5.1 counter file. Open the file and verify the data is correct. Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 186062 [details] [review] 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>
Created attachment 186063 [details] [review] Bug 39345: Use data provider report release to establish service URL Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 186064 [details] [review] Bug 39345: (QA follow-up): Fix data provider tests Update original tests to consider COUNTER 5 specifically. Add new test for COUNTER 5.1. Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 186065 [details] [review] Bug 39345: (QA follow-up): Fix QA complaints QA script still fails but I believe these are false positives caused by the tests files being moved Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 186066 [details] [review] Bug 39345: (QA follow-up): Add exception handling for unsupported counter release To test this on the UI, you can add the following line of code at the beginning on 'new' in SushiCounter.pm: ->{response}->{Report_Header}->{Release} = 6; This will force the release to be '6'. Then you can perform a harvest using the UI. The background job will fail with the error message saying that counter release 6 is not supported prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 186067 [details] [review] Bug 39345: (QA follow-up): Fix erm_custom_reports.t prove t/db_dependent/api/v1/erm_custom_reports.t
Main patches rebased on top bug 40579
Created attachment 186068 [details] [review] [24.11.x] Bug 39345: 24.11 SQUASH The following tests must pass: prove t/db_dependent/api/v1/erm_usa* prove t/db_dependent/Koha/ERM/EUsage/* prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t prove t/db_dependent/api/v1/erm_custom_reports.t prove xt/author/Text_CSV_Various.t Signed-off-by: Eric Phetteplace <phette23@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
24.11.x patch rebased on top of bug 40579
Pedro, can you double check this test: /kohadevbox/koha/t/db_dependent/Koha/ERM/EUsage/CounterFile.t It's failing for me locally.
(In reply to Lucas Gass (lukeg) from comment #47) > Pedro, can you double check this test: > > /kohadevbox/koha/t/db_dependent/Koha/ERM/EUsage/CounterFile.t > > It's failing for me locally. Hey, double-checking here, t/db_dependent/Koha/ERM/EUsage/CounterFile.t shouldn't exist anymore, it's been split into 2 different files: t/db_dependent/Koha/ERM/EUsage/COUNTER_5/CounterFile.t t/db_dependent/Koha/ERM/EUsage/COUNTER_5.1/CounterFile.t After applying the patchset, all relevant tests (that I'm aware of) are passing for me: prove t/db_dependent/api/v1/erm_usa* prove t/db_dependent/Koha/ERM/EUsage/* prove t/db_dependent/Koha/BackgroundJobs/ErmSushiHarvester.t prove t/db_dependent/api/v1/erm_custom_reports.t prove xt/author/Text_CSV_Various.t
Nice work everyone! Pushed to main for 25.11
Nice work everyone! Pushed to 25.05.x