aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/scripts/index.py5
-rw-r--r--wqflask/wqflask/gsearch.py3
2 files changed, 5 insertions, 3 deletions
diff --git a/wqflask/scripts/index.py b/wqflask/scripts/index.py
index 447cc157..14e93dd1 100644
--- a/wqflask/scripts/index.py
+++ b/wqflask/scripts/index.py
@@ -120,6 +120,9 @@ def main():
write_document(db, trait["name"].bind(lambda name: f"Q{name}"), "gene", doc)
with database_connection() as conn:
+ # FIXME: Some years are blank strings or strings that
+ # contain text other than the year. These should be fixed
+ # in the database and the year field must be made an integer.
for i, trait in enumerate(sql_query_mdict(conn, """
SELECT Species.Name AS species,
InbredSet.Name AS `group`,
@@ -132,7 +135,7 @@ def main():
Publication.Abstract,
Publication.Title,
Publication.Authors AS authors,
- IF(Publication.Year='', 0, Publication.Year) AS year,
+ IF(CONVERT(Publication.Year, UNSIGNED)=0, NULL, CONVERT(Publication.Year, UNSIGNED)) AS year,
Publication.PubMed_ID AS pubmed_id,
PublishXRef.LRS as lrs,
PublishXRef.additive,
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py
index 861d8c9d..17c6c519 100644
--- a/wqflask/wqflask/gsearch.py
+++ b/wqflask/wqflask/gsearch.py
@@ -82,8 +82,7 @@ class GSearch:
trait["authors_display"] = (trait.pop("authors").map(
lambda authors:
", ".join(authors[:2] + ["et al."] if len(authors) >=2 else authors)))
- trait["pubmed_text"] = (trait["year"].bind(
- lambda year: Just(year) if year.isdigit() else Nothing))
+ trait["pubmed_text"] = trait["year"].map(str)
trait["pubmed_link"] = (trait["pubmed_id"].map(
lambda pubmedid: webqtlConfig.PUBMEDLINK_URL % pubmedid))
self.trait_list.append(trait.data)