Skip to content

Commit

Permalink
Fixed default MSH not properly set.
Browse files Browse the repository at this point in the history
  • Loading branch information
depryf committed Nov 4, 2024
1 parent e21fa35 commit 06d286b
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Synthetic data generator

**Changes in version 1.34**

- Fixed default values not properly set in MSH segment of HL7 generator.

**Changes in version 1.33**

- Updated Layout library from version 5.5 to version 5.7.
Expand Down
20 changes: 10 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id 'java-library'
id 'checkstyle'
id 'jacoco'
id 'com.github.spotbugs' version '6.0.20'
id 'com.github.spotbugs' version '6.0.26'
id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '2.0.0' // publish to Maven Central
Expand All @@ -28,14 +28,14 @@ dependencies {
api 'com.imsweb:naaccr-xml:11.1'

implementation 'com.imsweb:seerutils:5.6'
implementation 'org.apache.commons:commons-lang3:3.16.0'
implementation 'commons-io:commons-io:2.16.1'

testImplementation 'com.imsweb:validation:3.2'
testImplementation 'com.imsweb:staging-client-java:11.3.0'
testImplementation 'com.imsweb:staging-client-java-cs:11.3.0'
testImplementation 'com.imsweb:staging-client-java-eod-public:11.3.0'
testImplementation 'com.imsweb:staging-client-java-tnm:11.3.0'
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'commons-io:commons-io:2.17.0'

testImplementation 'com.imsweb:validation:3.3'
testImplementation 'com.imsweb:staging-client-java:11.3.1'
testImplementation 'com.imsweb:staging-client-java-cs:11.3.1'
testImplementation 'com.imsweb:staging-client-java-eod-public:11.3.1'
testImplementation 'com.imsweb:staging-client-java-tnm:11.3.1'
testImplementation 'junit:junit:4.13.2'
}

Expand Down Expand Up @@ -210,6 +210,6 @@ nexusPublishing {

// Gradle wrapper, this allows to build the project without having to install Gradle...
wrapper {
gradleVersion = '8.9'
gradleVersion = '8.10.2'
distributionType = Wrapper.DistributionType.ALL
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public ControlSegmentRule() {
public void execute(Hl7Message message, NaaccrHl7DataGeneratorOptions options, Map<String, Object> context) {
new Hl7MessageBuilder(message).withSegment("MSH")

// MSH-1: Field Separator
.withField(1, "|")

// MSH2: Encoding Character
.withField(2, "^~\\&")

// MSH-3: sending application
.withField(3, "IMS Data Generator")

Expand All @@ -40,10 +46,14 @@ public void execute(Hl7Message message, NaaccrHl7DataGeneratorOptions options, M
// MSH-11: processing ID
.withField(11, "P")

// MSH-12: version ID -> set by the layout library
// MSH-12: version ID
.withField(12, "2.5.1")

// MSH-17: country code
.withField(17, "US");
.withField(17, "US")

// MSH-21: Message Profile Identifier
.withField(21, "VOL_V_50_ORU_R01", "NAACCR_CP");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void testGenerator() throws IOException {
// test with no options
generator.generateFile(file, 1);
Hl7Message msg = layout.readAllMessages(file).get(0);
Assert.assertNotNull(msg.getSegment("MSH").getField(12).getValue());
Assert.assertNotNull(msg.getSegment("PID").getField(5).getValue());
Assert.assertNull(msg.getSegment("PID").getField(11).getValue());

Expand Down Expand Up @@ -65,7 +66,7 @@ public void testGeneratorExtension() {
Assert.assertEquals("Test", generator.generateMessage().getSegment("PID").getField(5).getComponent(1).getValue());
}

private class MyHl7DataGenerator extends NaaccrHl7DataGenerator {
private static class MyHl7DataGenerator extends NaaccrHl7DataGenerator {

public MyHl7DataGenerator(String layoutId) {
super(layoutId);
Expand Down

0 comments on commit 06d286b

Please sign in to comment.