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

Vocabulary search common classes #56

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 {
Copy link
Contributor

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).


@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;
}
}