Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add concept sets search (mergeable) #2315

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d083082
Concept set search WIP: add API method
anton-abushkevich Oct 31, 2022
0b5e68f
Concept sets search - initial implementation
anton-abushkevich Nov 21, 2022
84ceab5
Concept sets search - solr core config
anton-abushkevich Nov 21, 2022
6e2dcb4
Concept sets search - add search availability check
anton-abushkevich Nov 22, 2022
6a49a78
Concept sets search - add search availability checks to reindex
anton-abushkevich Nov 22, 2022
5d6e747
Concept sets search - add locales to new buttons
TitrS Nov 22, 2022
b4c4dec
Concept sets search - change key of clear search
TitrS Nov 22, 2022
db83d54
Concept sets search - search availability check now returns boolean
anton-abushkevich Nov 22, 2022
e1511a0
Concept sets search - add solr conf file
anton-abushkevich Nov 23, 2022
6afec85
Concept sets search - add locales to configuration
TitrS Nov 23, 2022
50d8d9c
Merge branch 'add_concept_sets_search' of https://github.com/OHDSI/We…
TitrS Nov 23, 2022
6ae0594
Concept sets search - reindex and search small fixes, async reindex i…
anton-abushkevich Nov 25, 2022
cb61e56
reindex was moved to spring job
ssuvorov-fls Nov 28, 2022
7154d78
reindex was moved to spring job
ssuvorov-fls Nov 30, 2022
6de0796
added permissions for reindex status endpoint
ssuvorov-fls Nov 30, 2022
e209b33
Concept sets search - catch and ignore ConceptNotExistException on CS…
anton-abushkevich Dec 1, 2022
a0f8b64
return empty list of documents when source does not contain required …
ssuvorov-fls Dec 1, 2022
70e149b
return empty list of documents when source does not contain required …
ssuvorov-fls Dec 1, 2022
eaf8f25
return empty list of documents when source does not contain required …
ssuvorov-fls Dec 1, 2022
e563453
return empty list of documents when source does not contain required …
ssuvorov-fls Dec 1, 2022
246477b
return empty list of documents when source does not contain required …
ssuvorov-fls Dec 1, 2022
8e94727
return empty list of documents when source does not contain required …
ssuvorov-fls Dec 1, 2022
f90e10f
solr functionalty was moved to sparate location
ssuvorov-fls Dec 9, 2022
8008322
solr functionalty was moved to separate location
ssuvorov-fls Dec 13, 2022
31698e7
Concept sets search - build fix & add maxResults parameter
anton-abushkevich Dec 13, 2022
a2b19fc
cherry pick from solr_refactoring
ssuvorov-fls Feb 8, 2023
b8459e9
fixed after review
ssuvorov-fls Feb 8, 2023
cbbf407
Merge remote-tracking branch 'origin/master' into add_concept_sets_se…
ssuvorov-fls Feb 13, 2023
5e665d6
merge master into current branch
ssuvorov-fls Feb 13, 2023
c9e2748
Merge remote-tracking branch 'remotes/origin/master' into add_concept…
alex-odysseus Oct 4, 2023
4c5f1ca
Merge remote-tracking branch 'remotes/origin/master' into add_concept…
alex-odysseus Oct 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,7 @@
<dependency>
<groupId>org.ohdsi</groupId>
<artifactId>standardized-analysis-specs</artifactId>
<version>1.5.0</version>
<version>1.6.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down Expand Up @@ -1848,12 +1848,14 @@
<solr.endpoint></solr.endpoint>
<solr.query.prefix>{!complexphrase inOrder=true}</solr.query.prefix>
<solr.version>8.11.2</solr.version>
<solr.conceptsets.core>webapi-conceptsets</solr.conceptsets.core>
<solr.conceptsets.maxResults>1000</solr.conceptsets.maxResults>
</properties>
<dependencies>
<dependency>
<groupId>org.ohdsi</groupId>
<artifactId>webapi-solr</artifactId>
<version>1.0.0</version>
<version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.solr</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.Set;

/**
*
* @author fdefalco
*/
public interface ConceptSetRepository extends CrudRepository<ConceptSet, Integer> {
ConceptSet findById(Integer conceptSetId);

@Query("select cs from ConceptSet cs where cs.id in (:conceptSetIds)")
List<ConceptSet> findAllById(@Param("conceptSetIds")final Set<Integer> conceptSetIds);

@Deprecated
@Query("SELECT cs FROM ConceptSet cs WHERE cs.name = :conceptSetName and cs.id <> :conceptSetId")
Expand All @@ -44,4 +48,6 @@ public interface ConceptSetRepository extends CrudRepository<ConceptSet, Integer

@Query("SELECT DISTINCT cs FROM ConceptSet cs JOIN FETCH cs.tags t WHERE lower(t.name) in :tagNames")
List<ConceptSet> findByTags(@Param("tagNames") List<String> tagNames);

List<ConceptSet> findAll();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.ohdsi.webapi.conceptset;

import org.ohdsi.conceptset.ConceptSetSearchProvider;

public interface ConceptSetSearchService {
ConceptSetSearchProvider getConceptSetSearchProvider();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.ohdsi.webapi.conceptset;

import java.util.Arrays;
import java.util.Comparator;

import org.ohdsi.conceptset.ConceptSetSearchProvider;
import org.ohdsi.vocabulary.VocabularySearchProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

@Service
public class ConceptSetSearchServiceImpl implements ConceptSetSearchService {
protected final Logger log = LoggerFactory.getLogger(getClass());

private static final String NO_PROVIDER_ERROR = "There is no concept set search provider";

private final ConceptSetSearchProvider[] conceptSetSearchProviders;

public ConceptSetSearchServiceImpl(ConceptSetSearchProvider[] conceptSetSearchProviders) {
this.conceptSetSearchProviders = conceptSetSearchProviders;
}

@Override
public ConceptSetSearchProvider getConceptSetSearchProvider() {
return Arrays.stream(conceptSetSearchProviders)
.sorted(Comparator.comparingInt(ConceptSetSearchProvider::getPriority))
.findFirst()
.orElseThrow(() -> new RuntimeException(String.format(NO_PROVIDER_ERROR)));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.ohdsi.webapi.conceptset;

import java.util.Collection;
import java.util.Set;

import org.ohdsi.conceptset.ConceptSetSearchDocument;
import org.ohdsi.conceptset.ConceptSetSearchProvider;
import org.springframework.stereotype.Service;

@Service
public class DefaultConceptSetSearchProvider implements ConceptSetSearchProvider {

private final static int DEFAULT_SEARCH_PRIORITY = Integer.MAX_VALUE;

@Override
public Set<Integer> executeSearch(String query, String[] domainIds) {
throw new UnsupportedOperationException("The Advanced Concept Set Search feature is available only if Apache Solr is configured properly");
}

@Override
public boolean isSearchAvailable() {
return false;
}

@Override
public void clearConceptSetIndex() {
throw new UnsupportedOperationException("The Advanced Concept Set Search feature is available only if Apache Solr is configured properly");
}

@Override
public void reindexConceptSet(Integer conceptSetId, Collection<ConceptSetSearchDocument> documents) {
throw new UnsupportedOperationException("The Advanced Concept Set Search feature is available only if Apache Solr is configured properly");
}

@Override
public void deleteConceptSetIndex(Integer id) {
throw new UnsupportedOperationException("The Advanced Concept Set Search feature is available only if Apache Solr is configured properly");
}

@Override
public int getPriority() {
return DEFAULT_SEARCH_PRIORITY;
}
}
Loading
Loading