Skip to content

Commit

Permalink
Version 1.3.2
Browse files Browse the repository at this point in the history
Optional SCR searching
  • Loading branch information
filak committed Jun 10, 2019
1 parent 4266ef0 commit 5b1bc3e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
2 changes: 1 addition & 1 deletion flask-app/mtw-server-win-service.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#SERVER_HOSTNAME = 'localhost'
SERVER_PORT = 55930 #55931
SERVER_PORT = 55930 #55930 #55931
SERVICE_NAME = 'MTWServer'
SERVICE_DISPLAY_NAME = 'MTW Server'
SERVICE_DESCRIPTION = 'MeSH Translation Workflow Service'
Expand Down
2 changes: 1 addition & 1 deletion flask-app/mtw-server-win-worker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#SERVER_HOSTNAME = 'localhost'
SERVER_PORT = 55933 #55934
SERVER_PORT = 55933 #55933 #55934
SERVICE_NAME = 'MTWServerWorker'
SERVICE_DISPLAY_NAME = 'MTW Server Worker'
SERVICE_DESCRIPTION = 'MeSH Translation Workflow Service Background Worker'
Expand Down
23 changes: 19 additions & 4 deletions flask-app/mtw/templates/snips/filters-lang.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
{% else %}
{% set ALL_LANGS = 'checked' %}
{% endif %}

<div class="form-group mb-2">
<div class="form-group mb-2">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="radioLangAll" name="lang" value="all" class="custom-control-input" {{ ALL_LANGS }}>
<label class="custom-control-label" for="radioLangAll">Both langs</label>
Expand All @@ -18,8 +18,23 @@
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" id="radioLangTarget" name="lang" value="target" class="custom-control-input" {{ TRG_CHECKED }}>
<label class="custom-control-label text-success" for="radioLangTarget">Target</label>
</div>
</div>

{% if scr == 'yes' %}
{% set SCR_YES = 'checked' %}
{% else %}
{% set SCR_NO = 'checked' %}
{% endif %}

<div class="form-group mb-2">
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" name="scr" value="no" id="radioScrNo" {{ SCR_NO }}>
<label class="custom-control-label" for="radioScrNo">Exclude SCR</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" name="scr" value="yes" id="radioScrYes" {{ SCR_YES }}>
<label class="custom-control-label" for="radioScrYes">Include SCR</label>
</div>
</div>



17 changes: 15 additions & 2 deletions flask-app/mtw/templates/sparql/search.sparql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Search/Text query v1.0
### Search/Text query v1.1
## All Descriptors & Concepts
## params: query string [+ filter: active=false]

Expand All @@ -23,6 +23,16 @@ WHERE {
?s rdfs:label ?label .
FILTER(?type IN(meshv:TopicalDescriptor,meshv:GeographicalDescriptor,meshv:PublicationType,meshv:CheckTag,meshv:Qualifier))
}

{% if scr == 'yes' %}
OPTIONAL {
?s meshv:mappedTo|meshv:preferredMappedTo|meshv:pharmacologicalAction ?d .
?d rdf:type ?type .
?d rdfs:label ?label .
FILTER (?type IN(meshv:TopicalDescriptor,meshv:Descriptor))
}
{% endif %}

OPTIONAL {
?d meshv:treeNumber ?s .
?d rdf:type ?type .
Expand All @@ -33,8 +43,10 @@ WHERE {
?d meshv:preferredConcept|meshv:concept ?c .
?d rdf:type ?type .
FILTER(?type IN(meshv:TopicalDescriptor,meshv:GeographicalDescriptor,meshv:PublicationType,meshv:CheckTag,meshv:Qualifier))
{% if scr == 'no' %}
?c rdf:type ?ctype .
FILTER(?ctype NOT IN(meshv:SCR_Chemical))
FILTER(?ctype NOT IN(meshv:SCR_Chemical,meshv:SCR_Disease,meshv:SCR_Organism,meshv:SCR_Protocol))
{% endif %}
}
OPTIONAL {
?s rdf:type ?stype .
Expand All @@ -51,6 +63,7 @@ WHERE {
?d mesht:concept ?s .
?d rdf:type ?type .
}

FILTER (BOUND(?d))
FILTER (?type IN(meshv:TopicalDescriptor,meshv:GeographicalDescriptor,meshv:PublicationType,meshv:CheckTag,meshv:Qualifier))
}
Expand Down
4 changes: 2 additions & 2 deletions flask-app/mtw_sparql/mtw_sparql.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
pp = pprint.PrettyPrinter(indent=2)


def getSparqlData(template, query='', show='', status='', top='', tn='', concept='', output='json', slang=None, lang=None):
def getSparqlData(template, query='', show='', status='', top='', tn='', concept='', output='json', slang=None, lang=None, scr=None):

toptn = ''
if tn:
Expand All @@ -30,7 +30,7 @@ def getSparqlData(template, query='', show='', status='', top='', tn='', concept
lang_umls = mtu.getLangCodeUmls(lang)

sparql = render_template('sparql/'+template+'.sparql', query=cleanQuery(query),
show=show, status=status, top=top, tn=tn, toptn=toptn, concept=concept, lang=lang, lang_umls=lang_umls, slang=slang)
show=show, status=status, top=top, tn=tn, toptn=toptn, concept=concept, lang=lang, lang_umls=lang_umls, slang=slang, scr=scr)

##print(sparql)

Expand Down

0 comments on commit 5b1bc3e

Please sign in to comment.