From 138677a78c2eeae9f73cfc17fb0916aee7d9f956 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 30 Jul 2019 21:50:03 -0700 Subject: chocula: openapc --- chocula.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/chocula.py b/chocula.py index 2dea62c..72bff28 100755 --- a/chocula.py +++ b/chocula.py @@ -783,7 +783,7 @@ class ChoculaDatabase(): ) counts[status] += 1 # also add for other non-direct indices - for ind in ('OAPC', 'WOS', 'SCOPUS'): + for ind in ('WOS', 'SCOPUS'): issnl, status = self.add_issn( ind.lower(), raw_issn=row['ISSN_L'], @@ -826,6 +826,36 @@ class ChoculaDatabase(): self.db.commit() print(counts) + def index_openapc(self, args): + path = args.input_file or OPENAPC_FILE + print("##### Loading OpenAPC...") + # "institution","period","euro","doi","is_hybrid","publisher","journal_full_title","issn","issn_print","issn_electronic","issn_l","license_ref","indexed_in_crossref","pmid","pmcid","ut","url","doaj" + reader = csv.DictReader(open(path)) + counts = Counter() + self.c = self.db.cursor() + for row in reader: + if not row.get('issn'): + counts['skipped'] += 1 + continue + extra = dict(is_hybrid=bool(row['is_hybrid'])) + issnl, status = self.add_issn( + 'openapc', + issne=row['issn_electronic'], + issnp=row['issn_print'], + raw_issn=row['issn_l'] or row['issn'], + name=row['journal_full_title'], + publisher=row['publisher'], + extra=extra, + ) + counts[status] += 1 + if not issnl: + continue + if row.get('url'): + self.add_url(issnl, row['url']) + self.c.close() + self.db.commit() + print(counts) + def parse_kbart(self, name, path): """ Transforms a KBART file into a dict of dicts; but basically a list of -- cgit v1.2.3