From 2f1635b98ad3231f7e4eac70ac33f1feb16efd43 Mon Sep 17 00:00:00 2001 From: Christopher Hubert Date: Fri, 19 Jul 2024 14:43:04 -0400 Subject: [PATCH] MAT-7300: Set signature level to overloads --- .../cql_translator/TranslationResource.java | 3 ++- .../service/EffectiveDataRequirementService.java | 2 ++ .../utils/cql/parsing/Cql2ElmListener.java | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/gov/cms/mat/cql_elm_translation/cql_translator/TranslationResource.java b/src/main/java/gov/cms/mat/cql_elm_translation/cql_translator/TranslationResource.java index 1db827ae..a02faca4 100644 --- a/src/main/java/gov/cms/mat/cql_elm_translation/cql_translator/TranslationResource.java +++ b/src/main/java/gov/cms/mat/cql_elm_translation/cql_translator/TranslationResource.java @@ -114,7 +114,7 @@ public CqlTranslator buildTranslator( VersionedIdentifier sourceInfo) { try { UcumService ucumService = null; - LibraryBuilder.SignatureLevel signatureLevel = LibraryBuilder.SignatureLevel.None; + LibraryBuilder.SignatureLevel signatureLevel = LibraryBuilder.SignatureLevel.Overloads; List optionsList = new ArrayList<>(); for (String key : params.keySet()) { @@ -147,6 +147,7 @@ public CqlTranslator buildTranslator( NamespaceInfo nsInfo = null; libraryManager.setUcumService(ucumService); + libraryManager.getCqlCompilerOptions().setSignatureLevel(signatureLevel); libraryManager.getCqlCompilerOptions().setOptions(options); CqlTranslator translator = CqlTranslator.fromStream(nsInfo, sourceInfo, cqlStream, libraryManager); diff --git a/src/main/java/gov/cms/mat/cql_elm_translation/service/EffectiveDataRequirementService.java b/src/main/java/gov/cms/mat/cql_elm_translation/service/EffectiveDataRequirementService.java index 47d4c57f..cbb77058 100644 --- a/src/main/java/gov/cms/mat/cql_elm_translation/service/EffectiveDataRequirementService.java +++ b/src/main/java/gov/cms/mat/cql_elm_translation/service/EffectiveDataRequirementService.java @@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; import org.cqframework.cql.cql2elm.CqlCompilerOptions; import org.cqframework.cql.cql2elm.CqlTranslator; +import org.cqframework.cql.cql2elm.LibraryBuilder; import org.cqframework.cql.cql2elm.LibraryManager; import org.cqframework.cql.cql2elm.model.CompiledLibrary; import org.cqframework.cql.elm.requirements.fhir.DataRequirementsProcessor; @@ -60,6 +61,7 @@ public org.hl7.fhir.r5.model.Library getEffectiveDataRequirements( var dqReqTrans = new DataRequirementsProcessor(); CqlCompilerOptions options = CqlCompilerOptions.defaultOptions(); options.setCollapseDataRequirements(true); // removing duplicate data requirements + options.setSignatureLevel(LibraryBuilder.SignatureLevel.Overloads); org.hl7.fhir.r5.model.Library effectiveDataRequirements = dqReqTrans.gatherDataRequirements( diff --git a/src/main/java/gov/cms/mat/cql_elm_translation/utils/cql/parsing/Cql2ElmListener.java b/src/main/java/gov/cms/mat/cql_elm_translation/utils/cql/parsing/Cql2ElmListener.java index 1d15ced9..d333d611 100644 --- a/src/main/java/gov/cms/mat/cql_elm_translation/utils/cql/parsing/Cql2ElmListener.java +++ b/src/main/java/gov/cms/mat/cql_elm_translation/utils/cql/parsing/Cql2ElmListener.java @@ -27,6 +27,7 @@ import org.antlr.v4.runtime.tree.ParseTree; import org.antlr.v4.runtime.tree.ParseTreeWalker; import org.apache.commons.collections4.CollectionUtils; +import org.cqframework.cql.cql2elm.CqlCompilerOptions; import org.cqframework.cql.cql2elm.LibraryBuilder; import org.cqframework.cql.cql2elm.model.CompiledLibrary; import org.cqframework.cql.cql2elm.preprocessor.CqlPreprocessorVisitor; @@ -651,8 +652,10 @@ private void parseChildLibraries(IncludeDef def) throws IOException { // Add CqlCompilerOptions from LibraryManager to prevent NPE while walking through CQL LibraryBuilder libraryBuilder = new LibraryBuilder(translationResource.getLibraryManager()); + CqlCompilerOptions options = translationResource.getLibraryManager().getCqlCompilerOptions(); + options.setSignatureLevel(LibraryBuilder.SignatureLevel.Overloads); libraryBuilder.setCompilerOptions( - translationResource.getLibraryManager().getCqlCompilerOptions()); + options); CqlPreprocessorVisitor preprocessor = new CqlPreprocessorVisitor(libraryBuilder, tokens); preprocessor.visit(tree); ParseTreeWalker walker = new ParseTreeWalker();