use of org.opencds.cqf.cql.engine.terminology.CodeSystemInfo in project quality-measure-and-cohort-service by Alvearie.
the class CQLParameterTests method runTest.
public void runTest(String type, Object expectedOutput, String defaultValue) throws Exception {
String cql = "library \"Test\" version '1.0.0'\n";
cql += "codesystem \"DUMMY\": 'urn:mysystem'\n";
cql += "parameter Input " + type;
if (defaultValue != null) {
cql += " default ";
cql += defaultValue;
}
cql += "\n";
cql += "define Output:\n\tInput\n";
Map<String, Object> parameters = null;
if (defaultValue == null) {
parameters = new HashMap<>();
parameters.put("Input", expectedOutput);
}
TerminologyProvider tp = new TerminologyProvider() {
@Override
public boolean in(Code code, ValueSetInfo valueSet) {
return false;
}
@Override
public Iterable<Code> expand(ValueSetInfo valueSet) {
return null;
}
@Override
public Code lookup(Code code, CodeSystemInfo codeSystem) {
return code;
}
};
LibraryLoader ll = new InMemoryLibraryLoader(Arrays.asList(toLibrary(cql)));
CqlEngine engine = new CqlEngine(ll, Collections.<String, DataProvider>emptyMap(), tp);
EvaluationResult result = engine.evaluate("Test", parameters);
assertEquals(1, result.expressionResults.size());
Object actual = result.forExpression("Output");
assertEquals(expectedOutput.toString(), actual.toString());
}
use of org.opencds.cqf.cql.engine.terminology.CodeSystemInfo in project quality-measure-and-cohort-service by Alvearie.
the class R4RestFhirTerminologyProviderTest method nonNullCodesystemsUnsupported.
@Test(expected = UnsupportedOperationException.class)
public void nonNullCodesystemsUnsupported() {
CodeSystemInfo codeSystem = new CodeSystemInfo();
codeSystem.setId("SNOMED-CT");
codeSystem.setVersion("2013-09");
ValueSetInfo info = new ValueSetInfo();
info.setId("urn:oid:Test");
info.getCodeSystems().add(codeSystem);
provider.resolveByUrl(info);
}
use of org.opencds.cqf.cql.engine.terminology.CodeSystemInfo in project quality-measure-and-cohort-service by Alvearie.
the class R4RestFhirTerminologyProviderTest method lookupOperationSuccess.
@Test
public void lookupOperationSuccess() throws Exception {
CodeSystemInfo info = new CodeSystemInfo();
info.setId(TEST_SYSTEM);
info.setVersion(TEST_SYSTEM_VERSION);
Code code = new Code();
code.setCode(TEST_CODE);
code.setSystem(TEST_SYSTEM);
code.setDisplay(TEST_DISPLAY);
Parameters parameters = new Parameters();
parameters.addParameter().setName("name").setValue(new StringType(code.getCode()));
parameters.addParameter().setName("version").setValue(new StringType(info.getVersion()));
parameters.addParameter().setName("display").setValue(new StringType(code.getDisplay()));
mockFhirResourceRetrieval(post(urlEqualTo("/CodeSystem/$lookup?_format=json")), parameters);
Code result = provider.lookup(code, info);
assertNotNull(result);
assertEquals(result.getSystem(), code.getSystem());
assertEquals(result.getCode(), code.getCode());
assertEquals(result.getDisplay(), code.getDisplay());
}
use of org.opencds.cqf.cql.engine.terminology.CodeSystemInfo in project quality-measure-and-cohort-service by Alvearie.
the class R4FileSystemFhirTerminologyProviderTest method lookupOperationSuccess.
@Test(expected = UnsupportedOperationException.class)
public void lookupOperationSuccess() throws Exception {
CodeSystemInfo info = new CodeSystemInfo();
info.setId(TEST_SYSTEM);
info.setVersion(TEST_SYSTEM_VERSION1);
Code code = new Code();
code.setCode(TEST_CODE);
code.setSystem(TEST_SYSTEM);
code.setDisplay(TEST_DISPLAY);
provider.lookup(code, info);
}
Aggregations