Skip to content

Commit

Permalink
Merge pull request #423 from medizininformatik-initiative/release/v6.0.4
Browse files Browse the repository at this point in the history
Release v6.0.4
  • Loading branch information
michael-82 authored Jan 10, 2025
2 parents 98741ea + 171e515 commit 9c279ac
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/integration-test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ services:
POSTGRES_DB: "dataportal"

dataportal-elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:8.16.0
image: docker.elastic.co/elasticsearch/elasticsearch:8.16.1
container_name: dataportal-elastic
ports:
- '9200:9200'
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [6.0.4] - 2025-01-10

### Fixed
- Time Restriction validation was broken when only one of beforeDate or afterDate was set ([#421](https://github.com/medizininformatik-initiative/feasibility-backend/issues/421))
- ### Security
- Update Spring Boot to 3.4.1

## [6.0.3] - 2024-12-10

### Changed
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ services:
source: dataportal-postgres-data
target: /var/lib/postgresql/data
dataportal-elastic:
image: docker.elastic.co/elasticsearch/elasticsearch:8.16.0
image: docker.elastic.co/elasticsearch/elasticsearch:8.16.1
container_name: dataportal-elastic
ports:
- '9200:9200'
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.0</version>
<version>3.4.1</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>

<groupId>de.medizininformatik-initiative</groupId>
<artifactId>DataportalBackend</artifactId>
<version>6.0.3</version>
<version>6.0.4</version>

<name>Dataportal Backend</name>
<description>Backend of the Dataportal</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ private boolean containsInvalidCriteria(List<Criterion> criteria) {
}

private boolean isTimeRestrictionInvalid(TimeRestriction timeRestriction) {
// If no timeRestriction is set, it is not invalid
if (timeRestriction == null) {
// If no timeRestriction is set or only on of both dates is set, it is not invalid
if (timeRestriction == null || timeRestriction.beforeDate() == null || timeRestriction.afterDate() == null) {
return false;
}
return LocalDate.parse(timeRestriction.beforeDate()).isBefore(LocalDate.parse(timeRestriction.afterDate()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertNotNull;

@Disabled("There seems to be a concurrency issue with TerminologyServiceIT. Disable this for now until it is fixed.")
@Tag("terminology")
@Tag("elasticsearch")
@Import({CodeableConceptService.class})
Expand All @@ -46,7 +45,7 @@ public class CodeableConceptServiceIT {

@Container
@ServiceConnection
public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.0")
public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.1")
.withEnv("discovery.type", "single-node")
.withEnv("xpack.security.enabled", "false")
.withReuse(false)
Expand All @@ -56,7 +55,7 @@ public class CodeableConceptServiceIT {
.waitingFor(Wait.forHttp("/health").forStatusCodeMatching(c -> c >= 200 && c <= 500));

@BeforeAll
static void setUp() {
static void setUp() throws InterruptedException {
ELASTICSEARCH_CONTAINER.start();
WebClient webClient = WebClient.builder().baseUrl("http://" + ELASTICSEARCH_CONTAINER.getHttpHostAddress()).build();
webClient.put()
Expand All @@ -72,6 +71,9 @@ static void setUp() {
.retrieve()
.toBodilessEntity()
.block();

// When running in github actions without a slight delay, the data might not be complete in the elastic search container (although a blocking call is used)
Thread.sleep(1000);
}

@AfterAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class TerminologyEsServiceIT {

@Container
@ServiceConnection
public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.0")
public static ElasticsearchContainer ELASTICSEARCH_CONTAINER = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.16.1")
.withEnv("discovery.type", "single-node")
.withEnv("xpack.security.enabled", "false")
.withReuse(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,22 @@ void testIsValid_falseOnInvalidTimeRestriction() {
assertFalse(isValid);
}

@Test
void testIsValid_trueOnOnlyBeforeDateTimeRestriction() {
doReturn(true).when(terminologyService).isExistingTermCode(any(String.class), any(String.class));
var isValid = structuredQueryValidation.isValid(createStructuredQueryWithOnlyBeforeDate());

assertTrue(isValid);
}

@Test
void testIsValid_trueOnOnlyAfterDateTimeRestriction() {
doReturn(true).when(terminologyService).isExistingTermCode(any(String.class), any(String.class));
var isValid = structuredQueryValidation.isValid(createStructuredQueryWithOnlyAfterDate());

assertTrue(isValid);
}

@ParameterizedTest
@CsvSource({"true,true", "true,false", "false,true", "false,false"})
void testAnnotateStructuredQuery_emptyIssuesOnValidCriteriaOrSkippedValidation(String withExclusionCriteriaString, String skipValidationString) {
Expand Down Expand Up @@ -201,4 +217,64 @@ private static StructuredQuery createStructuredQueryWithInvalidTimeRestriction()
.display("foo")
.build();
}

@NotNull
private static StructuredQuery createStructuredQueryWithOnlyBeforeDate() {
var context = TermCode.builder()
.code("Laboruntersuchung")
.system("fdpg.mii.cds")
.display("Laboruntersuchung")
.version("1.0.0")
.build();
var termCode = TermCode.builder()
.code("19113-0")
.system("http://loinc.org")
.display("IgE")
.build();
var timeRestriction = TimeRestriction.builder()
.beforeDate("1991-06-15")
.build();
var criterion = Criterion.builder()
.termCodes(List.of(termCode))
.context(context)
.attributeFilters(List.of())
.timeRestriction(timeRestriction)
.build();
return StructuredQuery.builder()
.version(URI.create("http://to_be_decided.com/draft-2/schema#"))
.inclusionCriteria(List.of(List.of(criterion)))
.exclusionCriteria(List.of())
.display("foo")
.build();
}

@NotNull
private static StructuredQuery createStructuredQueryWithOnlyAfterDate() {
var context = TermCode.builder()
.code("Laboruntersuchung")
.system("fdpg.mii.cds")
.display("Laboruntersuchung")
.version("1.0.0")
.build();
var termCode = TermCode.builder()
.code("19113-0")
.system("http://loinc.org")
.display("IgE")
.build();
var timeRestriction = TimeRestriction.builder()
.afterDate("1998-05-09")
.build();
var criterion = Criterion.builder()
.termCodes(List.of(termCode))
.context(context)
.attributeFilters(List.of())
.timeRestriction(timeRestriction)
.build();
return StructuredQuery.builder()
.version(URI.create("http://to_be_decided.com/draft-2/schema#"))
.inclusionCriteria(List.of(List.of(criterion)))
.exclusionCriteria(List.of())
.display("foo")
.build();
}
}

0 comments on commit 9c279ac

Please sign in to comment.