Ejemplo n.º 1
0
  @Test
  public final void testCardiacAge() {
    final DiscreteNumericalVariable var = SampleModels.cardiacAgeVariable();
    final Patient patient = SampleCalculations.dummyPatientWithVitals(1);
    final Collection<DiscreteNumericalVariable> vars = ImmutableSet.of(var);
    // Use VariableEntry to generate the expected dynamic values.
    final VariableEntry expected =
        new VariableEntry(vars)
            .putDynamicValue(
                VariableEntry.makeNumericalInputName(var.getKey()),
                String.valueOf(patient.getAge()));

    verifyRetrievedValue(vars, patient, expected.getDynamicValues());
  }
Ejemplo n.º 2
0
 /**
  * This method returns a DiscreteNumericalVariable with the specified key and retriever, but with
  * dummy information for the other fields in the variable.
  *
  * @param key the key to use for the variable
  * @param retriever the ValueRetriever for this variable
  * @return the constructed DiscreteNumericalVariable
  */
 private DiscreteNumericalVariable makeDiscreteNumerical(
     final String key, final ValueRetriever retriever) {
   final Category wbcWnl = new Category(new MultiSelectOption("WNL"), 11.0f, true);
   final Category wbcHigh =
       new Category(new MultiSelectOption(">11.0"), Float.POSITIVE_INFINITY, false);
   final DiscreteNumericalVariable var =
       new DiscreteNumericalVariable(
           "Generic Display Name",
           SampleModels.labVariableGroup(),
           ImmutableSet.of(wbcWnl, wbcHigh),
           key);
   var.setValidRange(new NumericalRange(2.0f, true, 50.0f, true));
   var.setUnits("generic units");
   var.setRetriever(retriever);
   return var;
 }