Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions engine.fhir/src/test/java/org/hl7/fhirpath/TestFhirPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@

import javax.xml.bind.JAXB;

import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.CqlTranslatorException;
import org.cqframework.cql.cql2elm.FhirLibrarySourceProvider;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.ModelManager;
import org.cqframework.cql.cql2elm.*;
import org.cqframework.cql.elm.execution.Library;
import org.cqframework.cql.elm.tracking.TrackBack;
import org.fhir.ucum.UcumEssenceService;
Expand Down Expand Up @@ -182,16 +178,16 @@ private LibraryLoader getLibraryLoader() {
}

private Library translate(String cql) throws UcumException {
ArrayList<CqlTranslator.Options> options = new ArrayList<>();
options.add(CqlTranslator.Options.EnableDateRangeOptimization);
ArrayList<CqlTranslatorOptions.Options> options = new ArrayList<>();
options.add(CqlTranslatorOptions.Options.EnableDateRangeOptimization);
UcumService ucumService = new UcumEssenceService(
UcumEssenceService.class.getResourceAsStream("/ucum-essence.xml"));

CqlTranslator translator = CqlTranslator.fromText(cql, getModelManager(), getLibraryManager(), ucumService,
options.toArray(new CqlTranslator.Options[options.size()]));
options.toArray(new CqlTranslatorOptions.Options[options.size()]));
if (translator.getErrors().size() > 0) {
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : translator.getErrors()) {
for (CqlCompilerException error : translator.getErrors()) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]"
: String.format("[%d:%d, %d:%d]", tb.getStartLine(), tb.getStartChar(), tb.getEndLine(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;

import org.cqframework.cql.cql2elm.CqlTranslatorException;
import org.cqframework.cql.cql2elm.CqlCompilerException;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.model.serialization.LibraryWrapper;
Expand Down Expand Up @@ -59,13 +59,13 @@ private Library resolveLibrary(VersionedIdentifier libraryIdentifier) {
}

private Library loadLibrary(VersionedIdentifier libraryIdentifier) {
List<CqlTranslatorException> errors = new ArrayList<>();
List<CqlCompilerException> errors = new ArrayList<>();
org.hl7.elm.r1.VersionedIdentifier identifier = new org.hl7.elm.r1.VersionedIdentifier()
.withId(libraryIdentifier.getId())
.withSystem(libraryIdentifier.getSystem())
.withVersion(libraryIdentifier.getVersion());

org.cqframework.cql.cql2elm.model.TranslatedLibrary translatedLibrary = libraryManager.resolveLibrary(identifier, CqlTranslatorOptions.defaultOptions(), errors);
org.cqframework.cql.cql2elm.model.CompiledLibrary translatedLibrary = libraryManager.resolveLibrary(identifier, CqlTranslatorOptions.defaultOptions(), errors);

LibraryWrapper wrapper = new LibraryWrapper();
wrapper.setLibrary(translatedLibrary.getLibrary());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import javax.xml.bind.JAXBException;

import org.cqframework.cql.cql2elm.*;
import org.cqframework.cql.cql2elm.model.TranslatedLibrary;
import org.cqframework.cql.cql2elm.model.CompiledLibrary;
import org.cqframework.cql.elm.execution.Library;
import org.cqframework.cql.elm.tracking.TrackBack;
import org.fhir.ucum.UcumEssenceService;
Expand Down Expand Up @@ -84,15 +84,15 @@ public void beforeEachTestMethod() throws JAXBException, IOException, UcumExcept
try {
File cqlFile = new File(URLDecoder.decode(this.getClass().getResource("fhir/" + fileName + ".cql").getFile(), "UTF-8"));

ArrayList<CqlTranslator.Options> options = new ArrayList<>();
options.add(CqlTranslator.Options.EnableDateRangeOptimization);
ArrayList<CqlTranslatorOptions.Options> options = new ArrayList<>();
options.add(CqlTranslatorOptions.Options.EnableDateRangeOptimization);

CqlTranslator translator = CqlTranslator.fromFile(cqlFile, modelManager, libraryManager, ucumService, options.toArray(new CqlTranslator.Options[options.size()]));
CqlTranslator translator = CqlTranslator.fromFile(cqlFile, modelManager, libraryManager, ucumService, options.toArray(new CqlTranslatorOptions.Options[options.size()]));

if (translator.getErrors().size() > 0) {
System.err.println("Translation failed due to errors:");
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : translator.getErrors()) {
for (CqlCompilerException error : translator.getErrors()) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format("[%d:%d, %d:%d]",
tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar());
Expand All @@ -104,7 +104,7 @@ public void beforeEachTestMethod() throws JAXBException, IOException, UcumExcept

assertThat(translator.getErrors().size(), is(0));

for (Map.Entry<String, TranslatedLibrary> entry : libraryManager.getTranslatedLibraries().entrySet()) {
for (Map.Entry<String, CompiledLibrary> entry : libraryManager.getCompiledLibraries().entrySet()) {
String jsonContent = CqlTranslator.convertToJxson(entry.getValue().getLibrary());
StringReader sr = new StringReader(jsonContent);
libraries.put(entry.getKey(), JsonCqlLibraryReader.read(sr));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import java.util.List;
import java.util.Map;

import org.cqframework.cql.cql2elm.CqlTranslatorException;
import org.cqframework.cql.cql2elm.CqlCompilerException;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.model.TranslatedLibrary;
import org.cqframework.cql.cql2elm.model.CompiledLibrary;
import org.cqframework.cql.elm.execution.Library;
import org.testng.annotations.Test;

Expand Down Expand Up @@ -123,10 +123,10 @@ public void test_twoLibraries_expressionsForEach() throws IOException {


LibraryManager libraryManager = this.toLibraryManager(libraries);
List<CqlTranslatorException> errors = new ArrayList<>();
List<CqlCompilerException> errors = new ArrayList<>();
List<Library> executableLibraries = new ArrayList<>();
for (org.hl7.elm.r1.VersionedIdentifier id : libraries.keySet()) {
TranslatedLibrary translated = libraryManager.resolveLibrary(id, CqlTranslatorOptions.defaultOptions(), errors);
CompiledLibrary translated = libraryManager.resolveLibrary(id, CqlTranslatorOptions.defaultOptions(), errors);
String json = this.convertToJson(translated.getLibrary());
executableLibraries.add(this.readJson(json));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
import java.util.HashMap;
import java.util.Map;

import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.CqlTranslatorException;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.ModelManager;
import org.cqframework.cql.cql2elm.*;
import org.cqframework.cql.elm.execution.Library;
import org.cqframework.cql.elm.tracking.TrackBack;
import org.fhir.ucum.UcumEssenceService;
Expand Down Expand Up @@ -56,18 +53,18 @@ public void beforeEachTestMethod() throws IOException, UcumException {
try {
File cqlFile = new File(URLDecoder.decode(this.getClass().getResource(fileName + ".cql").getFile(), "UTF-8"));

ArrayList<CqlTranslator.Options> options = new ArrayList<>();
options.add(CqlTranslator.Options.EnableDateRangeOptimization);
options.add(CqlTranslator.Options.EnableAnnotations);
options.add(CqlTranslator.Options.EnableLocators);
ArrayList<CqlTranslatorOptions.Options> options = new ArrayList<>();
options.add(CqlTranslatorOptions.Options.EnableDateRangeOptimization);
options.add(CqlTranslatorOptions.Options.EnableAnnotations);
options.add(CqlTranslatorOptions.Options.EnableLocators);

CqlTranslator translator = CqlTranslator.fromFile(cqlFile, getModelManager(), getLibraryManager(), ucumService,
options.toArray(new CqlTranslator.Options[options.size()]));
options.toArray(new CqlTranslatorOptions.Options[options.size()]));

if (translator.getErrors().size() > 0) {
System.err.println("Translation failed due to errors:");
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : translator.getErrors()) {
for (CqlCompilerException error : translator.getErrors()) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format("[%d:%d, %d:%d]",
tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.Collections;

import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.CqlTranslatorException;
import org.cqframework.cql.cql2elm.CqlCompilerException;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.ModelManager;
import org.cqframework.cql.elm.execution.Library;
Expand Down Expand Up @@ -81,7 +81,7 @@ private Library translate(String file) throws UcumException, IOException {
if (translator.getErrors().size() > 0) {
System.err.println("Translation failed due to errors:");
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : translator.getErrors()) {
for (CqlCompilerException error : translator.getErrors()) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format("[%d:%d, %d:%d]",
tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import java.util.TimeZone;

import org.cqframework.cql.cql2elm.CqlTranslator;
import org.cqframework.cql.cql2elm.CqlTranslatorException;
import org.cqframework.cql.cql2elm.CqlCompilerException;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.ModelManager;
import org.cqframework.cql.elm.execution.ExpressionDef;
Expand Down Expand Up @@ -391,7 +391,7 @@ private Library translate(String file) throws UcumException, IOException {
if (translator.getErrors().size() > 0) {
System.err.println("Translation failed due to errors:");
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : translator.getErrors()) {
for (CqlCompilerException error : translator.getErrors()) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format("[%d:%d, %d:%d]",
tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;

import org.cqframework.cql.cql2elm.CqlTranslatorException;
import org.cqframework.cql.cql2elm.CqlCompilerException;
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
import org.cqframework.cql.cql2elm.LibraryManager;
import org.cqframework.cql.cql2elm.model.serialization.LibraryWrapper;
Expand Down Expand Up @@ -57,13 +57,13 @@ private Library resolveLibrary(VersionedIdentifier libraryIdentifier) {
}

private Library loadLibrary(VersionedIdentifier libraryIdentifier) {
List<CqlTranslatorException> errors = new ArrayList<>();
List<CqlCompilerException> errors = new ArrayList<>();
org.hl7.elm.r1.VersionedIdentifier identifier = new org.hl7.elm.r1.VersionedIdentifier()
.withId(libraryIdentifier.getId())
.withSystem(libraryIdentifier.getSystem())
.withVersion(libraryIdentifier.getVersion());

org.cqframework.cql.cql2elm.model.TranslatedLibrary translatedLibrary = libraryManager.resolveLibrary(identifier, CqlTranslatorOptions.defaultOptions(), errors);
org.cqframework.cql.cql2elm.model.CompiledLibrary translatedLibrary = libraryManager.resolveLibrary(identifier, CqlTranslatorOptions.defaultOptions(), errors);

LibraryWrapper wrapper = new LibraryWrapper();
wrapper.setLibrary(translatedLibrary.getLibrary());
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<jackson.version>2.13.2</jackson.version>
<jackson-databind.version>2.13.2.1</jackson-databind.version>
<cqframework.version>1.5.8</cqframework.version>
<cqframework.version>2.0.0-SNAPSHOT</cqframework.version>
<hapi.version>5.6.3</hapi.version>
<slf4j.version>1.7.29</slf4j.version>
</properties>
Expand Down