Skip to content

Commit

Permalink
cherry pick #91
Browse files Browse the repository at this point in the history
  • Loading branch information
Wooble committed Feb 18, 2020
1 parent c27cb90 commit c28839d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Usage
-----

Parsing COUNTER reports (currently supports 4 in .csv, .tsv,
or .xlsx files, reports JR1, DB1, DB2, BR1, and BR2) and COUNTER 5::
or .xlsx files, reports JR1, JR2, DB1, DB2, BR1, BR2, and BR3) and COUNTER 5::

>>> import pycounter.report
>>> report = pycounter.report.parse("COUNTER4_2015.tsv") # filename or path to file
Expand Down
11 changes: 11 additions & 0 deletions pycounter/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@ def _parse_line(line, report, last_col):
doi = ""
prop_id = ""

metric = report.metric
if report.report_type.startswith("JR1") or report.report_type == "TR_J1":
old_line = line
line = line[0:3] + line[5:7] + line[10:last_col]
Expand All @@ -795,6 +796,16 @@ def _parse_line(line, report, last_col):
isbn = line[3].strip()
issn = line[4].strip()

elif report.report_type in ("BR3", "JR2"):
metric = line[7]
doi = line[3]
prop_id = line[4]
line = line[0:3] + line[5:7] + line[9:last_col]
eissn = line[4].strip()
if report.report_type == "BR3":
isbn = line[3].strip()
else:
issn = line[3].strip()
# For DB1 and DB2, nothing additional to do here
elif report.report_type in ("BR3", "JR2"):
metric = line[7]
Expand Down

0 comments on commit c28839d

Please sign in to comment.