Skip to content

Commit

Permalink
Merge pull request #142 from medizininformatik-initiative/release-v0.4.0
Browse files Browse the repository at this point in the history
Release v0.4.0
  • Loading branch information
alexanderkiel authored Jul 22, 2024
2 parents f0d8d53 + fe9963b commit 5837c7a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 46 deletions.
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>de.medizininformatik-initiative</groupId>
<artifactId>sq2cql</artifactId>
<version>0.3.0</version>
<version>0.4.0</version>

<name>sq2cql</name>

Expand All @@ -28,9 +28,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
<junit-jupiter.version>5.10.2</junit-jupiter.version>
<junit-jupiter.version>5.10.3</junit-jupiter.version>
<hapi-fhir.version>7.2.1</hapi-fhir.version>
<testcontainers.version>1.19.8</testcontainers.version>
<testcontainers.version>1.20.0</testcontainers.version>
<slf4j.version>2.0.13</slf4j.version>
<ontology.version>2.2.0</ontology.version>
</properties>
Expand All @@ -40,7 +40,7 @@
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.1</version>
<version>2.17.2</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -73,7 +73,7 @@
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.0</version>
<version>3.26.3</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -128,13 +128,13 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public Container<QueryExpression> updateQuery(MappingContext mappingContext, Con
var referenceExpr = InvocationExpression.of(query.sourceAlias(), path);
var alias = StandardIdentifierExpression.of(targetType.substring(0, 1));
var ref = AdditionExpressionTerm.of(StringLiteralExpression.of(targetType + "/"), InvocationExpression.of(alias, "id"));
var comparatorExpr = ComparatorExpression.equal(referenceExpr, ref);
var comparatorExpr = MembershipExpression.contains(referenceExpr, ref);
return query.appendQueryInclusionClause(WithClause.of(AliasedQuerySource.of(referencesExprName, alias), comparatorExpr));
}));
}
Expand Down
23 changes: 21 additions & 2 deletions src/test/java/de/numcodex/sq2cql/AcceptanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.junit.jupiter.api.TestInstance;
import org.junit.jupiter.api.TestInstance.Lifecycle;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;
import org.slf4j.Logger;
Expand Down Expand Up @@ -49,7 +50,7 @@ public class AcceptanceTest {
private static final Logger logger = LoggerFactory.getLogger(AcceptanceTest.class);

private final GenericContainer<?> blaze = new GenericContainer<>(
DockerImageName.parse("samply/blaze:0.27"))
DockerImageName.parse("samply/blaze:0.28"))
.withImagePullPolicy(PullPolicy.alwaysPull())
.withEnv("LOG_LEVEL", "debug")
.withExposedPorts(8080)
Expand Down Expand Up @@ -158,7 +159,8 @@ public void consent() throws Exception {
}

@ParameterizedTest
@ValueSource(strings = {"large-query-worst-case-with-time-constraints.json", "test-large-query-more-crit-time-rest-1.json"})
@ValueSource(strings = {"large-query-worst-case-with-time-constraints.json",
"test-large-query-more-crit-time-rest-1.json"})
public void largeQuery(String filename) throws Exception {
var structuredQuery = new ObjectMapper().readValue(slurp(filename), StructuredQuery.class);
var cql = translator.toCql(structuredQuery).print();
Expand All @@ -168,6 +170,23 @@ public void largeQuery(String filename) throws Exception {
assertEquals(0, report.getGroupFirstRep().getPopulationFirstRep().getCount());
}

@ParameterizedTest
@CsvSource({
"SpecimenSQ.json, 0",
"SpecimenSQExclusion.json, 159",
"SpecimenSQTwoInclusion.json, 0",
"SpecimenSQTwoReferenceCriteria.json, 0",
"SpecimenSQAndBodySite.json, 0"
})
public void specimenQuery(String filename, int count) throws Exception {
var structuredQuery = new ObjectMapper().readValue(slurp(filename), StructuredQuery.class);
var cql = translator.toCql(structuredQuery).print();
var measureUri = createMeasureAndLibrary(cql);
var report = evaluateMeasure(measureUri);

assertEquals(count, report.getGroupFirstRep().getPopulationFirstRep().getCount());
}

private String createMeasureAndLibrary(String cql) throws Exception {
var libraryUri = "urn:uuid" + UUID.randomUUID();
var library = appendCql(parseResource(Library.class, slurp("Library.json")).setUrl(libraryUri), cql);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/de/numcodex/sq2cql/EvaluationIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class EvaluationIT {
static final Map<String, String> CODE_SYSTEM_ALIASES = Map.of("http://loinc.org", "loinc");

@Container
private final GenericContainer<?> blaze = new GenericContainer<>(DockerImageName.parse("samply/blaze:0.27"))
private final GenericContainer<?> blaze = new GenericContainer<>(DockerImageName.parse("samply/blaze:0.28"))
.withImagePullPolicy(PullPolicy.alwaysPull())
.withExposedPorts(8080)
.waitingFor(Wait.forHttp("/health").forStatusCode(200))
Expand Down
Loading

0 comments on commit 5837c7a

Please sign in to comment.