use of com.walmartlabs.concord.runtime.v2.model.Expression in project quality-measure-and-cohort-service by Alvearie.
the class MeasureTestBase method getCareGapMeasure.
public Measure getCareGapMeasure(String measureName, Library library, Map<MeasurePopulationType, String> expressionsByPopType, String... careGapExpressions) throws Exception {
Measure measure = getProportionMeasure(measureName, library, expressionsByPopType);
assertNotNull(careGapExpressions);
for (String expression : careGapExpressions) {
Measure.MeasureGroupPopulationComponent pop = new Measure.MeasureGroupPopulationComponent();
pop.setId(expression);
pop.setCode(new CodeableConcept(new Coding(CDMConstants.CDM_CODE_SYSTEM_MEASURE_POPULATION_TYPE, CDMConstants.CARE_GAP, "Care Gap")));
pop.setCriteria(new Expression().setLanguage("text/cql+identifier").setExpression(expression));
measure.getGroupFirstRep().addPopulation(pop);
}
return measure;
}
use of com.walmartlabs.concord.runtime.v2.model.Expression in project quality-measure-and-cohort-service by Alvearie.
the class MeasureTestBase method addPopulations.
protected void addPopulations(Measure.MeasureGroupComponent group, Map<MeasurePopulationType, String> expressionsByPopType) {
for (Map.Entry<MeasurePopulationType, String> entry : expressionsByPopType.entrySet()) {
Measure.MeasureGroupPopulationComponent pop = new Measure.MeasureGroupPopulationComponent();
pop.setCode(new CodeableConcept().addCoding(new Coding().setCode(entry.getKey().toCode())));
pop.setCriteria(new Expression().setExpression(entry.getValue()));
group.addPopulation(pop);
}
}
use of com.walmartlabs.concord.runtime.v2.model.Expression in project org.hl7.fhir.core by hapifhir.
the class ExpressionAdvisor40 method handleExtension.
public void handleExtension(@Nonnull String path, @Nonnull Extension src, @Nonnull org.hl7.fhir.dstu2.model.Extension tgt) throws FHIRException {
if (src.getValue() instanceof Expression) {
StringType type = new StringType();
if (src.getValue() == null) {
throw new NullPointerException("null cannot be cast to non-null type org.hl7.fhir.r4.model.Expression");
} else {
type.setValueAsString(((Expression) src.getValue()).getExpression());
tgt.setValue((org.hl7.fhir.dstu2.model.Type) type);
if (src.hasUrlElement()) {
tgt.setUrlElement(Uri10_40.convertUri(src.getUrlElement()));
}
}
} else {
throw new FHIRException("Unknown extension type passed in to custom convertor method.");
}
}
use of com.walmartlabs.concord.runtime.v2.model.Expression in project org.hl7.fhir.core by hapifhir.
the class Expression50Test method testBaseAdvisorExpressionIgore.
@Test
@DisplayName("Ensure base advisor ignores Expression types and doesn't explode.")
public void testBaseAdvisorExpressionIgore() throws IOException {
Expression exp = new Expression();
exp.setExpression("x + y = z");
Extension ext = new Extension();
ext.setValue(exp);
BaseAdvisor_10_50 baseAdvisor50 = new BaseAdvisor_10_50();
Assertions.assertTrue(baseAdvisor50.ignoreExtension("", ext));
}
use of com.walmartlabs.concord.runtime.v2.model.Expression in project CRD by HL7-DaVinci.
the class QuestionnaireEmbeddedCQLProcessor method hasEmbeddedCql.
private boolean hasEmbeddedCql(QuestionnaireItemComponent item) {
List<Extension> extensionList = item.getExtension();
// sdc-questionnaire-initialExpression for now, could add more if needed
if (extensionList.isEmpty())
return false;
for (int i = 0; i < extensionList.size(); i++) {
Extension extension = extensionList.get(i);
if (extension.getUrl().equals("http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-initialExpression")) {
Expression expression = (Expression) extension.getValue();
if (expression.getLanguage().equals("text/cql")) {
String expressionString = expression.getExpression();
// regex for \"library\".statement
final String libraryRefRegex = "^\\\\\\\"[a-zA-Z0-9]+\\\\\\\".[a-zA-Z0-9]+$";
final Pattern pattern = Pattern.compile(libraryRefRegex, Pattern.MULTILINE);
// cql-execution library to throw error if it is invalid
if (!pattern.matcher(expressionString).find()) {
return true;
}
}
}
}
return false;
}
Aggregations