aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chocula/directories/sim.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/chocula/directories/sim.py b/chocula/directories/sim.py
index fedcc29..1eb29be 100644
--- a/chocula/directories/sim.py
+++ b/chocula/directories/sim.py
@@ -10,6 +10,16 @@ from chocula.common import DirectoryLoader
from chocula.database import DirectoryInfo
+def truthy(raw: Optional[str]) -> Optional[bool]:
+ if not raw:
+ return None
+ if raw.lower() == 'y':
+ return True
+ if raw.lower() == 'n':
+ return False
+ return None
+
+
class SimLoader(DirectoryLoader):
source_slug = "sim"
@@ -57,8 +67,8 @@ class SimLoader(DirectoryLoader):
extra["gaps"] = gaps
if first_year and last_year:
extra["year_spans"] = gaps_to_spans(first_year, last_year, gaps)
- extra["scholarly_peer_reviewed"] = row["Scholarly / Peer-\nReviewed"]
- extra["peer_reviewed"] = row["Peer-\nReviewed"]
+ extra["scholarly_peer_reviewed"] = truthy(clean_str(row["Scholarly / Peer-\nReviewed"]))
+ extra["peer_reviewed"] = truthy(clean_str(row["Peer-\nReviewed"]))
extra["pub_type"] = clean_str(row["Pub Type"])
info = DirectoryInfo(