Skip to content

Commit

Permalink
MAT-7300: Set signature level to overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
chubert-sb committed Jul 19, 2024
1 parent 2039787 commit 2f1635b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<CqlCompilerOptions.Options> optionsList = new ArrayList<>();

for (String key : params.keySet()) {
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2f1635b

Please sign in to comment.