-
Notifications
You must be signed in to change notification settings - Fork 4
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
Vocabulary search common classes #56
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.ohdsi.info; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public abstract class ConfigurationInfo { | ||
|
||
protected final Map<String, Object> properties = new HashMap<>(); | ||
|
||
public abstract String getKey(); | ||
|
||
public Map<String, Object> getProperties() { | ||
|
||
return properties; | ||
} | ||
} |
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,48 @@ | ||
package org.ohdsi.vocabulary; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.annotation.JsonPropertyOrder; | ||
|
||
import java.util.Date; | ||
import java.util.Objects; | ||
|
||
@JsonInclude() | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonPropertyOrder({ | ||
"CONCEPT_ID", "CONCEPT_NAME", "STANDARD_CONCEPT", | ||
"STANDARD_CONCEPT_CAPTION", "INVALID_REASON", "INVALID_REASON_CAPTION", | ||
"CONCEPT_CODE", "DOMAIN_ID", "VOCABULARY_ID", "CONCEPT_CLASS_ID", | ||
"VALID_START_DATE", "VALID_END_DATE" | ||
}) | ||
public class Concept extends org.ohdsi.circe.vocabulary.Concept { | ||
|
||
@JsonProperty("VALID_START_DATE") | ||
public Date validStartDate; | ||
|
||
@JsonProperty("VALID_END_DATE") | ||
public Date validEndDate; | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (!(o instanceof Concept)) { | ||
return false; | ||
} | ||
final Concept other = (Concept) o; | ||
return Objects.equals(conceptId, other.conceptId) && Objects.equals(conceptName, other.conceptName) && | ||
Objects.equals(standardConcept, other.standardConcept) && Objects.equals(invalidReason, other.invalidReason) && | ||
Objects.equals(conceptCode, other.conceptCode) && Objects.equals(domainId, other.domainId) && | ||
Objects.equals(vocabularyId, other.vocabularyId) && Objects.equals(conceptClassId, other.conceptClassId) && | ||
Objects.equals(validStartDate, other.validStartDate) && Objects.equals(validEndDate, other.validEndDate); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(conceptId, conceptName, standardConcept, invalidReason, conceptCode, | ||
domainId, vocabularyId, conceptClassId, validStartDate, validEndDate); | ||
} | ||
} |
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,9 @@ | ||
package org.ohdsi.vocabulary; | ||
|
||
import java.util.Collection; | ||
|
||
public interface SearchProvider { | ||
boolean supports(String vocabularyVersionKey); | ||
int getPriority(); | ||
Collection<Concept> executeSearch(SearchProviderConfig config, String query, String rows) throws Exception; | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/org/ohdsi/vocabulary/SearchProviderConfig.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,19 @@ | ||
package org.ohdsi.vocabulary; | ||
|
||
public class SearchProviderConfig { | ||
private String sourceKey; | ||
private String versionKey; | ||
|
||
public SearchProviderConfig(String sourceKey, String versionKey) { | ||
this.sourceKey = sourceKey; | ||
this.versionKey = versionKey; | ||
} | ||
|
||
public String getVersionKey() { | ||
return versionKey; | ||
} | ||
|
||
public String getSourceKey() { | ||
return sourceKey; | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something that feels messy now: That the StandardAnalysisAPI is pulling a base class from another library (circe) but then extending it here in SAA to add ValidStartDate/ValidEndDate.
I don't think we need to take action now, but ideally what we should have in the future is that we can define standard objects in SAA (such as Concept) and haave circe-be depend back on SAA to get the 'standard' classes (along with defining it's own cohort specific classes). Eventually, it would be nice to have the circe classes put into SAA (but that is much much further down the road).