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
commit6b38eb42b91ed486a2dc87450417a3857662deb9 (patch)
tree2c461a94874c9944161b41373cd74b1357d287fc
parent3f3f02bc883b9b6e9cbb565b4734e9febfbe7b4e (diff)
downloadfatcat-6b38eb42b91ed486a2dc87450417a3857662deb9.tar.gz
fatcat-6b38eb42b91ed486a2dc87450417a3857662deb9.zip
chocula: openapc
-rwxr-xr-xextra/journal_metadata/chocula.py32
1 files changed, 31 insertions, 1 deletions
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