Search in sources :

Example 96 with Expression

use of org.hl7.fhir.r4b.model.Expression in project clinical_quality_language by cqframework.

the class TakeInvocation method setOperands.

@Override
public void setOperands(Iterable<Expression> operands) {
    boolean first = true;
    for (Expression operand : operands) {
        if (first) {
            ((Slice) expression).setSource(operand);
            first = false;
        } else {
            ((Slice) expression).setEndIndex(operand);
        }
    }
}
Also used : Expression(org.hl7.elm.r1.Expression) Slice(org.hl7.elm.r1.Slice)

Example 97 with Expression

use of org.hl7.fhir.r4b.model.Expression in project clinical_quality_language by cqframework.

the class TimeInvocation method getOperands.

@Override
public Iterable<Expression> getOperands() {
    Time t = (Time) expression;
    List<Expression> opList = Arrays.asList(t.getHour(), t.getMinute(), t.getSecond(), t.getMillisecond());
    // If the last expression is null, we should trim this down
    int i;
    for (i = 3; i > 0 && opList.get(i) == null; i--) ;
    return opList.subList(0, i + 1);
}
Also used : Expression(org.hl7.elm.r1.Expression) Time(org.hl7.elm.r1.Time) DateTime(org.hl7.elm.r1.DateTime)

Example 98 with Expression

use of org.hl7.fhir.r4b.model.Expression in project clinical_quality_language by cqframework.

the class FunctionRefInvocation method setResolution.

@Override
public void setResolution(OperatorResolution resolution) {
    super.setResolution(resolution);
    FunctionRef fr = (FunctionRef) expression;
    if (resolution.getLibraryName() != null && !resolution.getLibraryName().equals(fr.getLibraryName())) {
        fr.setLibraryName(resolution.getLibraryName());
    }
}
Also used : FunctionRef(org.hl7.elm.r1.FunctionRef)

Example 99 with Expression

use of org.hl7.fhir.r4b.model.Expression in project clinical_quality_language by cqframework.

the class IndexOfInvocation method setOperands.

@Override
public void setOperands(Iterable<Expression> operands) {
    Iterator<Expression> it = operands.iterator();
    if (!it.hasNext()) {
        throw new IllegalArgumentException("IndexOf operation requires two operands.");
    }
    IndexOf indexOf = (IndexOf) expression;
    indexOf.setSource(it.next());
    if (!it.hasNext()) {
        throw new IllegalArgumentException("IndexOf operation requires two operands.");
    }
    indexOf.setElement(it.next());
    if (it.hasNext()) {
        throw new IllegalArgumentException("IndexOf operation requires two operands.");
    }
}
Also used : Expression(org.hl7.elm.r1.Expression) IndexOf(org.hl7.elm.r1.IndexOf)

Example 100 with Expression

use of org.hl7.fhir.r4b.model.Expression in project clinical_quality_language by cqframework.

the class NaryExpressionInvocation method setOperands.

@Override
public void setOperands(Iterable<Expression> operands) {
    List<Expression> expOperands = ((NaryExpression) expression).getOperand();
    expOperands.clear();
    for (Expression operand : operands) {
        expOperands.add(operand);
    }
}
Also used : NaryExpression(org.hl7.elm.r1.NaryExpression) Expression(org.hl7.elm.r1.Expression) NaryExpression(org.hl7.elm.r1.NaryExpression)

Aggregations

HashMap (java.util.HashMap)33 Test (org.junit.Test)30 Test (org.junit.jupiter.api.Test)30 Patient (org.hl7.fhir.r4.model.Patient)29 CqlEvaluator (com.ibm.cohort.cql.evaluation.CqlEvaluator)28 CqlVersionedIdentifier (com.ibm.cohort.cql.library.CqlVersionedIdentifier)28 ArrayList (java.util.ArrayList)27 Expression (org.hl7.elm.r1.Expression)26 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)25 CqlEvaluationResult (com.ibm.cohort.cql.evaluation.CqlEvaluationResult)24 FHIRException (org.hl7.fhir.exceptions.FHIRException)19 FhirServerConfig (com.ibm.cohort.fhir.client.config.FhirServerConfig)16 Coding (org.hl7.fhir.r4.model.Coding)15 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)14 Row (org.apache.spark.sql.Row)12 List (java.util.List)11 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)11 FhirPath (au.csiro.pathling.fhirpath.FhirPath)10 Nonnull (javax.annotation.Nonnull)10 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)9