Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
disease-associations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
minerva
plugins
disease-associations
Commits
3a799117
Commit
3a799117
authored
5 years ago
by
David Hoksza
Browse files
Options
Downloads
Patches
Plain Diff
fixing multiple occurences of the same disease in suggestions due to case sensitivity
parent
569f3f6a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#9978
canceled
5 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/js/index.js
+1
-1
1 addition, 1 deletion
src/js/index.js
src/js/ols.js
+17
-4
17 additions, 4 deletions
src/js/ols.js
with
18 additions
and
5 deletions
src/js/index.js
+
1
−
1
View file @
3a799117
...
...
@@ -316,7 +316,7 @@ function initMainPageStructure(container){
{
name
:
'
diseases
'
,
source
:
typeaheadSource
,
limit
:
1
0
,
limit
:
3
0
});
pluginContainer
.
find
(
'
.typeahead
'
).
bind
(
'
typeahead:select
'
,
(
ev
,
suggestion
)
=>
typeaheadSelect
(
ev
,
suggestion
));
...
...
This diff is collapsed.
Click to expand it.
src/js/ols.js
+
17
−
4
View file @
3a799117
...
...
@@ -7,17 +7,30 @@ const getDisease = function(iri){
});
};
const
suggestDiseases
=
function
(
text
)
{
const
caseInsensitive
=
function
(
value
,
index
,
self
){
const
iVal
=
value
.
autosuggest
.
toLowerCase
();
for
(
let
i
=
0
;
i
<
self
.
length
;
i
++
){
if
(
self
[
i
].
autosuggest
.
toLowerCase
()
===
iVal
)
{
return
i
===
index
;
}
}
};
let
suggestedDisDesc
=
[];
//array of suggestion-disease description pair
return
$
.
ajax
({
url
:
`https://www.ebi.ac.uk/ols/api/suggest?q=
${
encodeURIComponent
(
text
)}
&ontology=efo&rows=20`
}).
then
(
function
(
res
)
{
const
suggestions
=
res
.
response
.
docs
.
map
(
d
=>
{
suggestedDisDesc
.
push
({
suggestion
:
d
.
autosuggest
,
desc
:
undefined
});
return
d
.
autosuggest
;
});
const
suggestions
=
res
.
response
.
docs
.
filter
(
caseInsensitive
)
.
map
(
d
=>
{
suggestedDisDesc
.
push
({
suggestion
:
d
.
autosuggest
,
desc
:
undefined
});
return
d
.
autosuggest
;
});
const
promises
=
suggestions
.
map
(
s
=>
$
.
ajax
({
url
:
`https://www.ebi.ac.uk/ols/api/search?q=
${
encodeURIComponent
(
s
)}
&ontology=efo&queryFields=label,synonym&exact=true`
}))
return
Promise
.
all
(
promises
);
}).
then
(
function
(
ress
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment