Search in sources :

Example 16 with Code

use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.

the class SparkTypeConverterTest method testToSparkCode.

@Test
public void testToSparkCode() {
    Code code = new Code().withCode("123").withSystem("MySystem").withDisplay("Display");
    Object converted = typeConverter.toSparkCode(code);
    assertTrue(converted instanceof scala.collection.Map);
}
Also used : Code(org.opencds.cqf.cql.engine.runtime.Code) Test(org.junit.Test)

Example 17 with Code

use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.

the class DefaultCqlDataProviderTest method retrieve.

@Test
public void retrieve() {
    Iterable<Object> expected = new ArrayList<>();
    String context = "context";
    String contextPath = "contextPath";
    Object contextValue = new Object();
    String dataType = "dataType";
    String templateId = "templateId";
    String codePath = "codePath";
    Iterable<Code> codes = new ArrayList<>();
    String valueSet = "valueSet";
    String datePath = "datePath";
    String dateLowPath = "dateLowPath";
    String dateHighPath = "dateHighPath";
    Interval dateRange = Mockito.mock(Interval.class);
    RetrieveProvider retrieveProvider = Mockito.mock(RetrieveProvider.class);
    Mockito.when(retrieveProvider.retrieve(context, contextPath, contextValue, dataType, templateId, codePath, codes, valueSet, datePath, dateLowPath, dateHighPath, dateRange)).thenReturn(expected);
    CqlDataProvider provider = new DefaultCqlDataProvider(null, retrieveProvider);
    Assert.assertEquals(expected, provider.retrieve(context, contextPath, contextValue, dataType, templateId, codePath, codes, valueSet, datePath, dateLowPath, dateHighPath, dateRange));
}
Also used : ArrayList(java.util.ArrayList) RetrieveProvider(org.opencds.cqf.cql.engine.retrieve.RetrieveProvider) Code(org.opencds.cqf.cql.engine.runtime.Code) Interval(org.opencds.cqf.cql.engine.runtime.Interval) Test(org.junit.Test)

Example 18 with Code

use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.

the class R4FileSystemFhirTerminologyProviderTest method inOperationHandlesNullSystem.

@Test
public void inOperationHandlesNullSystem() throws Exception {
    ValueSetInfo info = new ValueSetInfo();
    info.setId(setId);
    Code code = new Code();
    code.setCode(TEST_CODE);
    code.setDisplay(TEST_DISPLAY);
    boolean result = provider.in(code, info);
    assertTrue(result);
}
Also used : ValueSetInfo(org.opencds.cqf.cql.engine.terminology.ValueSetInfo) Code(org.opencds.cqf.cql.engine.runtime.Code) Test(org.junit.Test)

Example 19 with Code

use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.

the class R4FileSystemFhirTerminologyProviderTest method inOperationReturnsFalseWithBadVersion.

@Test
public void inOperationReturnsFalseWithBadVersion() throws Exception {
    ValueSetInfo info = new ValueSetInfo();
    info.setId(setId);
    Code code = new Code();
    code.setSystem(TEST_SYSTEM);
    code.setCode(TEST_CODE);
    code.setDisplay(TEST_DISPLAY_FOR_VERSION2);
    code.setVersion("Bad Version");
    boolean result = provider.in(code, info);
    assertTrue(result);
}
Also used : ValueSetInfo(org.opencds.cqf.cql.engine.terminology.ValueSetInfo) Code(org.opencds.cqf.cql.engine.runtime.Code) Test(org.junit.Test)

Example 20 with Code

use of org.opencds.cqf.cql.engine.runtime.Code in project quality-measure-and-cohort-service by Alvearie.

the class R4FileSystemFhirTerminologyProviderTest method inOperationReturnsFalse.

@Test
public void inOperationReturnsFalse() throws Exception {
    ValueSetInfo info = new ValueSetInfo();
    info.setId(setId);
    Code code = new Code();
    code.setSystem(TEST_SYSTEM);
    code.setCode("Bad_Code");
    code.setDisplay(TEST_DISPLAY);
    boolean result = provider.in(code, info);
    assertFalse(result);
}
Also used : ValueSetInfo(org.opencds.cqf.cql.engine.terminology.ValueSetInfo) Code(org.opencds.cqf.cql.engine.runtime.Code) Test(org.junit.Test)

Aggregations

Code (org.opencds.cqf.cql.engine.runtime.Code)45 Test (org.junit.Test)35 ValueSetInfo (org.opencds.cqf.cql.engine.terminology.ValueSetInfo)17 Parameters (org.hl7.fhir.r4.model.Parameters)6 HashMap (java.util.HashMap)5 Metadata (org.apache.spark.sql.types.Metadata)4 ValueSet (org.hl7.fhir.r4.model.ValueSet)4 BaseSparkTest (com.ibm.cohort.cql.spark.BaseSparkTest)3 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 MetadataBuilder (org.apache.spark.sql.types.MetadataBuilder)3 BooleanType (org.hl7.fhir.r4.model.BooleanType)3 CodeSystemInfo (org.opencds.cqf.cql.engine.terminology.CodeSystemInfo)3 DataRow (com.ibm.cohort.datarow.model.DataRow)2 VersionedIdentifier (org.cqframework.cql.elm.execution.VersionedIdentifier)2 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)2 ConfigurationException (ca.uhn.fhir.context.ConfigurationException)1 DataFormatException (ca.uhn.fhir.parser.DataFormatException)1 CodeKey (com.ibm.cohort.datarow.model.CodeKey)1 SimpleDataRow (com.ibm.cohort.datarow.model.SimpleDataRow)1