Search in sources :

Example 31 with CqlEvaluationRequests

use of com.ibm.cohort.cql.evaluation.CqlEvaluationRequests in project quality-measure-and-cohort-service by Alvearie.

the class SparkSchemaCreatorTest method testDuplicateElementInformation.

@Test(expected = IllegalArgumentException.class)
public void testDuplicateElementInformation() throws Exception {
    cqlTranslator.registerModelInfo(new File("src/test/resources/schema-validation/duplicate-element-model-info.xml"));
    ContextDefinitions contextDefinitions = makeContextDefinitions(Arrays.asList(makeContextDefinition("Context1Id", "Type1", "integer")));
    CqlEvaluationRequests cqlEvaluationRequests = makeEvaluationRequests(Arrays.asList(makeEvaluationRequest(new CqlLibraryDescriptor().setLibraryId("Context1Id").setVersion("1.0.0"), new HashSet<>(Collections.singletonList("define_integer")), "Context1Id")));
    SparkSchemaCreator schemaCreator = new SparkSchemaCreator(cqlLibraryProvider, cqlEvaluationRequests, contextDefinitions, outputColumnNameFactory, cqlTranslator);
    schemaCreator.calculateSchemasForContexts(Arrays.asList("Context1Id"));
}
Also used : ContextDefinitions(com.ibm.cohort.cql.spark.aggregation.ContextDefinitions) CqlEvaluationRequests(com.ibm.cohort.cql.evaluation.CqlEvaluationRequests) CqlLibraryDescriptor(com.ibm.cohort.cql.library.CqlLibraryDescriptor) File(java.io.File) Test(org.junit.Test)

Example 32 with CqlEvaluationRequests

use of com.ibm.cohort.cql.evaluation.CqlEvaluationRequests in project quality-measure-and-cohort-service by Alvearie.

the class SparkSchemaCreatorTest method testUnsupportedKeyColumnType.

@Test(expected = UnsupportedOperationException.class)
public void testUnsupportedKeyColumnType() throws Exception {
    ContextDefinitions contextDefinitions = makeContextDefinitions(Arrays.asList(makeContextDefinition("Context1Id", "Type1", "code")));
    CqlEvaluationRequests cqlEvaluationRequests = makeEvaluationRequests(Arrays.asList(makeEvaluationRequest(new CqlLibraryDescriptor().setLibraryId("Context1Id").setVersion("1.0.0"), new HashSet<>(Collections.singletonList("define_integer")), "Context1Id")));
    SparkSchemaCreator schemaCreator = new SparkSchemaCreator(cqlLibraryProvider, cqlEvaluationRequests, contextDefinitions, outputColumnNameFactory, cqlTranslator);
    schemaCreator.calculateSchemasForContexts(Arrays.asList("Context1Id"));
}
Also used : ContextDefinitions(com.ibm.cohort.cql.spark.aggregation.ContextDefinitions) CqlEvaluationRequests(com.ibm.cohort.cql.evaluation.CqlEvaluationRequests) CqlLibraryDescriptor(com.ibm.cohort.cql.library.CqlLibraryDescriptor) Test(org.junit.Test)

Example 33 with CqlEvaluationRequests

use of com.ibm.cohort.cql.evaluation.CqlEvaluationRequests in project quality-measure-and-cohort-service by Alvearie.

the class SparkSchemaCreatorTest method testLibraryNotFound.

@Test(expected = IllegalArgumentException.class)
public void testLibraryNotFound() throws Exception {
    ContextDefinitions contextDefinitions = makeContextDefinitions(Collections.singletonList(makeContextDefinition("Context1Id", "Type1", "id")));
    CqlEvaluationRequests cqlEvaluationRequests = makeEvaluationRequests(Arrays.asList(makeEvaluationRequest(new CqlLibraryDescriptor().setLibraryId("NotExists").setVersion("1.0.0"), new HashSet<>(Collections.singletonList("bad-define")), "Context1Id")));
    SparkSchemaCreator schemaCreator = new SparkSchemaCreator(cqlLibraryProvider, cqlEvaluationRequests, contextDefinitions, outputColumnNameFactory, cqlTranslator);
    schemaCreator.calculateSchemasForContexts(Arrays.asList("Context1Id"));
}
Also used : ContextDefinitions(com.ibm.cohort.cql.spark.aggregation.ContextDefinitions) CqlEvaluationRequests(com.ibm.cohort.cql.evaluation.CqlEvaluationRequests) CqlLibraryDescriptor(com.ibm.cohort.cql.library.CqlLibraryDescriptor) Test(org.junit.Test)

Example 34 with CqlEvaluationRequests

use of com.ibm.cohort.cql.evaluation.CqlEvaluationRequests in project quality-measure-and-cohort-service by Alvearie.

the class SparkSchemaCreatorTest method testDefineNotFoundInLibrary.

@Test(expected = IllegalArgumentException.class)
public void testDefineNotFoundInLibrary() throws Exception {
    ContextDefinitions contextDefinitions = makeContextDefinitions(Collections.singletonList(makeContextDefinition("Context1Id", "Type1", "id")));
    CqlEvaluationRequests cqlEvaluationRequests = makeEvaluationRequests(Arrays.asList(makeEvaluationRequest(new CqlLibraryDescriptor().setLibraryId("Context1Id").setVersion("1.0.0"), new HashSet<>(Collections.singletonList("bad-define")), "Context1Id")));
    SparkSchemaCreator schemaCreator = new SparkSchemaCreator(cqlLibraryProvider, cqlEvaluationRequests, contextDefinitions, outputColumnNameFactory, cqlTranslator);
    schemaCreator.calculateSchemasForContexts(Arrays.asList("Context1Id"));
}
Also used : ContextDefinitions(com.ibm.cohort.cql.spark.aggregation.ContextDefinitions) CqlEvaluationRequests(com.ibm.cohort.cql.evaluation.CqlEvaluationRequests) CqlLibraryDescriptor(com.ibm.cohort.cql.library.CqlLibraryDescriptor) Test(org.junit.Test)

Aggregations

CqlEvaluationRequests (com.ibm.cohort.cql.evaluation.CqlEvaluationRequests)34 Test (org.junit.Test)27 CqlLibraryDescriptor (com.ibm.cohort.cql.library.CqlLibraryDescriptor)17 CqlEvaluationRequest (com.ibm.cohort.cql.evaluation.CqlEvaluationRequest)14 HashMap (java.util.HashMap)13 ContextDefinitions (com.ibm.cohort.cql.spark.aggregation.ContextDefinitions)10 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)9 File (java.io.File)9 CqlExpressionConfiguration (com.ibm.cohort.cql.evaluation.CqlExpressionConfiguration)8 DateParameter (com.ibm.cohort.cql.evaluation.parameters.DateParameter)6 IntegerParameter (com.ibm.cohort.cql.evaluation.parameters.IntegerParameter)6 IntervalParameter (com.ibm.cohort.cql.evaluation.parameters.IntervalParameter)6 Parameter (com.ibm.cohort.cql.evaluation.parameters.Parameter)6 DecimalParameter (com.ibm.cohort.cql.evaluation.parameters.DecimalParameter)5 StringParameter (com.ibm.cohort.cql.evaluation.parameters.StringParameter)5 ClasspathCqlLibraryProvider (com.ibm.cohort.cql.library.ClasspathCqlLibraryProvider)5 TranslatingCqlLibraryProvider (com.ibm.cohort.cql.translation.TranslatingCqlLibraryProvider)5 CqlLibraryProvider (com.ibm.cohort.cql.library.CqlLibraryProvider)4 CqlToElmTranslator (com.ibm.cohort.cql.translation.CqlToElmTranslator)4 Set (java.util.Set)4