forked from Luke-Sikina/picsure-search-refinement
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ALS-6800] Detailed, paginated concepts fetch
- Create dump endpoint that fetches paginated concepts with meta - Create service and repo endpoints for this - Tests!
- Loading branch information
1 parent
2b08c24
commit cf1d0ed
Showing
11 changed files
with
237 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/ConceptMetaExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package edu.harvard.dbmi.avillach.dictionary.concept; | ||
|
||
import edu.harvard.dbmi.avillach.dictionary.concept.model.CategoricalConcept; | ||
import edu.harvard.dbmi.avillach.dictionary.concept.model.Concept; | ||
import edu.harvard.dbmi.avillach.dictionary.concept.model.ConceptShell; | ||
import org.springframework.dao.DataAccessException; | ||
import org.springframework.jdbc.core.ResultSetExtractor; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
@Component | ||
public class ConceptMetaExtractor implements ResultSetExtractor<Map<Concept, Map<String, String>>> { | ||
|
||
@Override | ||
public Map<Concept, Map<String, String>> extractData(ResultSet rs) throws SQLException, DataAccessException { | ||
Map<Concept, Map<String, String>> sets = new HashMap<>(); | ||
while (rs.next()) { | ||
Concept key = new ConceptShell(rs.getString("concept_path"), rs.getString("dataset_name")); | ||
Map<String, String> meta = sets.getOrDefault(key, new HashMap<>()); | ||
meta.put(rs.getString("KEY"), rs.getString("VALUE")); | ||
sets.put(key, meta); | ||
} | ||
return sets; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/edu/harvard/dbmi/avillach/dictionary/concept/model/ConceptShell.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package edu.harvard.dbmi.avillach.dictionary.concept.model; | ||
|
||
import java.util.Map; | ||
import java.util.Objects; | ||
|
||
public record ConceptShell(String conceptPath, String dataset) implements Concept { | ||
@Override | ||
public String name() { | ||
return "Shell. Not for external use."; | ||
} | ||
|
||
@Override | ||
public String display() { | ||
return "Shell. Not for external use."; | ||
} | ||
|
||
@Override | ||
public ConceptType type() { | ||
return ConceptType.Continuous; | ||
} | ||
|
||
@Override | ||
public Map<String, String> meta() { | ||
return Map.of(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object object) { | ||
return conceptEquals(object); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(conceptPath, dataset); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters