Commit 3d9b41dd authored by Janez K's avatar Janez K

added the hbp package

parent e07d1f25
......@@ -13,4 +13,5 @@ django-jsonview==0.3.0
django-celery==3.1.9
ladon==0.8.9
django-discover-runner==1.0
liac-arff==2.0.1
[
{
"pk": 6,
"model": "workflows.category",
"fields": {
"uid": "e73346b1-803c-4d44-8230-52c499f11da6",
"parent": null,
"workflow": null,
"user": null,
"order": 1,
"name": "HBP"
}
},
{
"pk": 35,
"model": "workflows.abstractwidget",
"fields": {
"category": 6,
"treeview_image": "",
"windows_queue": false,
"name": "Search criteria",
"is_streaming": false,
"uid": "5b6ead2a-2b78-4c97-ba65-d4c6eadaf028",
"interaction_view": "hbp_construct_query",
"image": "",
"package": "hbp",
"static_image": "",
"post_interact_action": "hbp_search_criteria_post",
"user": null,
"visualization_view": "",
"streaming_visualization_view": "",
"action": "hbp_search_criteria",
"wsdl_method": "",
"wsdl": "",
"interactive": true,
"has_progress_bar": false,
"order": 1,
"description": ""
}
},
{
"pk": 32,
"model": "workflows.abstractoutput",
"fields": {
"widget": 35,
"name": "Query",
"short_name": "q",
"variable": "query",
"uid": "2b61b4ca-b928-49bb-9193-71c53039668a",
"order": 1,
"description": "The query"
}
},
{
"pk": 113,
"model": "workflows.abstractwidget",
"fields": {
"category": 6,
"treeview_image": "",
"windows_queue": false,
"name": "Submit search criteria",
"is_streaming": false,
"uid": "c2c888f0-5197-46ea-8ff6-c663b031b15e",
"interaction_view": "",
"image": "",
"package": "hbp",
"static_image": "",
"post_interact_action": "",
"user": null,
"visualization_view": "",
"streaming_visualization_view": "",
"action": "hbp_submit_search_criteria",
"wsdl_method": "",
"wsdl": "",
"interactive": false,
"has_progress_bar": false,
"order": 1,
"description": ""
}
},
{
"pk": 215,
"model": "workflows.abstractinput",
"fields": {
"widget": 113,
"name": "Query",
"short_name": "q",
"uid": "488d0844-2691-4884-92ac-373196f6f73e",
"default": "",
"required": false,
"multi": false,
"parameter_type": null,
"variable": "query",
"parameter": false,
"order": 1,
"description": ""
}
},
{
"pk": 128,
"model": "workflows.abstractoutput",
"fields": {
"widget": 113,
"name": "Results",
"short_name": "res",
"variable": "results",
"uid": "da72a5f3-4c69-4d28-ae28-79d992fdcd29",
"order": 1,
"description": ""
}
}
]
\ No newline at end of file
from django.shortcuts import render
def hbp_construct_query(request, input_dict,output_dict,widget):
return render(request, 'interactions/hbp_construct_query.html',
{'widget':widget})
def hbp_filter_integers(request,input_dict,output_dict,widget):
return render(request, 'interactions/hbp_filter_integers.html',
{'widget':widget,'intList':input_dict['intList']})
\ No newline at end of file
def hbp_search_criteria(input_dict):
return {}
def hbp_search_criteria_post(postdata,input_dict,output_dict):
query = {}
query['classification'] = postdata.get('d',None)
query['geo'] = postdata.get('g',None)
query['age'] = postdata.get('a',None)
return {'query':query}
def hbp_submit_search_criteria(input_dict):
import orange
import tempfile
import arff
import os
dset = arff.load(open(os.path.dirname(os.path.abspath(__file__))+"/new_adni.arff",'rb'))
b = {}
query = input_dict['query']
b['attributes'] = []
if query['classification'] != None:
b['attributes'].append(('Classification',[u'CN', u'AD', u'LMCI', u'EMCI', u'SMC']))
else:
query['classification']=[None,]
if query['geo'] != None:
b['attributes'].append(('geo',[u'Africa', u'Asia', u'Australia', u'Europe', u'North America', u'South America']))
else:
query['geo'] =[None,]
if query['age'] != None:
b['attributes'].append(('age',[u'1-18', u'18-24', u'25-34', u'35-44', u'45-54', u'55-64', u'65+']))
else:
query['age'] = [None,]
fields = []
for c in query['classification']:
for g in query['geo']:
for a in query['age']:
fields.append((c,g,a))
b['attributes'].append(('count','NUMERIC'))
b['description'] = ""
b['relation'] = "HBP"
b['data'] = []
for field in fields:
d = []
if field[0] != None:
d.append(field[0])
if field[1] != None:
d.append(field[1])
if field[2] != None:
d.append(field[2])
counts = 0
for i in dset['data']:
if (i[-1]==field[0] or field[0]==None) and (i[0]==field[2] or field[2]==None) and (i[1]==field[1] or field[1]==None):
counts = counts+1
d.append(counts)
b['data'].append(d)
#a = arff.load_data()
f = tempfile.NamedTemporaryFile(delete=False,suffix='.arff')
f.write(arff.dumps(b))
f.close()
output_dict = {}
output_dict['results'] = orange.ExampleTable(f.name)
return output_dict
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
import os
# === STANDARD PACKAGE SETTINGS ===
PACKAGE_ROOT = os.path.dirname(__file__)
# === AUTO IMPORT OPTIONS ===
#If auto_import_package_data is true then given data file is automatically imported when ClowdFlows project is newly deployed or refreshed from git
AUTO_IMPORT_DB = True
#For auto_import_package_data_replace_option description see the 'replace' option in workflows/import_package command
AUTO_IMPORT_DB_REPLACE_OPTION = True
#If file(s) other than ./db/package_data.json should be imported, auto_import_package_data_files should be corrected
AUTO_IMPORT_DB_FILES = [os.path.join(PACKAGE_ROOT,'db/package_data.json')]
<div id="widgetinteract-{{widget.pk}}" height="500" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} wants your input!">
<form id="interactionform-{{widget.pk}}" name="interactionform-{{widget.pk}}">
<b>ICD-10 Classification</b><br>
<label><input type="checkbox" value="CN" name="d" style="display:inline;width:auto;"> CN<br></label>
<label><input type="checkbox" value="AD" name="d" style="display:inline;width:auto;"> Alzheimer's disiease<br></label>
<label><input type="checkbox" value="LMCI" name="d" style="display:inline;width:auto;"> LMCI<br></label>
<label><input type="checkbox" value="EMCI" name="d" style="display:inline;width:auto;"> EMCI<br></label>
<label><input type="checkbox" value="SMC" name="d" style="display:inline;width:auto;"> SMC<br></label>
<br>
<b>Geographic Region</b><br>
<label><input type="checkbox" value="Africa" name="g" style="display:inline;width:auto;"> Africa<br></label>
<label><input type="checkbox" value="Asia" name="g" style="display:inline;width:auto;"> Asia<br></label>
<label><input type="checkbox" value="Australia" name="g" style="display:inline;width:auto;"> Australia<br></label>
<label><input type="checkbox" value="Europe" name="g" style="display:inline;width:auto;"> Europe<br></label>
<label><input type="checkbox" value="North America" name="g" style="display:inline;width:auto;"> North America<br></label>
<label><input type="checkbox" value="South America" name="g" style="display:inline;width:auto;"> South America<br></label>
<br>
<b>Age range</b><br>
<label><input type="checkbox" value="1-18" name="a" style="display:inline;width:auto;"> 1-18<br></label>
<label><input type="checkbox" value="18-24" name="a" style="display:inline;width:auto;"> 18-24<br></label>
<label><input type="checkbox" value="25-34" name="a" style="display:inline;width:auto;"> 25-34<br></label>
<label><input type="checkbox" value="35-44" name="a" style="display:inline;width:auto;"> 35-44<br></label>
<label><input type="checkbox" value="45-54" name="a" style="display:inline;width:auto;"> 45-54<br></label>
<label><input type="checkbox" value="55-64" name="a" style="display:inline;width:auto;"> 55-64<br></label>
<label><input type="checkbox" value="65+" name="a" style="display:inline;width:auto;"> 65+<br></label>
<input type="hidden" name="widget_id" value="{{widget.pk}}">
</form>
</div>
\ No newline at end of file
<div id="widgetinteract-{{widget.pk}}" rel="{{widget.pk}}" class="widgetinteractdialog" title="{{widget.name}} wants your input!">
<form id="interactionform-{{widget.pk}}" name="interactionform-{{widget.pk}}">
{% for i in intList %}
<input type="checkbox" name="intListOut" value="{{i}}" style="display:inline;width:auto;">{{i}}<br>
{% endfor %}
<input type="hidden" name="widget_id" value="{{widget.pk}}">
</form>
</div>
\ No newline at end of file
<div id="widgetvisualization-{{widget.pk}}" rel="{{widget.pk}}" class="widgetvisualizationdialog" title="{{widget.name}} visualization">
<div style="width:400px;font-family:monospace;">
<table style="width:auto; border-collapse:collapse;">
{% for i in input_dict.intList %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{% if forloop.first %} {% else %}+{% endif %}
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; padding: 2px; padding-bottom: 4px; padding-top: 0; margin:2px;">
{{ i }}
</td>
</tr>
{% endfor %}
<tr style="width:auto">
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px; padding-top: 4px; margin:2px;">
=
</td>
<td style="text-align: right; width:auto; line-height: 0.5em; border-top: 1px solid black; padding: 2px;margin:2px;">
{{ input_dict.sum }}
</td>
</tr>
</table>
<br/>
{{ check }}
</div>
</div>
\ No newline at end of file
from django.conf.urls.defaults import patterns, include, url
urlpatterns = patterns('',
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/nx/Index.html$', 'workflows.latino.views.get_adc_index', name='get adc index'),
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/(?P<narrow_doc>n?)x/Index.html$', 'workflows.latino.views.get_adc_index', name='get adc index'),
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/(?P<narrow_doc>n?)x/Index(?P<document_id_from>[0-9]+)-(?P<document_id_to>[0-9]+).html$', 'workflows.latino.views.get_adc_index', name='get adc index'),
#url(r'^get-adc-index/widget(?P<widget_id>[0-9]+)/(?P<narrow_doc>n?)x/Document(?P<document_id>[0-9]+).html', 'workflows.latino.views.get_adc_page', name='get adc page'),
)
\ No newline at end of file
from django.shortcuts import render
def hbp_display_summation(request,input_dict,output_dict,widget):
if sum(input_dict['intList']) == input_dict['sum']:
check = 'The calculation appears correct.'
else:
check = 'The calculation appears incorrect!'
return render(request, 'visualizations/hbp_display_integers.html',{'widget':widget,'input_dict':input_dict, 'output_dict':output_dict, 'check':check})
......@@ -903,6 +903,7 @@ function updateWidgetListeners() {
if (data.status=="ok") {
unfinishDescendants(data.widget_id);
reportOk(data.message);
$(".run").click();
$(".statusimage"+data.widget_id).hide();
$(".done"+data.widget_id).show();
} else if (data.status=="error") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment