Skip to content
This repository was archived by the owner on Dec 21, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
80fed50
Upgrading to CQ 2.0.0 library, Java 11 and HAPI 6
vitorpamplona Jun 20, 2022
d4be965
Updating Schema definitions to match CQ2.0.0
vitorpamplona Jun 20, 2022
ddf2d44
Merge remote-tracking branch 'origin/HEAD' into cq2.0.0-upgrade
vitorpamplona Jun 20, 2022
9a7241b
Rolling back tabs to spaces.
vitorpamplona Jun 20, 2022
3b201d4
Updating Java11 Deprecations
vitorpamplona Jun 21, 2022
0fd72ab
Fixing all JSONs generated by Jackson for the tests.
vitorpamplona Jun 21, 2022
c1a4446
Updating dependencies to the latest versions
vitorpamplona Jun 21, 2022
5fc7b6a
keeping test dependencies on test scopes
vitorpamplona Jun 21, 2022
38a4b37
Updating Maven profile to java11
vitorpamplona Jun 21, 2022
a651936
Ignoring new test output directory.
vitorpamplona Jun 21, 2022
c127172
Refactoring JAXB test cases using @Factory and @DataProvider to dynam…
vitorpamplona Jun 21, 2022
e37cf07
Merging new version
vitorpamplona Jun 21, 2022
dc409b4
Refactoring FHIR Tests.
vitorpamplona Jun 21, 2022
ee3ddaa
Adding logging on tests to facilitate the understanding of failing re…
vitorpamplona Jun 21, 2022
89dcef5
Restructuring compare results to serve R4 and DSTU3
vitorpamplona Jun 22, 2022
2245373
Reverting comparable to full types
vitorpamplona Jun 22, 2022
c97b1ae
Using R4's test structure for DSTU3
vitorpamplona Jun 22, 2022
e363928
Better formatting
vitorpamplona Jun 22, 2022
9d2c4c9
Reusing cached Contexts.
vitorpamplona Jun 22, 2022
abc0f52
Reducing memory use
vitorpamplona Jun 22, 2022
4ab5dc8
Marking down individual tests to skip on Engine.FHIR
vitorpamplona Jun 22, 2022
4a69d41
Adding a new test to skip.
vitorpamplona Jun 22, 2022
df54591
Fix unused imports
vitorpamplona Jun 22, 2022
564776c
Removing full package names from ObjectFactory.
vitorpamplona Jun 22, 2022
27b7476
Moving moxy to test only
vitorpamplona Jun 22, 2022
6e2fb7a
Removing that are already declared on the Engine or via Moxy.
vitorpamplona Jun 22, 2022
4752f3d
removing unnecessary dependencies at the engine level
vitorpamplona Jun 22, 2022
dae80d2
Adding Glassfish JAXB to the dependencies
vitorpamplona Jun 22, 2022
e61c542
no need for glassfish.
vitorpamplona Jun 22, 2022
d18252c
Fixing Path for SchemaLocation
vitorpamplona Jun 23, 2022
9c21f9a
Running performance Test with the appropriate Date of Evaluation to p…
vitorpamplona Jun 23, 2022
b53d52a
Refactoring MainSuite of CQL tests to dynamically create `@Test`, all…
vitorpamplona Jun 23, 2022
3ec6ea8
Fixing nomenclature of the tests
vitorpamplona Jun 23, 2022
fe3c138
Fixing Exists Tests
vitorpamplona Jun 23, 2022
93246de
Changing the Collapse operator to support multiple precision types.
vitorpamplona Jun 23, 2022
f3cd6d0
Removing unused imports.
vitorpamplona Jun 24, 2022
cbaaf71
Removing failing testCases to collapse intervals with null
vitorpamplona Jun 24, 2022
5309686
Commenting out test for the CQLErrorSuite until tests in this suite e…
vitorpamplona Jun 24, 2022
73030f6
Commenting the cql file out of the test not the entire class.
vitorpamplona Jun 24, 2022
17c806b
Merge remote-tracking branch 'origin/HEAD' into cq2.0.0-upgrade
vitorpamplona Jun 24, 2022
3442ce0
updating dependencies.
vitorpamplona Jun 27, 2022
98ffe15
Reverting change in test names on the r3. Adjusting test names to avo…
vitorpamplona Jun 27, 2022
c70f5a6
Remove the new lines created by the IDE
vitorpamplona Jun 27, 2022
e42892e
Reverting tests-fhir-r3
vitorpamplona Jun 27, 2022
81ce91e
Adding a new line
vitorpamplona Jun 27, 2022
4f72f67
Found the missing element that was producing inconsistent compilation…
vitorpamplona Jun 27, 2022
c730c90
Merge with 1.5.8
vitorpamplona Jun 27, 2022
c2abc87
Reverting XML changes to do it on upstream.
vitorpamplona Jun 27, 2022
5e475b7
Reverting CqlAggregateTest.xml
vitorpamplona Jun 27, 2022
31750d2
Moving all jackson dependencies to a module. Because we use Jackson t…
vitorpamplona Jun 28, 2022
a258863
Added service loader pattern for Jackson. Building a similar structur…
vitorpamplona Jun 28, 2022
aad2721
Adding a test case to verify Jackson XML - JSON equality.
vitorpamplona Jun 28, 2022
f2ac9a0
Added service loader pattern for Jaxb module. Tests now verify JSON a…
vitorpamplona Jun 28, 2022
62ab957
Tests were moved to engine.jackson, so coverage will fail
vitorpamplona Jun 28, 2022
e96e000
Removing trailing spaces.
vitorpamplona Jun 28, 2022
c143c3b
updating jaxb basics to match Translator's version
vitorpamplona Jul 3, 2022
5b08e31
Adjusting pom files for the separation of Jackson and Jaxb from Bryn.
vitorpamplona Jul 3, 2022
c03a1ae
Merge remote-tracking branch 'origin/cq2.0.0-upgrade' into jackson-mo…
vitorpamplona Jul 3, 2022
1bc7274
Merge remote-tracking branch 'origin/HEAD' into cq2.0.0-upgrade
vitorpamplona Jul 18, 2022
7d5e58d
Reverting version number change.
vitorpamplona Jul 18, 2022
a41a707
Adding new fhir-r4 module to test dependencies.
vitorpamplona Jul 18, 2022
e1337b1
Fixing the import of FhirLibrarySourceProvider
vitorpamplona Jul 18, 2022
539c0f1
Adding serialVersionUID to CqlException subclass
vitorpamplona Jul 18, 2022
2b45eb2
Changing the interfaces of the Model Resolver to protected.
vitorpamplona Jul 19, 2022
fd27941
Changing tests to subclasses of the ModelResolvers with cached contexts
vitorpamplona Jul 19, 2022
9918cb1
Enabling Quick on the Test environment for the Engine.FHIR
vitorpamplona Jul 20, 2022
a366eae
Merge remote-tracking branch 'origin/HEAD' into cq2.0.0-upgrade
vitorpamplona Aug 4, 2022
b33959e
Merge remote-tracking branch 'origin/HEAD' into cq2.0.0-upgrade
vitorpamplona Aug 8, 2022
a565472
Merge remote-tracking branch 'origin/HEAD' into jackson-module
vitorpamplona Aug 8, 2022
91d6aed
Merge remote-tracking branch 'origin/HEAD' into jackson-module
vitorpamplona Aug 8, 2022
ec5b268
Fixing imports
vitorpamplona Aug 8, 2022
39af611
Fixing imports
vitorpamplona Aug 8, 2022
94fa968
Fixing imports
vitorpamplona Aug 8, 2022
c724e8a
Fixing imports 3
vitorpamplona Aug 8, 2022
83b8eb5
Fixing imports 4
vitorpamplona Aug 8, 2022
3438bd8
Deleting log4j properties in the jackson module.
vitorpamplona Aug 9, 2022
f5a2fe4
Merge remote-tracking branch 'origin/HEAD' into jackson-module
vitorpamplona Aug 15, 2022
2fd444c
Fixing redundant File creation
vitorpamplona Aug 16, 2022
74cb3eb
No need for a class to define Mixins.
vitorpamplona Aug 16, 2022
a1eadd6
Using resource as stream instead of File
vitorpamplona Aug 16, 2022
2e19d94
Moves hapi-fhir-client to test scope.
vitorpamplona Aug 18, 2022
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
19 changes: 14 additions & 5 deletions engine.fhir/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>

<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
Expand Down Expand Up @@ -86,7 +82,13 @@
<artifactId>org.eclipse.persistence.moxy</artifactId>
<scope>test</scope>
</dependency>

<!-- Uses Jackson to load some libraries for testing -->
<dependency>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>engine.jackson</artifactId>
<version>2.0.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cqframework</groupId>
<artifactId>cql-to-elm</artifactId>
Expand All @@ -112,6 +114,13 @@
<artifactId>elm-jackson</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down
34 changes: 8 additions & 26 deletions engine.fhir/src/test/java/org/hl7/fhirpath/TestLibraryLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand All @@ -13,19 +14,9 @@
import org.cqframework.cql.cql2elm.model.CompiledLibrary;
import org.cqframework.cql.elm.execution.Library;
import org.cqframework.cql.elm.execution.VersionedIdentifier;
import org.hl7.cql_annotations.r1.CqlToElmBase;
import org.opencds.cqf.cql.engine.elm.serialization.CqlToElmBaseMixIn;
import org.opencds.cqf.cql.engine.execution.JsonCqlLibraryReader;
import org.cqframework.cql.elm.serializing.ElmLibraryWriterFactory;
import org.opencds.cqf.cql.engine.execution.LibraryLoader;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
import org.opencds.cqf.cql.engine.serializing.jackson.JsonCqlLibraryReader;

public class TestLibraryLoader implements LibraryLoader {

Expand Down Expand Up @@ -73,25 +64,16 @@ private Library loadLibrary(VersionedIdentifier libraryIdentifier) {
CompiledLibrary compiledLibrary = libraryManager.resolveLibrary(identifier, CqlTranslatorOptions.defaultOptions(), errors);
String json;
try {
ObjectMapper mapper = JsonMapper.builder()
.defaultMergeable(true)
.enable(SerializationFeature.WRAP_ROOT_VALUE)
.enable(SerializationFeature.INDENT_OUTPUT)
.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
.enable(MapperFeature.USE_BASE_TYPE_AS_DEFAULT_IMPL)
.defaultPropertyInclusion(JsonInclude.Value.construct(JsonInclude.Include.NON_NULL, JsonInclude.Include.NON_NULL))
.addModule(new JaxbAnnotationModule())
.addMixIn(CqlToElmBase.class, CqlToElmBaseMixIn.class)
.build();

json = mapper.writeValueAsString(compiledLibrary.getLibrary());
} catch (JsonProcessingException e) {
StringWriter writer = new StringWriter();
ElmLibraryWriterFactory.getWriter("application/elm+json").write(compiledLibrary.getLibrary(), writer);
json = writer.getBuffer().toString();
} catch (IOException e) {
throw new RuntimeException(String.format("Errors encountered while loading library %s: %s", libraryIdentifier.getId(), e.getMessage()));
}

Library library = null;
try {
library = JsonCqlLibraryReader.read(new StringReader(json));
library = new JsonCqlLibraryReader().read(new StringReader(json));
} catch (IOException e) {
throw new RuntimeException(String.format("Errors encountered while loading library %s: %s", libraryIdentifier.getId(), e.getMessage()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import org.fhir.ucum.UcumEssenceService;
import org.fhir.ucum.UcumException;
import org.fhir.ucum.UcumService;
import org.opencds.cqf.cql.engine.execution.JsonCqlLibraryReader;
import org.opencds.cqf.cql.engine.serializing.jackson.JsonCqlLibraryReader;
import org.opencds.cqf.cql.engine.execution.LibraryLoader;

import java.io.IOException;
Expand Down Expand Up @@ -60,7 +60,7 @@ public Library translate(String cql) throws UcumException {
String json = translator.toJson();

try {
return JsonCqlLibraryReader.read(new StringReader(json));
return new JsonCqlLibraryReader().read(new StringReader(json));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
import org.fhir.ucum.UcumException;
import org.fhir.ucum.UcumService;
import org.opencds.cqf.cql.engine.data.CompositeDataProvider;
import org.opencds.cqf.cql.engine.execution.JsonCqlLibraryReader;
import org.opencds.cqf.cql.engine.fhir.model.*;
import org.opencds.cqf.cql.engine.fhir.retrieve.RestFhirRetrieveProvider;
import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver;
import org.opencds.cqf.cql.engine.serializing.jackson.JsonCqlLibraryReader;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;

Expand Down Expand Up @@ -106,14 +106,14 @@ public void beforeEachTestMethod() throws JAXBException, IOException, UcumExcept
for (Map.Entry<String, CompiledLibrary> entry : libraryManager.getCompiledLibraries().entrySet()) {
String jsonContent = CqlTranslator.convertToJson(entry.getValue().getLibrary());
StringReader sr = new StringReader(jsonContent);
libraries.put(entry.getKey(), JsonCqlLibraryReader.read(sr));
libraries.put(entry.getKey(), new JsonCqlLibraryReader().read(sr));
if (entry.getKey().equals(fileName)) {
library = libraries.get(entry.getKey());
}
}

if (library == null) {
library = JsonCqlLibraryReader.read(new StringReader(translator.toJson()));
library = new JsonCqlLibraryReader().read(new StringReader(translator.toJson()));
libraries.put(fileName, library);
}
} catch (IOException e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.opencds.cqf.cql.engine.fhir.data;

import java.util.Map;

import org.cqframework.cql.elm.execution.Library;
import org.cqframework.cql.elm.execution.VersionedIdentifier;
import org.opencds.cqf.cql.engine.execution.LibraryLoader;

import java.util.Map;

public class TestLibraryLoader implements LibraryLoader {
private Map<String, Library> libraries;

Expand Down
118 changes: 118 additions & 0 deletions engine.jackson/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>engine.shared</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>

<artifactId>engine.jackson</artifactId>
<packaging>jar</packaging>

<name>engine.jackson</name>
<description>CQL Engine Jackson Readers</description>
<url>https://github.com/DBCG/cql_engine/tree/master/engine.jaxb</url>

<dependencies>
<dependency>
<groupId>org.opencds.cqf.cql</groupId>
<artifactId>engine</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>

<!-- Jackson dependencies -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>${jackson.version}</version>
</dependency>

<!-- This depedency adds to the javax.xml.namespace package which is not valid in Java 9+-->
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3_xpath</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>info.cqframework</groupId>
<artifactId>cql-to-elm</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cqframework</groupId>
<artifactId>model-jackson</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cqframework</groupId>
<artifactId>elm-jackson</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-check</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- generated code -->
<excludes>
<exclude>**/org/cqframework/**</exclude>
</excludes>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.40</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.opencds.cqf.cql.engine.serializing.jackson;

import org.opencds.cqf.cql.engine.serializing.CqlLibraryReader;

public class CqlLibraryReaderProvider implements org.opencds.cqf.cql.engine.serializing.CqlLibraryReaderProvider {
@Override
public CqlLibraryReader create(String contentType) {
if (contentType == null) {
contentType = "application/elm+json";
}

switch (contentType) {
case "application/elm+xml": return new XmlCqlLibraryReader();
case "application/elm+json":
default: return new JsonCqlLibraryReader();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.opencds.cqf.cql.engine.serializing.jackson;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.net.URI;
import java.net.URL;

import org.cqframework.cql.elm.execution.Library;
import org.opencds.cqf.cql.engine.serializing.CqlLibraryReader;

public class JsonCqlLibraryReader implements CqlLibraryReader {

public JsonCqlLibraryReader() {
}

public Library read(File file) throws IOException {
return JsonCqlMapper.getMapper().readValue(file, Library.class);
}

public Library read(URL url) throws IOException {
return JsonCqlMapper.getMapper().readValue(url, Library.class);
}

public Library read(URI uri) throws IOException {
return JsonCqlMapper.getMapper().readValue(uri.toURL(), Library.class);
}

public Library read(String string) throws IOException {
return JsonCqlMapper.getMapper().readValue(string, Library.class);
}

public Library read(InputStream inputStream) throws IOException {
return JsonCqlMapper.getMapper().readValue(inputStream, Library.class);
}

public Library read(Reader reader) throws IOException {
return JsonCqlMapper.getMapper().readValue(reader, Library.class);
}
}
Loading