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
61 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
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
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
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ core.*
heapdump.*
javacore.*
Snap.*
**/test-output
53 changes: 51 additions & 2 deletions engine.fhir/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<version>1.5.10-SNAPSHOT</version>
</parent>

<groupId>org.opencds.cqf.cql</groupId>
<artifactId>engine.fhir</artifactId>
<version>1.5.10-SNAPSHOT</version>
<packaging>jar</packaging>
Expand All @@ -24,6 +23,24 @@
<artifactId>engine</artifactId>
<version>1.5.10-SNAPSHOT</version>
</dependency>

<!-- StringUtils, ExceptionUtils and Pair classes. -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
</dependency>

<!-- Support for generated methods for toString(), equals() and hashCode() using jakarta-commons-lang -->
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-runtime</artifactId>
</dependency>

<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
</dependency>

<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
Expand All @@ -48,6 +65,7 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
</dependency>

<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3</artifactId>
Expand All @@ -63,6 +81,37 @@
<artifactId>wiremock-jre8</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</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>fhir-r4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cqframework</groupId>
<artifactId>quick</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>
Expand Down Expand Up @@ -103,7 +152,7 @@
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.12.0</version>
<version>0.13.1</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public Dstu2FhirModelResolver() {
this(FhirContext.forDstu2());
}

private Dstu2FhirModelResolver(FhirContext fhirContext) {
protected Dstu2FhirModelResolver(FhirContext fhirContext) {
super(fhirContext);
this.setPackageNames(Arrays.asList("ca.uhn.fhir.model.dstu2", "org.hl7.fhir.dstu2.model", "ca.uhn.fhir.model.primitive"));
if (fhirContext.getVersion().getVersion() != FhirVersionEnum.DSTU2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Dstu3FhirModelResolver() {
this(FhirContext.forDstu3());
}

private Dstu3FhirModelResolver(FhirContext fhirContext) {
protected Dstu3FhirModelResolver(FhirContext fhirContext) {
super(fhirContext);
this.setPackageNames(Arrays.asList("org.hl7.fhir.dstu3.model"));
if (fhirContext.getVersion().getVersion() != FhirVersionEnum.DSTU3) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public R4FhirModelResolver() {
this(FhirContext.forR4());
}

private R4FhirModelResolver(FhirContext fhirContext) {
protected R4FhirModelResolver(FhirContext fhirContext) {
super(fhirContext);
this.setPackageNames(Arrays.asList("org.hl7.fhir.r4.model"));
if (fhirContext.getVersion().getVersion() != FhirVersionEnum.R4) {
Expand Down
215 changes: 215 additions & 0 deletions engine.fhir/src/test/java/org/hl7/fhirpath/CQLOperationsDstu3Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
package org.hl7.fhirpath;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import com.google.common.collect.Sets;
import org.fhir.ucum.UcumException;
import org.hl7.fhir.dstu3.model.*;
import org.hl7.fhirpath.tests.Group;
import org.opencds.cqf.cql.engine.data.CompositeDataProvider;
import org.opencds.cqf.cql.engine.elm.execution.EqualEvaluator;
import org.opencds.cqf.cql.engine.execution.Context;
import org.opencds.cqf.cql.engine.fhir.model.CachedDstu3FhirModelResolver;
import org.opencds.cqf.cql.engine.fhir.model.Dstu3FhirModelResolver;
import org.opencds.cqf.cql.engine.fhir.model.FhirModelResolver;
import org.opencds.cqf.cql.engine.fhir.retrieve.RestFhirRetrieveProvider;
import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver;
import org.opencds.cqf.cql.engine.runtime.Code;
import org.testng.ITest;
import org.testng.SkipException;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

public class CQLOperationsDstu3Test extends TestFhirPath implements ITest {
private static FhirContext fhirContext = FhirContext.forCached(FhirVersionEnum.DSTU3);
private static Dstu3FhirModelResolver fhirModelResolver = new CachedDstu3FhirModelResolver();
private static RestFhirRetrieveProvider retrieveProvider = new RestFhirRetrieveProvider(
new SearchParameterResolver(fhirContext),
fhirModelResolver,
fhirContext.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3")
);
private static CompositeDataProvider provider = new CompositeDataProvider(fhirModelResolver, retrieveProvider);

private final String file;
private final org.hl7.fhirpath.tests.Test test;
private final Group group;

@Factory(dataProvider = "dataMethod")
public CQLOperationsDstu3Test(String file, Group group, org.hl7.fhirpath.tests.Test test) {
this.file = file;
this.group = group;
this.test = test;
}

@DataProvider
public static Object[][] dataMethod() {
String[] listOfFiles = {
"stu3/tests-fhir-r3.xml"
};

List<Object[]> testsToRun = new ArrayList<>();
for (String file: listOfFiles) {
for (Group group : loadTestsFile(file).getGroup()) {
for (org.hl7.fhirpath.tests.Test test : group.getTest()) {
if (!"2.1.0".equals(test.getVersion())) { // unsupported version
testsToRun.add(new Object[] {
file,
group,
test
});
}
}
}
}
return testsToRun.toArray(new Object[testsToRun.size()][]);
}

public static Set<String> SKIP = Sets.newHashSet(
"stu3/tests-fhir-r3/Dollar/testDollarOrderNotAllowed(Patient.children().skip(1))",
"stu3/tests-fhir-r3/Dollar/testDollarThis1(Patient.name.given.where(substring($this.length()-3) = 'out'))",
"stu3/tests-fhir-r3/Dollar/testDollarThis2(Patient.name.given.where(substring($this.length()-3) = 'ter'))",
"stu3/tests-fhir-r3/Literals/testLiteralDate((0).not() = false)",
"stu3/tests-fhir-r3/Literals/testLiteralDate((1).not() = false)",
"stu3/tests-fhir-r3/Literals/testLiteralDate((1|2).not() = false)",
"stu3/tests-fhir-r3/Literals/testLiteralDate(Patient.birthDate != @1974-12-25T12:34:00)",
"stu3/tests-fhir-r3/Literals/testLiteralDate(Patient.birthDate != @1974-12-25T12:34:00+10:00)",
"stu3/tests-fhir-r3/Literals/testLiteralDate(Patient.birthDate != @1974-12-25T12:34:00-10:00)",
"stu3/tests-fhir-r3/Literals/testLiteralDate(Patient.birthDate != @1974-12-25T12:34:00Z)",
"stu3/tests-fhir-r3/Literals/testLiteralDate(Patient.birthDate != @T12:14)",
"stu3/tests-fhir-r3/Literals/testLiteralDate(Patient.birthDate != @T12:14:15)",
"stu3/tests-fhir-r3/Literals/testLiteralDecimal(Observation.value.value < 190)",
"stu3/tests-fhir-r3/Literals/testLiteralDecimal(Observation.value.value > 0)",
"stu3/tests-fhir-r3/Literals/testLiteralString(Patient.name.given.first() = 'Peter')",
"stu3/tests-fhir-r3/Literals/testLiteralUnicode(Patient.name.given.first() = 'P\\u0065ter')",
"stu3/tests-fhir-r3/testAll(Patient.name.select(family.exists()).all())",
"stu3/tests-fhir-r3/testAll(Patient.name.select(given.exists()).all())",
"stu3/tests-fhir-r3/testBooleanImplies((true implies {}) = {})",
"stu3/tests-fhir-r3/testBooleanImplies(({} implies false) = true)",
"stu3/tests-fhir-r3/testBooleanImplies(({} implies {}) = true)",
"stu3/tests-fhir-r3/testBooleanLogicAnd((true and {}) = {})",
"stu3/tests-fhir-r3/testBooleanLogicAnd(({} and true) = {})",
"stu3/tests-fhir-r3/testBooleanLogicAnd(({} and {}) = {})",
"stu3/tests-fhir-r3/testBooleanLogicOr((false or {}) = {})",
"stu3/tests-fhir-r3/testBooleanLogicOr(({} or false) = {})",
"stu3/tests-fhir-r3/testBooleanLogicOr(({} or {}) = {})",
"stu3/tests-fhir-r3/testBooleanLogicXOr((false xor {}) = {})",
"stu3/tests-fhir-r3/testBooleanLogicXOr((true xor {}) = {})",
"stu3/tests-fhir-r3/testBooleanLogicXOr(({} xor false) = {})",
"stu3/tests-fhir-r3/testBooleanLogicXOr(({} xor true) = {})",
"stu3/tests-fhir-r3/testBooleanLogicXOr(({} xor {}) = {})",
"stu3/tests-fhir-r3/testConcatenate((1 | 2 | 3) & 'b' = '1,2,3b')",
"stu3/tests-fhir-r3/testConcatenate(1 & 'a' = '1a')",
"stu3/tests-fhir-r3/testConcatenate(1 & 1 = '11')",
"stu3/tests-fhir-r3/testContainsString('12345'.contains('') = false)",
"stu3/tests-fhir-r3/testDistinct((1 | 2 | 3).isDistinct())",
"stu3/tests-fhir-r3/testDistinct(Questionnaire.descendants().linkId.distinct())",
"stu3/tests-fhir-r3/testDistinct(Questionnaire.descendants().linkId.isDistinct())",
"stu3/tests-fhir-r3/testDistinct(Questionnaire.descendants().linkId.select(substring(0,1)).distinct())",
"stu3/tests-fhir-r3/testDistinct(Questionnaire.descendants().linkId.select(substring(0,1)).isDistinct().not())",
"stu3/tests-fhir-r3/testDivide(1.2 / 1.8 = 0.67)",
"stu3/tests-fhir-r3/testEndsWith('12345'.endsWith('') = false)",
"stu3/tests-fhir-r3/testEquality(0.0 = 0)",
"stu3/tests-fhir-r3/testEquality(1.10 = 1.1)",
"stu3/tests-fhir-r3/testEquality(name = name.first() | name.last())",
"stu3/tests-fhir-r3/testEquality(name = name.last() | name.first())",
"stu3/tests-fhir-r3/testEquivalent(@2012-04-15 ~ @2012-04-15T10:00:00)",
"stu3/tests-fhir-r3/testEquivalent(name.given ~ name.first().given | name.last().given)",
"stu3/tests-fhir-r3/testEquivalent(name.given ~ name.last().given | name.first().given)",
"stu3/tests-fhir-r3/testExtension(Patient.birthDate.extension(%\"ext-patient-birthTime\").exists())",
"stu3/tests-fhir-r3/testExtension(Patient.birthDate.extension('http://hl7.org/fhir/StructureDefinition/patient-birthTime').exists())",
"stu3/tests-fhir-r3/testExtension(Patient.birthDate.extension('http://hl7.org/fhir/StructureDefinition/patient-birthTime1').empty())",
"stu3/tests-fhir-r3/testFirstLast(Patient.name.first().given = 'Peter' | 'James')",
"stu3/tests-fhir-r3/testFirstLast(Patient.name.last().given = 'Jim')",
"stu3/tests-fhir-r3/testIif(iif(Patient.name.empty(), 'unnamed', 'named') = 'named')",
"stu3/tests-fhir-r3/testIif(iif(Patient.name.exists(), 'named', 'unnamed') = 'named')",
"stu3/tests-fhir-r3/testIndexer(Patient.name[0].given = 'Peter' | 'James')",
"stu3/tests-fhir-r3/testIndexer(Patient.name[1].given = 'Jim')",
"stu3/tests-fhir-r3/testNEquality(0.0 != 0)",
"stu3/tests-fhir-r3/testNEquality(1.10 != 1.1)",
"stu3/tests-fhir-r3/testNEquality(name != name.first() | name.last())",
"stu3/tests-fhir-r3/testNEquality(name != name.last() | name.first())",
"stu3/tests-fhir-r3/testNotEquivalent(@2012-04-15 !~ @2012-04-15T10:00:00)",
"stu3/tests-fhir-r3/testNotEquivalent(name.given !~ name.first().given | name.last().given)",
"stu3/tests-fhir-r3/testNotEquivalent(name.given !~ name.last().given | name.first().given)",
"stu3/tests-fhir-r3/testNow(now().toString().length() > 10)",
"stu3/tests-fhir-r3/testNow(Patient.birthDate < now())",
"stu3/tests-fhir-r3/testRepeat(Questionnaire.children().concept.count() = 2)",
"stu3/tests-fhir-r3/testRepeat(Questionnaire.descendants().concept.count() = 10)",
"stu3/tests-fhir-r3/testRepeat(Questionnaire.repeat(item).concept.count() = 10)",
"stu3/tests-fhir-r3/testRepeat(ValueSet.expansion.repeat(contains).count() = 10)",
"stu3/tests-fhir-r3/testSelect(Patient.name.select(given) = 'Peter' | 'James' | 'Jim')",
"stu3/tests-fhir-r3/testSelect(Patient.name.select(given | family) = 'Peter' | 'James' | 'Chalmers' | 'Jim')",
"stu3/tests-fhir-r3/testSkip((0 | 1 | 2).skip(1) = 1 | 2)",
"stu3/tests-fhir-r3/testSkip(Patient.name.skip(1).given = 'Jim')",
"stu3/tests-fhir-r3/testStartsWith('12345'.startsWith('') = false)",
"stu3/tests-fhir-r3/testSubSetOf(Patient.name.first().subsetOf($this.name))",
"stu3/tests-fhir-r3/testSubSetOf(Patient.name.subsetOf($this.name.first()).not())",
"stu3/tests-fhir-r3/testSuperSetOf(Patient.name.first().supersetOf($this.name).not())",
"stu3/tests-fhir-r3/testSuperSetOf(Patient.name.supersetOf($this.name.first()))",
"stu3/tests-fhir-r3/testTail((0 | 1 | 2).tail() = 1 | 2)",
"stu3/tests-fhir-r3/testTail(Patient.name.tail().given = 'Jim')",
"stu3/tests-fhir-r3/testTake((0 | 1 | 2).take(2) = 0 | 1)",
"stu3/tests-fhir-r3/testTake(Patient.name.take(1).given = 'Peter' | 'James')",
"stu3/tests-fhir-r3/testTake(Patient.name.take(2).given = 'Peter' | 'James' | 'Jim')",
"stu3/tests-fhir-r3/testTake(Patient.name.take(3).given = 'Peter' | 'James' | 'Jim')",
"stu3/tests-fhir-r3/testToday(Patient.birthDate < today())",
"stu3/tests-fhir-r3/testToday(today().toString().length() = 10)",
"stu3/tests-fhir-r3/testToInteger('0.0'.toInteger().empty())",
"stu3/tests-fhir-r3/testVariables(%\"vs-administrative-gender\" = 'http://hl7.org/fhir/ValueSet/administrative-gender')",
"stu3/tests-fhir-r3/testVariables(%loinc = 'http://loinc.org')",
"stu3/tests-fhir-r3/testVariables(%sct = 'http://snomed.info/sct')",
"stu3/tests-fhir-r3/testVariables(%ucum = 'http://unitsofmeasure.org')",
"stu3/tests-fhir-r3/testWhere(Patient.name.where($this.given = 'Jim').count() = 1)",
"stu3/tests-fhir-r3/testWhere(Patient.name.where(given = 'Jim').count() = 1)",
"stu3/tests-fhir-r3/testWhere(Patient.name.where(given = 'X').count() = 0)"
);

@Override
public String getTestName() {
return
file.replaceAll(".xml", "")
+ "/"+ group.getName()
+ (test.getName() != null ? "/"+ test.getName() : "")
+ "("+ test.getExpression().getValue() +")";
}

@Test
public void test() throws UcumException {
if (SKIP.contains(getTestName())) {
throw new SkipException("Skipping " + getTestName());
}

runTest(test, "stu3/input/", fhirContext, provider, fhirModelResolver);
}

public Boolean compareResults(Object expectedResult, Object actualResult, Context context, FhirModelResolver<?, ?, ?, ?, ?, ?, ?, ?> resolver) {
// Perform FHIR system-defined type conversions
if (actualResult instanceof Enumeration) {
actualResult = ((Enumeration<?>) actualResult).getValueAsString();
} else if (actualResult instanceof BooleanType) {
actualResult = ((BooleanType) actualResult).getValue();
} else if (actualResult instanceof IntegerType) {
actualResult = ((IntegerType) actualResult).getValue();
} else if (actualResult instanceof DecimalType) {
actualResult = ((DecimalType) actualResult).getValue();
} else if (actualResult instanceof StringType) {
actualResult = ((StringType) actualResult).getValue();
} else if (actualResult instanceof BaseDateTimeType) {
actualResult = resolver.toJavaPrimitive(actualResult, actualResult);
} else if (actualResult instanceof Quantity) {
Quantity quantity = (Quantity) actualResult;
actualResult = new org.opencds.cqf.cql.engine.runtime.Quantity().withValue(quantity.getValue())
.withUnit(quantity.getUnit());
} else if (actualResult instanceof Coding) {
Coding coding = (Coding) actualResult;
actualResult = new Code().withCode(coding.getCode()).withDisplay(coding.getDisplay())
.withSystem(coding.getSystem()).withVersion(coding.getVersion());
}
return EqualEvaluator.equal(expectedResult, actualResult, context);
}
}
Loading