diff --git a/src/main/java/io/github/linuxforhealth/core/Constants.java b/src/main/java/io/github/linuxforhealth/core/Constants.java index 9ed13da9..bc4fb544 100644 --- a/src/main/java/io/github/linuxforhealth/core/Constants.java +++ b/src/main/java/io/github/linuxforhealth/core/Constants.java @@ -26,6 +26,7 @@ public class Constants { public static final String HL7_BASE_PATH = "hl7/"; public static final String FHIR_BASE_PATH = "fhir/"; public static final String MESSAGE_BASE_PATH = "message/"; + public static final String NULL_VAR_NAME = "NULL"; private Constants() { } diff --git a/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataTypeMapper.java b/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataTypeMapper.java index afc3efa8..32d55a06 100644 --- a/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataTypeMapper.java +++ b/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataTypeMapper.java @@ -36,6 +36,7 @@ public enum SimpleDataTypeMapper { CODING_SYSTEM_V2_ALTERNATE(SimpleDataValueResolver.CODING_SYSTEM_V2_ALTERNATE), CODING_SYSTEM_V2_IDENTIFIER(SimpleDataValueResolver.CODING_SYSTEM_V2_IDENTIFIER), CODING_SYSTEM_V2_IS_USER_DEFINED_TABLE(SimpleDataValueResolver.CODING_SYSTEM_V2_IS_USER_DEFINED_TABLE), + NO_DISPLAY(SimpleDataValueResolver.NO_DISPLAY), SYSTEM_URL(SimpleDataValueResolver.SYSTEM_URL), SYSTEM_ID(SimpleDataValueResolver.SYSTEM_ID), PV1_DURATION_LENGTH(SimpleDataValueResolver.PV1_DURATION_LENGTH), diff --git a/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataValueResolver.java b/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataValueResolver.java index 81559cc5..0513cdcc 100644 --- a/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataValueResolver.java +++ b/src/main/java/io/github/linuxforhealth/hl7/data/SimpleDataValueResolver.java @@ -556,6 +556,10 @@ private static final SimpleCode commonCodingSystemV2 (String table, String code, } } + public static final ValueExtractor NO_DISPLAY = (Object value) -> { + if (value == "no display") { return null; }; + return null; + }; public static final ValueExtractor BUILD_IDENTIFIER_FROM_CWE = (Object value) -> { CWE newValue = ((CWE) value); String identifier = newValue.getCwe1_Identifier().toString(); diff --git a/src/main/java/io/github/linuxforhealth/hl7/util/ExpressionUtility.java b/src/main/java/io/github/linuxforhealth/hl7/util/ExpressionUtility.java index 193d05fd..303cf49b 100644 --- a/src/main/java/io/github/linuxforhealth/hl7/util/ExpressionUtility.java +++ b/src/main/java/io/github/linuxforhealth/hl7/util/ExpressionUtility.java @@ -11,16 +11,15 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Objects; - import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import io.github.linuxforhealth.api.EvaluationResult; import io.github.linuxforhealth.api.Expression; import io.github.linuxforhealth.api.InputDataExtractor; import io.github.linuxforhealth.api.ResourceValue; +import io.github.linuxforhealth.core.Constants; import io.github.linuxforhealth.core.ObjectMapperUtil; import io.github.linuxforhealth.core.exception.DataExtractionException; import io.github.linuxforhealth.core.exception.RequiredConstraintFailureException; @@ -57,6 +56,7 @@ public static ResourceEvaluationResult evaluate(InputDataExtractor dataSource, try { Map expressionsToEvaluateLater = new HashMap<>(); Map localContext = new HashMap<>(context); + localContext.put(Constants.NULL_VAR_NAME, new EmptyEvaluationResult()); // initialize the map and list to collect values List additionalResolveValues = new ArrayList<>(); Map resolveValues = new HashMap<>(); diff --git a/src/main/resources/hl7/extension/ExtensionMeta.yml b/src/main/resources/hl7/extension/ExtensionMeta.yml index 33002b1f..f60c9e37 100644 --- a/src/main/resources/hl7/extension/ExtensionMeta.yml +++ b/src/main/resources/hl7/extension/ExtensionMeta.yml @@ -51,8 +51,10 @@ extension_5: vars: system: SYSTEM_URL, $system_code code: String, MSH.9.1 + display: $NULL constants: system_code: 'source-record-type-system' + extension_6: generateList: true @@ -67,5 +69,7 @@ extension_6: vars: system: SYSTEM_URL, $system_code code: String, MSH.9.2 + display: $NULL constants: - system_code: 'source-event-trigger-system' \ No newline at end of file + system_code: 'source-event-trigger-system' + \ No newline at end of file