forked from Sage-Bionetworks/sage-monorepo
-
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.
feat(openchallenges): filter EDAM concepts by sections (Sage-Bionetwo…
- Loading branch information
1 parent
ce781bd
commit 560fbf6
Showing
18 changed files
with
254 additions
and
3 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
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
47 changes: 47 additions & 0 deletions
47
...n/java/org/sagebionetworks/openchallenges/challenge/service/model/dto/EdamSectionDto.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,47 @@ | ||
package org.sagebionetworks.openchallenges.challenge.service.model.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import java.util.*; | ||
import javax.annotation.Generated; | ||
import javax.validation.constraints.*; | ||
|
||
/** The EDAM section (sub-ontology). */ | ||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen") | ||
public enum EdamSectionDto { | ||
DATA("data"), | ||
|
||
FORMAT("format"), | ||
|
||
IDENTIFIER("identifier"), | ||
|
||
OPERATION("operation"), | ||
|
||
TOPIC("topic"); | ||
|
||
private String value; | ||
|
||
EdamSectionDto(String value) { | ||
this.value = value; | ||
} | ||
|
||
@JsonValue | ||
public String getValue() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.valueOf(value); | ||
} | ||
|
||
@JsonCreator | ||
public static EdamSectionDto fromValue(String value) { | ||
for (EdamSectionDto b : EdamSectionDto.values()) { | ||
if (b.value.equals(value)) { | ||
return b; | ||
} | ||
} | ||
throw new IllegalArgumentException("Unexpected value '" + value + "'"); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
...sagebionetworks/openchallenges/challenge/service/model/search/EdamSectionValueBridge.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,22 @@ | ||
package org.sagebionetworks.openchallenges.challenge.service.model.search; | ||
|
||
import org.hibernate.search.mapper.pojo.bridge.ValueBridge; | ||
import org.hibernate.search.mapper.pojo.bridge.runtime.ValueBridgeToIndexedValueContext; | ||
import org.sagebionetworks.openchallenges.challenge.service.model.dto.EdamSectionDto; | ||
|
||
public class EdamSectionValueBridge implements ValueBridge<String, String> { | ||
|
||
@Override | ||
public String toIndexedValue(String value, ValueBridgeToIndexedValueContext context) { | ||
for (EdamSectionDto section : EdamSectionDto.values()) { | ||
// The first condition is used to map EDAM concept class IDs to concept sections when new | ||
// concept are created (e.g. during mass indexing). This value bridge is also called when | ||
// sending search queries to Elasticsearch, which is why the second condition is required to | ||
// map the user input to an existing EDAM concept. | ||
if (value.contains("/" + section.getValue() + "_") || section.getValue().equals(value)) { | ||
return section.getValue(); | ||
} | ||
} | ||
return null; | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
libs/openchallenges/api-client-angular/src/lib/model/edamSection.ts
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,26 @@ | ||
/** | ||
* OpenChallenges REST API | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
/** | ||
* The EDAM section (sub-ontology). | ||
*/ | ||
export type EdamSection = 'data' | 'format' | 'identifier' | 'operation' | 'topic'; | ||
|
||
export const EdamSection = { | ||
Data: 'data' as EdamSection, | ||
Format: 'format' as EdamSection, | ||
Identifier: 'identifier' as EdamSection, | ||
Operation: 'operation' as EdamSection, | ||
Topic: 'topic' as EdamSection | ||
}; | ||
|
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
Oops, something went wrong.