Search in sources :

Example 81 with Range

use of org.hl7.fhir.dstu2.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);
}
Also used : RiskAssessment(org.hl7.fhir.dstu2016may.model.RiskAssessment) SimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity) DecimalType(org.hl7.fhir.dstu2016may.model.DecimalType) Range(org.hl7.fhir.dstu2016may.model.Range) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)18 IBaseResource (org.hl7.fhir.instance.model.api.IBaseResource)15 Quantity (org.hl7.fhir.r4.model.Quantity)14 Resource (org.hl7.fhir.r4.model.Resource)13 NotImplementedException (org.apache.commons.lang3.NotImplementedException)12 BundleEntryComponent (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)12 Search (ca.uhn.fhir.rest.annotation.Search)11 Trace (com.newrelic.api.agent.Trace)10 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)10 Beneficiary (gov.cms.bfd.model.rif.Beneficiary)9 ArrayList (java.util.ArrayList)9 DateRangeParam (ca.uhn.fhir.rest.param.DateRangeParam)8 Operation (gov.cms.bfd.server.war.Operation)8 OffsetLinkBuilder (gov.cms.bfd.server.war.commons.OffsetLinkBuilder)8 Date (java.util.Date)8 Range (org.hl7.fhir.r4.model.Range)8 ResourceNotFoundException (ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException)7 List (java.util.List)7 Bundle (org.hl7.fhir.r4.model.Bundle)7