Search in sources :

Example 16 with DataRow

use of com.ibm.cohort.datarow.model.DataRow in project quality-measure-and-cohort-service by Alvearie.

the class DataRowModelResolverTest method testInvalidObjectAsTypeStrict.

@Test
public void testInvalidObjectAsTypeStrict() {
    DataRow row = new SimpleDataRow(Collections.emptyMap());
    assertThrows(InvalidCast.class, () -> resolver.as(row, String.class, true));
}
Also used : SimpleDataRow(com.ibm.cohort.datarow.model.SimpleDataRow) SimpleDataRow(com.ibm.cohort.datarow.model.SimpleDataRow) DataRow(com.ibm.cohort.datarow.model.DataRow) Test(org.junit.Test)

Example 17 with DataRow

use of com.ibm.cohort.datarow.model.DataRow in project quality-measure-and-cohort-service by Alvearie.

the class DataRowRetrieveProviderTest method testRetrieveFilterByProvidedCodes_dataForCodeIsString.

@Test
public void testRetrieveFilterByProvidedCodes_dataForCodeIsString() {
    String maleId = "789";
    List<Object> people = makePeopleTestData(maleId);
    data.put(DATATYPE_PERSON, people);
    List<Code> codes = Arrays.asList(GENDER_MALE).stream().map(this::code).collect(Collectors.toList());
    Iterable<Object> rows = retrieveProvider.retrieve(CONTEXT_CLAIM, FIELD_PERSON_ID, null, DATATYPE_PERSON, null, FIELD_GENDER, codes, null, null, null, null, null);
    int count = 0;
    for (Object obj : rows) {
        count++;
        DataRow actual = (DataRow) obj;
        assertEquals(maleId, actual.getValue(FIELD_PERSON_ID));
    }
    assertEquals(1, count);
}
Also used : Code(org.opencds.cqf.cql.engine.runtime.Code) SimpleDataRow(com.ibm.cohort.datarow.model.SimpleDataRow) DataRow(com.ibm.cohort.datarow.model.DataRow) Test(org.junit.Test)

Aggregations

DataRow (com.ibm.cohort.datarow.model.DataRow)17 Test (org.junit.Test)13 SimpleDataRow (com.ibm.cohort.datarow.model.SimpleDataRow)9 List (java.util.List)6 HashSet (java.util.HashSet)4 HashMap (java.util.HashMap)3 PrefixStringMatcher (com.ibm.cohort.cql.util.PrefixStringMatcher)2 RegexStringMatcher (com.ibm.cohort.cql.util.RegexStringMatcher)2 StringMatcher (com.ibm.cohort.cql.util.StringMatcher)2 ArrayList (java.util.ArrayList)2 Code (org.opencds.cqf.cql.engine.runtime.Code)2 CqlDataProvider (com.ibm.cohort.cql.data.CqlDataProvider)1 CqlEvaluationRequests (com.ibm.cohort.cql.evaluation.CqlEvaluationRequests)1 CqlEvaluator (com.ibm.cohort.cql.evaluation.CqlEvaluator)1 SparkDataRow (com.ibm.cohort.cql.spark.data.SparkDataRow)1 SparkOutputColumnEncoder (com.ibm.cohort.cql.spark.data.SparkOutputColumnEncoder)1 DataRowDataProvider (com.ibm.cohort.datarow.engine.DataRowDataProvider)1 DataRowRetrieveProvider (com.ibm.cohort.datarow.engine.DataRowRetrieveProvider)1 CodeKey (com.ibm.cohort.datarow.model.CodeKey)1 Map (java.util.Map)1