From 15b3019064260c9b9f40dcdcc8af15846f55cacd Mon Sep 17 00:00:00 2001 From: Geoffrey Spear Date: Tue, 30 Apr 2019 09:34:31 -0400 Subject: [PATCH] include a kludgy metric on COUNTER 5 SUSHI reports for compatibility (This resolves a Pitt HSLS-specific blocker on bringing data from COUNTER 5 SUSHI requests into our ERM in a compatible way, but is far from ideal in a pure COUNTER 5 report. I suspect all of the classes in the pycounter.report module will need to be completely redesigned with a separate compatibility layer, possibly outside of pycounter itself.) --- pycounter/sushi5.py | 1 + pycounter/test/counter5/test_sushi.py | 6 ++++++ pycounter/version.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pycounter/sushi5.py b/pycounter/sushi5.py index ce5ca29..5e067ca 100644 --- a/pycounter/sushi5.py +++ b/pycounter/sushi5.py @@ -52,6 +52,7 @@ def _raw_to_full(raw_report): "report_type": header["Report_ID"], "customer": header.get("Institution_Name", u""), "institutional_identifier": header.get("Customer_ID", u""), + "metric": "FT Item Requests", # FIXME: this is for COUNTER4 compatibility "date_run": pendulum.parse(date_run) if date_run else datetime.datetime.now(), } diff --git a/pycounter/test/counter5/test_sushi.py b/pycounter/test/counter5/test_sushi.py index bce0cf4..5f45fd4 100644 --- a/pycounter/test/counter5/test_sushi.py +++ b/pycounter/test/counter5/test_sushi.py @@ -17,3 +17,9 @@ def test_data(sushi5_report): publication = next(iter(sushi5_report)) data = [month[2] for month in publication] assert 14 == data[0] + + +def test_metric(sushi5_report): + publication = next(iter(sushi5_report)) + metrics = [month[1] for month in publication] + assert metrics[0] == u"FT Item Requests" # FIXME: COUNTER4 compat kludge diff --git a/pycounter/version.py b/pycounter/version.py index 9313282..05522fe 100644 --- a/pycounter/version.py +++ b/pycounter/version.py @@ -1,2 +1,2 @@ """version information.""" -__version__ = "2.0.0a1" +__version__ = "2.0.0a2"