use of org.hl7.elm.r1.Expression in project cqf-ruler by DBCG.
the class MeasureBuilder method addSDE.
public MeasureBuilder addSDE(String sdeId, String expression) {
MeasureSupplementalDataComponent sde = measure.getSupplementalDataFirstRep();
sde.getCode().setText(sdeId);
sde.getCriteria().setLanguage("text/cql").setExpression(expression);
return this;
}
use of org.hl7.elm.r1.Expression in project cqf-ruler by DBCG.
the class MeasureBuilder method addPopulation.
private MeasureBuilder addPopulation(MeasurePopulationType measurePopulationType, String expression) {
MeasureGroupPopulationComponent mgpc = this.measure.getGroupFirstRep().addPopulation();
mgpc.getCode().getCodingFirstRep().setCode(measurePopulationType.toCode());
mgpc.setCriteria(expression);
return this;
}
use of org.hl7.elm.r1.Expression in project cqf-ruler by DBCG.
the class CqlExecutionProviderIT method testDataBundleCqlExecutionProviderWithSubject.
@Test
public void testDataBundleCqlExecutionProviderWithSubject() throws Exception {
Parameters params = new Parameters();
Parameters libraryParameter = new Parameters();
params.addParameter().setName("subject").setValue(new StringType("Patient/SimplePatient"));
libraryParameter.addParameter().setName("url").setValue(new StringType(this.getClient().getServerBase() + "Library/SimpleDstu3Library"));
libraryParameter.addParameter().setName("name").setValue(new StringType("SimpleDstu3Library"));
params.addParameter().setName("library").setResource(libraryParameter);
params.addParameter().setName("expression").setValue(new StringType("SimpleDstu3Library.\"observationRetrieve\""));
String packagePrefix = "org/opencds/cqf/ruler/cpg/dstu3/provider/";
loadResource(packagePrefix + "SimpleDstu3Library.json");
loadResource(packagePrefix + "SimplePatient.json");
Bundle data = (Bundle) loadResource(packagePrefix + "SimpleDataBundle.json");
params.addParameter().setName("data").setResource(data);
params.addParameter().setName("useServerData").setValue(new BooleanType(false));
Parameters results = getClient().operation().onServer().named("$cql").withParameters(params).execute();
assertTrue(results.getParameter().get(0).getResource() instanceof Bundle);
assertTrue(((Bundle) results.getParameter().get(0).getResource()).getEntry().get(0).getResource() instanceof Observation);
assertTrue(results.getParameter().get(1).getValue() instanceof StringType);
assertTrue(((StringType) results.getParameter().get(1).getValue()).asStringValue().equals("List"));
logger.debug("Results: ", results);
}
use of org.hl7.elm.r1.Expression in project cqf-ruler by DBCG.
the class CqlExecutionProviderIT method testDataBundleCqlExecutionProvider.
@Test
public void testDataBundleCqlExecutionProvider() throws Exception {
Parameters params = new Parameters();
Parameters libraryParameter = new Parameters();
libraryParameter.addParameter().setName("url").setValue(new StringType(this.getClient().getServerBase() + "Library/SimpleDstu3Library"));
libraryParameter.addParameter().setName("name").setValue(new StringType("SimpleDstu3Library"));
params.addParameter().setName("library").setResource(libraryParameter);
params.addParameter().setName("expression").setValue(new StringType("SimpleDstu3Library.\"observationRetrieve\""));
String packagePrefix = "org/opencds/cqf/ruler/cpg/dstu3/provider/";
loadResource(packagePrefix + "SimpleDstu3Library.json");
loadResource(packagePrefix + "SimplePatient.json");
Bundle data = (Bundle) loadResource(packagePrefix + "SimpleDataBundle.json");
params.addParameter().setName("data").setResource(data);
params.addParameter().setName("useServerData").setValue(new BooleanType(false));
Parameters results = getClient().operation().onServer().named("$cql").withParameters(params).execute();
assertTrue(results.getParameter().get(0).getResource() instanceof Bundle);
assertTrue(((Bundle) results.getParameter().get(0).getResource()).getEntry().get(0).getResource() instanceof Observation);
assertTrue(results.getParameter().get(1).getValue() instanceof StringType);
assertTrue(((StringType) results.getParameter().get(1).getValue()).asStringValue().equals("List"));
logger.debug("Results: ", results);
}
use of org.hl7.elm.r1.Expression in project cqf-ruler by DBCG.
the class CqlExecutionProviderIT method testReferencedLibraryCqlExecutionProvider.
@Test
public void testReferencedLibraryCqlExecutionProvider() throws Exception {
Parameters params = new Parameters();
params.addParameter().setName("subject").setValue(new StringType("Patient/SimplePatient"));
Parameters libraryParameter = new Parameters();
libraryParameter.addParameter().setName("url").setValue(new StringType(this.getClient().getServerBase() + "Library/SimpleDstu3Library"));
libraryParameter.addParameter().setName("name").setValue(new StringType("SimpleDstu3Library"));
params.addParameter().setName("library").setResource(libraryParameter);
params.addParameter().setName("expression").setValue(new StringType("SimpleDstu3Library.\"simpleBooleanExpression\""));
String packagePrefix = "org/opencds/cqf/ruler/cpg/dstu3/provider/";
loadResource(packagePrefix + "SimpleDstu3Library.json");
loadResource(packagePrefix + "SimplePatient.json");
Parameters results = getClient().operation().onServer().named("$cql").withParameters(params).execute();
assertTrue(results.getParameter().get(0).getValue() instanceof StringType);
assertTrue(((StringType) results.getParameter().get(0).getValue()).asStringValue().equals("true"));
assertTrue(results.getParameter().get(1).getValue() instanceof StringType);
assertTrue(((StringType) results.getParameter().get(1).getValue()).asStringValue().equals("Boolean"));
logger.debug("Results: ", results);
}
Aggregations