aboutsummaryrefslogtreecommitdiff
path: root/wqflask/base
diff options
context:
space:
mode:
authorzsloan2022-09-06 13:40:12 -0500
committerGitHub2022-09-06 13:40:12 -0500
commit654252b2443fa9f69b700e3236ee89dbb8c81ad4 (patch)
tree571677761b3bb464b55bc19f208f135214321ad2 /wqflask/base
parent363237f11b9eb14f52c4f0c43a931c99c827c496 (diff)
parentd8bc7067b717e0b680d98b7cfcbc26c758a109bf (diff)
downloadgenenetwork2-654252b2443fa9f69b700e3236ee89dbb8c81ad4.tar.gz
Merge pull request #713 from zsloan/feature/generalize_tables
Feature/generalize tables
Diffstat (limited to 'wqflask/base')
-rw-r--r--wqflask/base/trait.py28
1 files changed, 22 insertions, 6 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 11b28c5c..b02c6033 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -300,10 +300,16 @@ def jsonable(trait, dataset=None):
dataset_type=trait.dataset.type,
group_name=trait.dataset.group.name)
+ trait_symbol = "N/A"
+ if trait.symbol:
+ trait_symbol = trait.symbol
+
if dataset.type == "ProbeSet":
return dict(name=trait.name,
- view=trait.view,
- symbol=trait.symbol,
+ display_name=trait.display_name,
+ hmac=hmac.data_hmac('{}:{}'.format(trait.display_name, dataset.name)),
+ view=str(trait.view),
+ symbol=trait_symbol,
dataset=dataset.name,
dataset_name=dataset.shortname,
description=trait.description_display,
@@ -316,7 +322,10 @@ def jsonable(trait, dataset=None):
elif dataset.type == "Publish":
if trait.pubmed_id:
return dict(name=trait.name,
- view=trait.view,
+ display_name=trait.display_name,
+ hmac=hmac.data_hmac('{}:{}'.format(trait.display_name, dataset.name)),
+ view=str(trait.view),
+ symbol=trait_symbol,
dataset=dataset.name,
dataset_name=dataset.shortname,
description=trait.description_display,
@@ -332,7 +341,10 @@ def jsonable(trait, dataset=None):
)
else:
return dict(name=trait.name,
- view=trait.view,
+ display_name=trait.display_name,
+ hmac=hmac.data_hmac('{}:{}'.format(trait.display_name, dataset.name)),
+ view=str(trait.view),
+ symbol=trait_symbol,
dataset=dataset.name,
dataset_name=dataset.shortname,
description=trait.description_display,
@@ -346,14 +358,18 @@ def jsonable(trait, dataset=None):
)
elif dataset.type == "Geno":
return dict(name=trait.name,
- view=trait.view,
+ display_name=trait.display_name,
+ hmac=hmac.data_hmac('{}:{}'.format(trait.display_name, dataset.name)),
+ view=str(trait.view),
dataset=dataset.name,
dataset_name=dataset.shortname,
location=trait.location_repr
)
elif dataset.name == "Temp":
return dict(name=trait.name,
- view=trait.view,
+ display_name=trait.display_name,
+ hmac=hmac.data_hmac('{}:{}'.format(trait.display_name, dataset.name)),
+ view=str(trait.view),
dataset="Temp",
dataset_name="Temp")
else: