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

Release v0.6.0 #162

Merged
merged 24 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e120372
Next Dev version
alexanderkiel Nov 21, 2024
389f6f5
Ensure that the Interval Bounds of TimeRestriction are Valid
alexanderkiel Nov 21, 2024
95e26c1
Merge pull request #160 from medizininformatik-initiative/159-ensure-…
alexanderkiel Nov 27, 2024
6a4e35f
Update slf4j monorepo to v2.0.16
renovate[bot] Nov 27, 2024
2a138cf
Merge pull request #145 from medizininformatik-initiative/renovate/sl…
alexanderkiel Nov 27, 2024
4b53b5a
Update hapi-fhir.version to v7.6.0
renovate[bot] Nov 27, 2024
98a3655
Merge pull request #143 from medizininformatik-initiative/renovate/ha…
alexanderkiel Nov 27, 2024
a6a8f8c
Update testcontainers-java monorepo to v1.20.4
renovate[bot] Nov 27, 2024
c07f3f6
Merge pull request #144 from medizininformatik-initiative/renovate/te…
alexanderkiel Nov 27, 2024
3a964f3
Update junit5 monorepo to v5.11.3
renovate[bot] Nov 27, 2024
3b4f0fe
Merge pull request #146 from medizininformatik-initiative/renovate/ju…
alexanderkiel Nov 27, 2024
c71b846
Update dependency ch.qos.logback:logback-classic to v1.5.12
renovate[bot] Nov 27, 2024
307c27a
Merge pull request #147 from medizininformatik-initiative/renovate/ch…
alexanderkiel Nov 27, 2024
53899c3
Update dependency ubuntu to v24
renovate[bot] Nov 27, 2024
88ffdf9
Merge pull request #157 from medizininformatik-initiative/renovate/ub…
alexanderkiel Nov 27, 2024
4629e2e
Update s4u/maven-settings-action action to v3.1.0
renovate[bot] Nov 27, 2024
a0a5862
Merge pull request #156 from medizininformatik-initiative/renovate/s4…
alexanderkiel Nov 27, 2024
3d0c48a
Update dependency org.apache.maven.plugins:maven-deploy-plugin to v3.1.3
renovate[bot] Nov 27, 2024
8038cd0
Merge pull request #150 from medizininformatik-initiative/renovate/or…
alexanderkiel Nov 27, 2024
de184a8
Update dependency org.apache.maven.plugins:maven-surefire-plugin to v…
renovate[bot] Nov 27, 2024
4563a8c
Merge pull request #149 from medizininformatik-initiative/renovate/or…
alexanderkiel Nov 27, 2024
b16d3a2
Update dependency org.apache.maven.plugins:maven-failsafe-plugin to v…
renovate[bot] Nov 27, 2024
d513d8b
Merge pull request #148 from medizininformatik-initiative/renovate/or…
alexanderkiel Nov 27, 2024
4fdfe96
Release v0.6.0
alexanderkiel Nov 28, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:

jobs:
build:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- name: Check out Git repository
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
run: mvn -B verify

deploy:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
needs: build
if: startsWith(github.ref, 'refs/tags/')

Expand All @@ -63,7 +63,7 @@ jobs:
key: maven-${{ hashFiles('pom.xml') }}

- name: Maven Settings
uses: s4u/maven-settings-action@v3.0.0
uses: s4u/maven-settings-action@v3.1.0
with:
servers: |
[{"id": "github", "username": "${{ github.actor }}", "password": "${{ secrets.GITHUB_TOKEN }}"}]
Expand Down
18 changes: 9 additions & 9 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.5.0</version>
<version>0.6.0</version>

<name>sq2cql</name>

Expand All @@ -28,10 +28,10 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
<junit-jupiter.version>5.10.3</junit-jupiter.version>
<hapi-fhir.version>7.2.1</hapi-fhir.version>
<testcontainers.version>1.20.0</testcontainers.version>
<slf4j.version>2.0.13</slf4j.version>
<junit-jupiter.version>5.11.3</junit-jupiter.version>
<hapi-fhir.version>7.6.0</hapi-fhir.version>
<testcontainers.version>1.20.4</testcontainers.version>
<slf4j.version>2.0.16</slf4j.version>
<ontology.version>3.0.0</ontology.version>
</properties>

Expand Down Expand Up @@ -94,7 +94,7 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.5.6</version>
<version>1.5.12</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.1</version>
<version>3.5.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.3.1</version>
<version>3.5.2</version>
<executions>
<execution>
<goals>
Expand All @@ -148,7 +148,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
<version>3.1.3</version>
</plugin>

<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ private static String referenceName(TermCode termCode) {

public abstract T appendAttributeFilter(AttributeFilter attributeFilter);

@Override
public List<AttributeFilter> attributeFilters() {
return attributeFilters;
}

@Override
public ContextualConcept getConcept() {
return concept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public Container<DefaultExpression> toReferencesCql(MappingContext mappingContex
throw new UnsupportedOperationException();
}

@Override
public List<AttributeFilter> attributeFilters() {
return List.of();
}

@Override
public TimeRestriction timeRestriction() {
return null;
Expand All @@ -74,6 +79,11 @@ public Container<DefaultExpression> toReferencesCql(MappingContext mappingContex
throw new UnsupportedOperationException();
}

@Override
public List<AttributeFilter> attributeFilters() {
return List.of();
}

@Override
public TimeRestriction timeRestriction() {
return null;
Expand Down Expand Up @@ -172,5 +182,7 @@ private static <T> T getAndMap(JsonNode node, String name, Function<JsonNode, T>

Container<DefaultExpression> toReferencesCql(MappingContext mappingContext);

List<AttributeFilter> attributeFilters();

TimeRestriction timeRestriction();
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,41 @@
import com.fasterxml.jackson.databind.JsonNode;
import de.numcodex.sq2cql.model.Mapping;

public record TimeRestriction(String afterDate, String beforeDate) {
import java.time.LocalDate;

public static TimeRestriction of(String afterDate, String beforeDate) {
import static java.util.Objects.requireNonNull;

public record TimeRestriction(LocalDate afterDate, LocalDate beforeDate) {

public TimeRestriction {
requireNonNull(afterDate);
requireNonNull(beforeDate);
if (beforeDate.isBefore(afterDate)) {
throw new IllegalArgumentException("Invalid time restriction: beforeDate `%s` is before afterDate `%s` but should not be."
.formatted(beforeDate, afterDate));
}
}

public static TimeRestriction of(LocalDate afterDate, LocalDate beforeDate) {
return new TimeRestriction(afterDate, beforeDate);
}

@JsonCreator
public static TimeRestriction create(@JsonProperty("afterDate") String afterDate,
@JsonProperty("beforeDate") String beforeDate) {
//FIXME: quick and dirty for empty timeRestriction
if (afterDate == null && beforeDate == null) {
return null;
} else if (afterDate == null) {
return TimeRestriction.of(LocalDate.of(1900, 1, 1), LocalDate.parse(beforeDate));
} else if (beforeDate == null) {
return TimeRestriction.of(LocalDate.parse(afterDate), LocalDate.of(2040, 1, 1));
} else {
return TimeRestriction.of(LocalDate.parse(afterDate), LocalDate.parse(beforeDate));
}
return TimeRestriction.of(afterDate, beforeDate);
}

public static TimeRestriction fromJsonNode(JsonNode node) {
return TimeRestriction.of(node.get("afterDate").asText(), node.get("beforeDate").asText());
return TimeRestriction.create(node.get("afterDate").asText(), node.get("beforeDate").asText());
}

public Modifier toModifier(Mapping mapping) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
import de.numcodex.sq2cql.model.MappingContext;
import de.numcodex.sq2cql.model.cql.*;

import java.time.LocalDate;
import java.util.List;

import static java.util.Objects.requireNonNull;

public record TimeRestrictionModifier(String path, String afterDate, String beforeDate) implements SimpleModifier {
public record TimeRestrictionModifier(String path, LocalDate afterDate, LocalDate beforeDate) implements SimpleModifier {

public TimeRestrictionModifier {
requireNonNull(path);
afterDate = afterDate == null ? "1900-01-01T" : afterDate;
beforeDate = beforeDate == null ? "2040-01-01T" : beforeDate;
requireNonNull(afterDate);
requireNonNull(beforeDate);
}

public static TimeRestrictionModifier of(String path, String afterDate, String beforeDate) {
public static TimeRestrictionModifier of(String path, LocalDate afterDate, LocalDate beforeDate) {
return new TimeRestrictionModifier(path, afterDate, beforeDate);
}

Expand All @@ -24,8 +25,13 @@ public Container<DefaultExpression> expression(MappingContext mappingContext, Id
var invocationExpr = InvocationExpression.of(sourceAlias, path);
var castExp = TypeExpression.of(invocationExpr, "dateTime");
var toDateFunction = FunctionInvocation.of("ToDate", List.of(castExp));
var intervalSelector = IntervalSelector.of(DateTimeExpression.of(afterDate), DateTimeExpression.of(beforeDate));
var intervalSelector = IntervalSelector.of(DateTimeExpression.of(afterDate.toString()), DateTimeExpression.of(beforeDate.toString()));
var dateTimeInExpr = MembershipExpression.in(toDateFunction, intervalSelector);

if ("recordedDate".equals(path)) {
return Container.of(dateTimeInExpr);
}

var intervalOverlapExpr = OverlapsIntervalOperatorPhrase.of(invocationExpr, intervalSelector);
return Container.of(OrExpression.of(dateTimeInExpr, intervalOverlapExpr));
}
Expand Down
18 changes: 5 additions & 13 deletions src/test/java/de/numcodex/sq2cql/AcceptanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Stream;
Expand All @@ -53,7 +52,7 @@ public class AcceptanceTest {
private static final Logger logger = LoggerFactory.getLogger(AcceptanceTest.class);

private final GenericContainer<?> blaze = new GenericContainer<>(
DockerImageName.parse("samply/blaze:0.28"))
DockerImageName.parse("samply/blaze:0.30"))
.withImagePullPolicy(PullPolicy.alwaysPull())
.withEnv("LOG_LEVEL", "debug")
.withExposedPorts(8080)
Expand All @@ -80,16 +79,8 @@ private static Bundle createBundle(Library library, Measure measure) {
return bundle;
}

public static List<StructuredQuery> getTestQueriesReturningOnePatient() throws URISyntaxException, IOException {
try (Stream<Path> paths = Files.list(resourcePath("returningOnePatient"))) {
return paths.map(path -> {
try {
return new ObjectMapper().readValue(Files.readString(path), StructuredQuery.class);
} catch (IOException e) {
throw new RuntimeException(e);
}
}).toList();
}
public static Stream<Path> getTestQueriesReturningOnePatient() throws IOException, URISyntaxException {
return Files.list(resourcePath("returningOnePatient"));
}

@BeforeAll
Expand All @@ -106,7 +97,8 @@ public void setUp() throws Exception {

@ParameterizedTest
@MethodSource("de.numcodex.sq2cql.AcceptanceTest#getTestQueriesReturningOnePatient")
public void runTestCase(StructuredQuery structuredQuery) throws Exception {
public void runTestCase(Path path) throws Exception {
var structuredQuery = new ObjectMapper().readValue(Files.readString(path), StructuredQuery.class);
var cql = translator.toCql(structuredQuery).print();
var measureUri = createMeasureAndLibrary(cql);
var report = evaluateMeasure(measureUri);
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.28"))
private final GenericContainer<?> blaze = new GenericContainer<>(DockerImageName.parse("samply/blaze:0.30"))
.withImagePullPolicy(PullPolicy.alwaysPull())
.withExposedPorts(8080)
.waitingFor(Wait.forHttp("/health").forStatusCode(200))
Expand Down
Loading