use of org.hl7.fhir.r5.model.Range in project org.hl7.fhir.core by hapifhir.
the class FluentPathTests method testDecimalRA.
@Test
public void testDecimalRA() throws FileNotFoundException, IOException, FHIRException {
RiskAssessment r = new RiskAssessment();
SimpleQuantity sq = new SimpleQuantity();
sq.setValue(0.2);
sq.setUnit("%");
sq.setCode("%");
sq.setSystem("http://unitsofmeasure.org");
SimpleQuantity sq1 = new SimpleQuantity();
sq1.setValue(0.4);
sq1.setUnit("%");
sq1.setCode("%");
sq1.setSystem("http://unitsofmeasure.org");
r.addPrediction().setProbability(new Range().setLow(sq).setHigh(sq1));
testBoolean(r, r.getPrediction().get(0).getProbability(), "RiskAssessment.prediction.probabilityRange", "(low.empty() or ((low.code = '%') and (low.system = %ucum))) and (high.empty() or ((high.code = '%') and (high.system = %ucum)))", true);
testBoolean(r, r.getPrediction().get(0), "RiskAssessment.prediction", "probability is decimal implies probability.as(decimal) <= 100", true);
r.getPrediction().get(0).setProbability(new DecimalType(80));
testBoolean(r, r.getPrediction().get(0), "RiskAssessment.prediction", "probability.as(decimal) <= 100", true);
}
Aggregations