Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/1.1.0.0'
Browse files Browse the repository at this point in the history
* origin/release/1.1.0.0:
  release 1.1.0.0
  update dsf version
  upgrade dependencies, fix publish github actions, use List.of instead of Arrays.asList
  use process resource version as search-bundle version
  use commit hash instead of version tag for third-party actions, only build on pull_request
  allow code system searches
  update dependecies
  add reporting and fix reported code improvements where possible
  remove not needed options
  run workflows only once on pull-request, update actions
  update search bundle response example
  start development cycle 1.0.1.0
  • Loading branch information
wetret committed Jun 11, 2024
2 parents f10160a + 092f9a8 commit 76ca609
Show file tree
Hide file tree
Showing 19 changed files with 829 additions and 70 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI Build with Maven

on: [push, pull_request]
on: [pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
distribution: 'zulu'
java-version: 17
- uses: s4u/[email protected]
cache: 'maven'
- uses: s4u/maven-settings-action@7802f6aec16c9098b4798ad1f1d8ac75198194bd #3.0.0
with:
servers: |
[ {"id": "github-mii", "username": "${{ github.actor }}", "password": "${{ secrets.GITHUB_TOKEN }}"}]
- name: Build with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B verify -fae --file pom.xml
run: mvn --batch-mode --fail-at-end clean verify
19 changes: 8 additions & 11 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# This workflow will publish a Java project with Maven
# For more information see: https://docs.github.com/en/free-pro-team@latest/actions/guides/publishing-java-packages-with-maven

name: Java CI Publish with Maven

on:
Expand All @@ -13,24 +10,24 @@ on:
jobs:
publish:

# Only run if releases are published or pull requests are merged,
# omit running if pull requests are closed without merging
if: github.event.pull_request.merged || github.event.action == 'published'
# Only run if pull requests are merged, omit running if pull requests are closed without merging
if: github.event.pull_request.merged

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
distribution: 'zulu'
java-version: 17
- uses: s4u/[email protected]
cache: 'maven'
- uses: s4u/maven-settings-action@7802f6aec16c9098b4798ad1f1d8ac75198194bd #3.0.0
with:
servers: |
[ {"id": "github-mii", "username": "${{ github.actor }}", "password": "${{ secrets.GITHUB_TOKEN }}"}]
- name: Publish with Maven
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mvn -B deploy --file pom.xml
run: mvn --batch-mode --fail-at-end clean deploy
71 changes: 58 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

<groupId>de.medizininformatik-initiative</groupId>
<artifactId>mii-process-report</artifactId>
<version>1.0.0.0</version>
<version>1.1.0.0</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<compileSource>17</compileSource>
<compileTarget>17</compileTarget>

<dsf.version>1.3.1</dsf.version>
<dsf.version>1.5.1</dsf.version>
<testSetup.location>../mii-processes-test-setup</testSetup.location>
</properties>

Expand Down Expand Up @@ -45,19 +45,19 @@
<dependency>
<groupId>de.medizininformatik-initiative</groupId>
<artifactId>mii-processes-common</artifactId>
<version>1.0.0.0</version>
<version>1.0.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>6.0.13</version>
<version>6.1.6</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.9</version>
<version>2.0.13</version>
<scope>provided</scope>
</dependency>

Expand All @@ -78,7 +78,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.12.4</version>
<version>5.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -94,7 +94,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<version>3.13.0</version>
<configuration>
<source>${compileSource}</source>
<target>${compileTarget}</target>
Expand All @@ -103,12 +103,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.1</version>
<version>3.2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.1</version>
<configuration>
<archive>
<manifest>
Expand All @@ -125,7 +125,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -213,6 +213,26 @@
</workingPackages>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>4.8.5.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.22.0</version>
</plugin>
</plugins>
</build>

Expand All @@ -225,6 +245,9 @@
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/medizininformatik-initiative/mii-process-report</url>
</repository>
<site>
<id>${project.artifactId}-site</id>
</site>
</distributionManagement>

<repositories>
Expand Down Expand Up @@ -375,21 +398,21 @@
<fileset>
<directory>${testSetup.location}/docker/dic1/bpe/process</directory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
<include>${project.artifactId}-*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>${testSetup.location}/docker/dic2/bpe/process</directory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
<include>${project.artifactId}-*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>${testSetup.location}/docker/hrp/bpe/process</directory>
<includes>
<include>${project.artifactId}-${project.version}.jar</include>
<include>${project.artifactId}-*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
Expand All @@ -400,4 +423,26 @@
</build>
</profile>
</profiles>

<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<configuration>
<plugins>
<plugin>
<groupId>jp.skypencil.findbugs.slf4j</groupId>
<artifactId>bug-pattern</artifactId>
<version>1.5.0</version>
</plugin>
</plugins>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ public interface ConstantsReport
String BPMN_EXECUTION_VARIABLE_REPORT_RECEIVE_ERROR_MESSAGE = "reportReceiveErrorMessage";

String CODESYSTEM_REPORT = "http://medizininformatik-initiative.de/fhir/CodeSystem/report";
String CODESYSTEM_REPORT_VALUE_SEARCH_BUNDLE = "search-bundle";

String CODESYSTEM_REPORT_VALUE_SEARCH_BUNDLE = "search-bundle-v";
String CODESYSTEM_REPORT_VALUE_SEARCH_BUNDLE_RESPONSE_REFERENCE = "search-bundle-response-reference";
String CODESYSTEM_REPORT_VALUE_REPORT_STATUS = "report-status";
String CODESYSTEM_REPORT_VALUE_TIMER_INTERVAL = "timer-interval";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package de.medizininformatik_initiative.process.report;

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

Expand All @@ -11,8 +10,8 @@

public class ReportProcessPluginDefinition implements ProcessPluginDefinition
{
public static final String VERSION = "1.0.0.0";
public static final LocalDate RELEASE_DATE = LocalDate.of(2023, 10, 31);
public static final String VERSION = "1.1.0.0";
public static final LocalDate RELEASE_DATE = LocalDate.of(2024, 06, 11);

@Override
public String getName()
Expand Down Expand Up @@ -74,13 +73,12 @@ public Map<String, List<String>> getFhirResourcesByProcessId()
var vReportStatusSend = "fhir/ValueSet/report-status-send.xml";

return Map.of(ConstantsReport.PROCESS_NAME_FULL_REPORT_AUTOSTART,
Arrays.asList(
aAutostart, cReport, sAutostartStart, sAutostartStop, tAutostartStart, tAutostartStop, vReport),
List.of(aAutostart, cReport, sAutostartStart, sAutostartStop, tAutostartStart, tAutostartStop, vReport),
ConstantsReport.PROCESS_NAME_FULL_REPORT_RECEIVE,
Arrays.asList(aReceive, cReport, cReportStatus, eReportStatusError, nReportIdent, sSearchBundle,
List.of(aReceive, cReport, cReportStatus, eReportStatusError, nReportIdent, sSearchBundle,
sSearchBundleResponse, sSend, vReport, vReportStatusReceive),
ConstantsReport.PROCESS_NAME_FULL_REPORT_SEND,
Arrays.asList(aSend, cReport, cReportStatus, eReportStatusError, nReportIdent, sReceive, sSearchBundle,
List.of(aSend, cReport, cReportStatus, eReportStatusError, nReportIdent, sReceive, sSearchBundle,
sSearchBundleResponse, sSendStart, tSendStart, vReport, vReportStatusSend));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ private Stream<Task.ParameterComponent> createReceiptError(Variables variables)
private Task.ParameterComponent receiveToReceiptStatus(Task.ParameterComponent parameterComponent)
{
Type value = parameterComponent.getValue();
if (value instanceof Coding coding)
if (value instanceof Coding coding
&& ConstantsReport.CODESYSTEM_REPORT_STATUS_VALUE_RECEIVE_ERROR.equals(coding.getCode()))
{
if (ConstantsReport.CODESYSTEM_REPORT_STATUS_VALUE_RECEIVE_ERROR.equals(coding.getCode()))
{
coding.setCode(ConstantsReport.CODESYSTEM_REPORT_STATUS_VALUE_RECEIPT_ERROR);
}
coding.setCode(ConstantsReport.CODESYSTEM_REPORT_STATUS_VALUE_RECEIPT_ERROR);
}

return parameterComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@ protected void handleIntermediateThrowEventError(DelegateExecution execution, Va
if (task != null)
{
String statusCode = ConstantsReport.CODESYSTEM_REPORT_STATUS_VALUE_NOT_REACHABLE;
if (exception instanceof WebApplicationException webApplicationException)
if (exception instanceof WebApplicationException webApplicationException
&& webApplicationException.getResponse() != null
&& webApplicationException.getResponse().getStatus() == Response.Status.FORBIDDEN.getStatusCode())
{
if (webApplicationException.getResponse() != null && webApplicationException.getResponse()
.getStatus() == Response.Status.FORBIDDEN.getStatusCode())
{
statusCode = ConstantsReport.CODESYSTEM_REPORT_STATUS_VALUE_NOT_ALLOWED;
}
statusCode = ConstantsReport.CODESYSTEM_REPORT_STATUS_VALUE_NOT_ALLOWED;
}

task.addOutput(statusGenerator.createReportStatusOutput(statusCode, "Send report failed"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ public class CheckSearchBundle extends AbstractServiceDelegate

private static final List<String> DATE_SEARCH_PARAMS = List.of("date", "recorded-date", "onset-date", "effective",
"effective-time", "authored", "collected", "issued", "period", "location-period", "occurrence");
private static final List<String> CODE_SEARCH_PARAMS = List.of("code", "ingredient-code");
private static final List<String> OTHER_SEARCH_PARAMS = List.of("_profile", "type", SUMMARY_SEARCH_PARAM);

private static final List<String> VALID_SEARCH_PARAMS = Stream
.concat(DATE_SEARCH_PARAMS.stream(), OTHER_SEARCH_PARAMS.stream()).toList();
.of(DATE_SEARCH_PARAMS.stream(), CODE_SEARCH_PARAMS.stream(), OTHER_SEARCH_PARAMS.stream()).flatMap(s -> s)
.toList();

public CheckSearchBundle(ProcessPluginApi api)
{
Expand Down Expand Up @@ -114,6 +116,7 @@ private void testRequestUrls(List<Bundle.BundleEntryComponent> searches)
testContainsSummaryCount(uriComponents);
testContainsValidSearchParams(uriComponents);
testContainsValidDateSearchParams(uriComponents);
testContainsValidCodeSearchParams(uriComponents);
}

private void testContainsSummaryCount(List<UriComponents> uriComponents)
Expand Down Expand Up @@ -169,4 +172,24 @@ private void testSearchParamDateValues(Map<String, String> queryParams)
"Search Bundle contains date search params not limited to a year - [" + erroneousDateValues.stream()
.map(e -> e.getKey() + ":" + e.getValue()).collect(Collectors.joining(",")) + "]");
}

private void testContainsValidCodeSearchParams(List<UriComponents> uriComponents)
{
uriComponents.stream().filter(u -> !CAPABILITY_STATEMENT_PATH.equals(u.getPath()))
.map(u -> u.getQueryParams().toSingleValueMap()).forEach(this::testSearchParamCodeValues);
}

private void testSearchParamCodeValues(Map<String, String> queryParams)
{
List<Map.Entry<String, String>> codeParams = queryParams.entrySet().stream()
.filter(e -> CODE_SEARCH_PARAMS.contains(MODIFIERS.matcher(e.getKey()).replaceAll(""))).toList();

List<Map.Entry<String, String>> erroneousCodeValues = codeParams.stream()
.filter(e -> !e.getValue().endsWith("|")).toList();

if (erroneousCodeValues.size() > 0)
throw new RuntimeException(
"Search Bundle contains code search params not limited to system - [" + erroneousCodeValues.stream()
.map(e -> e.getKey() + ":" + e.getValue()).collect(Collectors.joining(",")) + "]");
}
}
Loading

0 comments on commit 76ca609

Please sign in to comment.