Skip to content

Commit

Permalink
Vocabulary search common classes (#56)
Browse files Browse the repository at this point in the history
Referencing the latest Standardized Analysis Utils and Circe
  • Loading branch information
alex-odysseus authored Sep 11, 2023
1 parent 6dd922f commit 1da4e72
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 10 deletions.
26 changes: 16 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.ohdsi</groupId>
<artifactId>standardized-analysis-specs</artifactId>
<version>1.4.0</version>
<version>1.5.0-SNAPSHOT</version>

<build>
<plugins>
Expand All @@ -21,14 +21,20 @@
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>ohdsi</id>
<name>repo.ohdsi.org</name>
<url>http://repo.ohdsi.org:8085/nexus/content/groups/public</url>
</repository>
<repository>
<id>ohdsi</id>
<name>repo.ohdsi.org</name>
<url>https://repo.ohdsi.org/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>ohdsi</id>
<name>repo.ohdsi.org</name>
<url>https://repo.ohdsi.org/nexus/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand All @@ -50,12 +56,12 @@
<dependency>
<groupId>org.ohdsi</groupId>
<artifactId>standardized-analysis-utils</artifactId>
<version>1.3.2</version>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.ohdsi</groupId>
<artifactId>circe</artifactId>
<version>1.9.4</version>
<version>1.11.1</version>
</dependency>

<dependency>
Expand All @@ -66,4 +72,4 @@
</dependency>
</dependencies>

</project>
</project>
16 changes: 16 additions & 0 deletions src/main/java/org/ohdsi/info/ConfigurationInfo.java
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;
}
}
48 changes: 48 additions & 0 deletions src/main/java/org/ohdsi/vocabulary/Concept.java
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);
}
}
9 changes: 9 additions & 0 deletions src/main/java/org/ohdsi/vocabulary/SearchProvider.java
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 src/main/java/org/ohdsi/vocabulary/SearchProviderConfig.java
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;
}
}

0 comments on commit 1da4e72

Please sign in to comment.