From 6b38eb42b91ed486a2dc87450417a3857662deb9 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Tue, 30 Jul 2019 21:50:03 -0700 Subject: chocula: openapc --- extra/journal_metadata/chocula.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'extra') diff --git a/extra/journal_metadata/chocula.py b/extra/journal_metadata/chocula.py index 2dea62c2..72bff283 100755 --- a/extra/journal_metadata/chocula.py +++ b/extra/journal_metadata/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