Skip to content

Commit

Permalink
Merge branch 'master' into refresh-messaging-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JPercival authored Jan 26, 2024
2 parents cb6ef87 + 28963bb commit 53ec57a
Show file tree
Hide file tree
Showing 32 changed files with 795 additions and 738 deletions.
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
"ASLP",
"Careand",
"conceptmap",
"Cqfm",
"cqloptions",
"DEPENDSON",
"Dstu",
"Fhir",
"opencds",
"pagecontent",
"plandefinition",
"qicore",
"stripcontent",
"testng"
]
],
"java.compile.nullAnalysis.mode": "automatic",
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx2G -Xms100m -Xlog:disable"
}
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

<groupId>org.opencds.cqf</groupId>
<artifactId>tooling-parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>

<packaging>pom</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<cql.version>3.5.1</cql.version>
<hapi.version>6.10.0</hapi.version>
<cql.version>3.6.0</cql.version>
<hapi.version>6.10.2</hapi.version>
<core.version>6.1.2.2</core.version>
<spring-boot.version>2.1.5.RELEASE</spring-boot.version>
<slf4j.version>2.0.5</slf4j.version>
Expand Down
2 changes: 1 addition & 1 deletion scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ fi
# Import maven settings
cp .travis.settings.xml $HOME/.m2/settings.xml

CMD="mvn deploy -DskipTests=true -Dmaven.test.skip=true -B"
CMD="./mvnw deploy -DskipTests=true -Dmaven.test.skip=true -B"

# Import signing key and publish a release on a tag
if [[ ! -z "$TRAVIS_TAG" ]]
Expand Down
2 changes: 1 addition & 1 deletion scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
set -euxo pipefail
bash -n "$0"

mvn install -U -DskipTests=true -Dmaven.javadoc.skip=true -B -V
./mvnw install -U -DskipTests=true -Dmaven.javadoc.skip=true -B -V
2 changes: 1 addition & 1 deletion scripts/maintenance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
set -euxo pipefail
bash -n "$0"

mvn versions:update-properties versions:use-releases versions:use-latest-releases -Dexcludes=com.github.ben-manes.caffeine:caffeine:jar:\*,org.slf4j:\*,org.glassfish.jaxb:\*,com.sun.istack:\*,com.sun.xml.fastinfoset:\*,net.sf.jopt-simple:\*,ch.qos.logback:\*
./mvnw versions:update-properties versions:use-releases versions:use-latest-releases -Dexcludes=com.github.ben-manes.caffeine:caffeine:jar:\*,org.slf4j:\*,org.glassfish.jaxb:\*,com.sun.istack:\*,com.sun.xml.fastinfoset:\*,net.sf.jopt-simple:\*,ch.qos.logback:\*
2 changes: 1 addition & 1 deletion scripts/setversion.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh

# usage ./scripts/setversion.sh N.N.N (or N.N.N-SNAPSHOT)
mvn versions:set -DnewVersion=$1
./mvnw versions:set -DnewVersion=$1
6 changes: 3 additions & 3 deletions tooling-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>org.opencds.cqf</groupId>
<artifactId>tooling-parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</parent>

<artifactId>tooling-cli</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<description>CQF Tooling CLI</description>
Expand All @@ -27,7 +27,7 @@
<dependency>
<groupId>org.opencds.cqf</groupId>
<artifactId>tooling</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down
6 changes: 3 additions & 3 deletions tooling-ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>org.opencds.cqf</groupId>
<artifactId>tooling-parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</parent>

<artifactId>tooling-ui</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<description>CQF Tooling UI</description>
Expand All @@ -19,7 +19,7 @@
<dependency>
<groupId>org.opencds.cqf</groupId>
<artifactId>tooling</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
Expand Down
4 changes: 2 additions & 2 deletions tooling/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>org.opencds.cqf</groupId>
<artifactId>tooling-parent</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
</parent>

<artifactId>tooling</artifactId>
<version>3.1.0-SNAPSHOT</version>
<version>3.2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class Api {

private Api() {}

public static final String RXMIX_WORKFLOW_URL = "https://mor.nlm.nih.gov/RxMix/executeConfig.do";
public static final String RXMIX_WORKFLOW_URL = "https://rxmix-legacy.nlm.nih.gov/RxMix/executeConfig.do";
public static final String LOINC_HIERARCHY_QUERY_URL = "https://loinc.regenstrief.org/searchapi/hierarchy/component-system/search?searchString=";
public static final String LOINC_FHIR_SERVER_URL = "https://fhir.loinc.org";
public static final String FHIR_LOOKUP_OPERATION_NAME = "$lookup";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
import java.util.Stack;

import org.apache.commons.lang3.tuple.Pair;
import org.cqframework.cql.cql2elm.CqlCompilerOptions;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
import org.cqframework.cql.cql2elm.LibraryBuilder;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.ModelManager;
import org.cqframework.cql.elm.IdObjectFactory;
import org.fhir.ucum.UcumEssenceService;
import org.fhir.ucum.UcumException;
import org.fhir.ucum.UcumService;
Expand Down Expand Up @@ -60,8 +59,7 @@ public void newLibraryBuilder(Pair<VersionedIdentifier, ContextDef> libraryInfo)
UcumService ucumService = new UcumEssenceService(
UcumEssenceService.class.getResourceAsStream("/ucum-essence.xml"));
libraryManager.setUcumService(ucumService);
this.libraryBuilder = new LibraryBuilder(libraryManager);
this.libraryBuilder.setCompilerOptions(CqlCompilerOptions.defaultOptions());
this.libraryBuilder = new LibraryBuilder(libraryManager, new IdObjectFactory());
this.libraryBuilder.setLibraryIdentifier(libraryInfo.getLeft());
this.libraryBuilder.getModel(new UsingDef().withUri(modelBuilder.getModelUri())
.withLocalIdentifier(modelBuilder.getModelIdentifier()).withVersion(modelBuilder.getModelVersion()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.Stack;
import java.util.stream.Collectors;

import org.cqframework.cql.elm.visiting.ElmBaseLibraryVisitor;
import org.cqframework.cql.elm.visiting.BaseElmLibraryVisitor;
import org.hl7.elm.r1.*;
import org.hl7.elm.r1.Library.Statements;
import org.opencds.cqf.tooling.cql_generation.context.ElmContext;
Expand All @@ -19,7 +19,7 @@
* @author Joshua Reynolds
* @since 2021-04-05
*/
public class ElmToCqlVisitor extends ElmBaseLibraryVisitor<Void, ElmContext> {
public class ElmToCqlVisitor extends BaseElmLibraryVisitor<Void, ElmContext> {
private static final Logger logger = LoggerFactory.getLogger(ElmToCqlVisitor.class);
private boolean useSpaces = true;

Expand Down Expand Up @@ -864,7 +864,7 @@ public Void visitQuery(Query query, ElmContext context) {
query.getRelationship().stream().forEach(relationship -> visitRelationshipClause(relationship, context));
}
if (query.getWhere() != null) {
visitWhereClause(query.getWhere(), context);
visitExpression(query.getWhere(), context);
}
if (query.getReturn() != null) {
visitReturnClause(query.getReturn(), context);
Expand Down Expand Up @@ -961,27 +961,6 @@ public Void visitLetClause(LetClause let, ElmContext context) {
return null;
}

/**
* Visit WhereClause. This method will be called for
* WhereClause expression nodes.
*
* @param where the Expression
* @param context the context passed to the visitor
* @return the visitor result
*/
@Override
public Void visitWhereClause(Expression where, ElmContext context) {
try {
enterClause();
output.append("where");
visitElement(where, context);
return null;
}
finally {
exitClause();
}
}

/**
* Visit ReturnClause. This method will be called for
* every node in the tree that is a ReturnClause.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.regex.Pattern;
Expand All @@ -14,6 +16,7 @@
import org.cqframework.cql.cql2elm.CqlCompilerOptions;
import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions.Format;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r5.model.Attachment;
import org.hl7.fhir.r5.model.CodeableConcept;
Expand Down Expand Up @@ -198,14 +201,17 @@ protected Library refreshGeneratedContent(Library sourceLibrary) {
sourceLibrary.getContent().clear();
sourceLibrary.getContent().add(attachment);
setLibraryType(sourceLibrary);

var translatorOptions = getCqlProcessor().getCqlTranslatorOptions();
var formats = translatorOptions.getFormats();
CqlProcessor.CqlSourceFileInformation info = getCqlProcessor().getFileInformation(attachment.getUrl());
attachment.setUrlElement(null);
if (info != null) {
//f.getErrors().addAll(info.getErrors());
if (info.getElm() != null) {
if (info.getElm() != null && emptyIfNull(formats).contains(Format.XML)) {
sourceLibrary.addContent().setContentType("application/elm+xml").setData(info.getElm());
}
if (info.getJsonElm() != null) {
if (info.getJsonElm() != null && emptyIfNull(formats).contains(Format.JSON)) {
sourceLibrary.addContent().setContentType("application/elm+json").setData(info.getJsonElm());
}
sourceLibrary.getDataRequirement().clear();
Expand All @@ -215,7 +221,7 @@ protected Library refreshGeneratedContent(Library sourceLibrary) {
sourceLibrary.getParameter().clear();
sourceLibrary.getParameter().addAll(info.getParameters());
getCqlProcessor().getCqlTranslatorOptions();
setTranslatorOptions(sourceLibrary, getCqlProcessor().getCqlTranslatorOptions());
setTranslatorOptions(sourceLibrary, translatorOptions);
} else {
logMessage(String.format("No cql info found for %s", fileName));
//f.getErrors().add(new ValidationMessage(ValidationMessage.Source.Publisher, ValidationMessage.IssueType.NOTFOUND, "Library", "No cql info found for "+f.getName(), ValidationMessage.IssueSeverity.ERROR));
Expand All @@ -225,6 +231,10 @@ protected Library refreshGeneratedContent(Library sourceLibrary) {
return sourceLibrary;
}

private <T> Set<T> emptyIfNull(Set<T> set) {
return set != null ? set : Collections.emptySet();
}

protected void setTranslatorOptions(Library sourceLibrary, CqlTranslatorOptions options) {
Extension optionsExtension = sourceLibrary.getExtensionByUrl("http://hl7.org/fhir/StructureDefinition/cqf-cqlOptions");
if (optionsExtension == null) {
Expand Down
Loading

0 comments on commit 53ec57a

Please sign in to comment.