about summary refs log tree commit diff
path: root/wqflask/scripts
diff options
context:
space:
mode:
authorArun Isaac2022-09-29 16:05:11 +0530
committerArun Isaac2022-09-29 16:15:48 +0530
commitef17e6b57b267922ad0af2423e5d6d523458c8ed (patch)
tree170faab6da129caeacec3bfc1db824bfe4967eae /wqflask/scripts
parentd47977406a8c86e9e3afbfeb6b1779b041f7f4f6 (diff)
downloadgenenetwork2-ef17e6b57b267922ad0af2423e5d6d523458c8ed.tar.gz
Retrieve year as integer.
* wqflask/scripts/index.py (main): Retrieve year as an integer from
the SQL database.
* wqflask/wqflask/gsearch.py (GSearch.__init__): Convert year from
integer to string.
Diffstat (limited to 'wqflask/scripts')
-rw-r--r--wqflask/scripts/index.py5
1 files changed, 4 insertions, 1 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,