The objective of this project is to periodically generate statistical reports for OJS journals hosted by the University of Alberta Library.
We will accomplish this by leveraging the OJS Application Programming Interface (API) and utilizing the Python programming language.
The program is written in Python and requires the Requests, Pandas, and OpenPyxl libraries.
Currently, we recommend running the program in MacOS or Linux.
You will also need a .csv file that lists your journals, following this format:
| journal_title | journal_abbr | base_url | api_key |
|---|---|---|---|
| My Journal Name | MJN | https://myjournalname.ca | [API key] |
journal_title: Title of the journal.
journal_abbr: Abbreviated title.
base_url: URL of the journal's homepage.
api_key (token): API key corresponding to the journal. This is configured in OJS as shown:
journals.csv, found in the files folder, can be used as a template for your journal list.
journal_title,journal_abbr,base_url,api_key
Phenomenology and Practice,pandpr,https://journals.library.ualberta.ca/pandpr/index.php/pandpr, API_KEY_IS_HERE
The command pattern is:
python3 quarterly_stats.py [csv_file] [start_date] [end_date] [start_index] [end_index]
csv_file: The name/path of your csv list of journals.
start_date and end_date: The reporting period. Dates are in YYYY-MM-DD format.
start_index and end_index: Start and end indexes corresponding to the journals to report on (e.g. start_index = 0 will start the program at the first journal in the list).
For example:
python3 quarterly_stats.py my_journals.csv 2025-01-01 2025-03-31 0 10
will produce reports for the first 10 journals in my_journals.csv.
The program will produce an Excel spreadsheet report for each journal that is reported on, located in the Reports folder. The naming convention for the reports is [journal_abbr]_[start_date]_report.xlsx.
An example can be found in the reports folder.
OJS Version
The program was written and tested using OJS 3.3. OJS 3.5 testing is forthcoming (late 2025/early 2026).
Journals in Languages Other Than English
Currently, the program supports English, Canadian French, Italian, and German. To add another language to your local repository, follow the convention in the get_item_title function in quarterly_stats.py.
Report Appearance
Report appearance is affected by both the report template and the code. Colour, header formatting, and images (e.g. logos) can be added by altering the template. Chart appearance is primarily determined by the program.
Large Journals
You may encounter timeout errors with particularly large journals. If this occurs, try increasing your server timeout limit. (Ours is 180 seconds.)
