-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
46 lines (34 loc) · 1.53 KB
/
run.py
File metadata and controls
46 lines (34 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/env python3
"""CoLRev run operation: A simple tutorial version."""
from __future__ import annotations
import colrev.record.record
import colrev.review_manager
class JIFLabeler:
"""Object handling the JIF labeling"""
def __init__(self) -> None:
self.review_manager = colrev.review_manager.ReviewManager()
def add_jif(self, *, record: colrev.record.record.Record) -> None:
"""Add the journal impact factor"""
if "journal" not in record.data:
return
if record.data["journal"] == "MIS Quarterly":
record.update_field(
key="journal_impact_factor", value="8.3", source="jif-labeler"
)
if record.data["journal"] == "Information & Management":
record.update_field(
key="journal_impact_factor", value="10.3", source="jif-labeler"
)
def run(self) -> None:
self.review_manager.logger.info("Start simple colrev run")
self.review_manager.get_prep_operation()
records = self.review_manager.dataset.load_records_dict()
for record_dict in records.values():
record = colrev.record.record.Record(data=record_dict)
self.add_jif(record=record)
if "journal_impact_factor" in record.data:
self.review_manager.logger.info(record.data["ID"])
self.review_manager.dataset.save_records_dict_to_file(records=records)
self.review_manager.dataset.create_commit(msg="Add JIF")
jif_labeler = JIFLabeler()
jif_labeler.run()