summaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-06-30 14:48:11 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-06-30 14:48:11 -0700
commitc99547aa9663076266965bff05cc99472f382c01 (patch)
tree48c2aaff258d8796fc922c47dc40e0f845324ed8 /python
parentcdc8f987d16a91ac9d54a42c72d714fe8e4842d3 (diff)
downloadfatcat-c99547aa9663076266965bff05cc99472f382c01.tar.gz
fatcat-c99547aa9663076266965bff05cc99472f382c01.zip
fix issn importer booleans
Diffstat (limited to 'python')
-rw-r--r--python/fatcat/issn_importer.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/python/fatcat/issn_importer.py b/python/fatcat/issn_importer.py
index 69db8e66..eb45a640 100644
--- a/python/fatcat/issn_importer.py
+++ b/python/fatcat/issn_importer.py
@@ -15,6 +15,17 @@ def or_none(s):
return None
return s
+def truthy(s):
+ if s is None:
+ return None
+ s = s.lower()
+ if s in ('true', 't', 'yes', 'y', '1'):
+ return True
+ elif s in ('false', 'f', 'no', 'n', '0'):
+ return False
+ else:
+ return None
+
class FatcatIssnImporter(FatcatImporter):
def parse_issn_row(self, row):
@@ -27,14 +38,14 @@ class FatcatIssnImporter(FatcatImporter):
if title is None or issnl is None:
return
extra = dict(
- in_doaj=bool(row['in_doaj']),
- in_road=bool(row['in_road']),
+ in_doaj=truthy(row['in_doaj']),
+ in_road=truthy(row['in_road']),
language=or_none(row['lang']),
url=or_none(row['url']),
ISSNp=or_none(row['ISSN-print']),
ISSNe=or_none(row['ISSN-electronic']),
- is_oa=bool(row['is_oa']),
- is_kept=bool(row['is_kept']),
+ is_oa=truthy(row['is_oa']),
+ is_kept=truthy(row['is_kept']),
)
ce = fatcat_client.ContainerEntity(
issnl=issnl,