aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-07-30 21:50:03 -0700
committerBryan Newbold <bnewbold@robocracy.org>2019-07-30 21:50:03 -0700
commit138677a78c2eeae9f73cfc17fb0916aee7d9f956 (patch)
tree2f7d67de27ead3b07d5ef055fb5243bb9a2781b2
parent59489a56ec7032dca24d1bf534d52bb514bbbe77 (diff)
downloadchocula-138677a78c2eeae9f73cfc17fb0916aee7d9f956.tar.gz
chocula-138677a78c2eeae9f73cfc17fb0916aee7d9f956.zip
chocula: openapc
-rwxr-xr-xchocula.py32
1 files changed, 31 insertions, 1 deletions
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