@Test public void evaluate_shouldDetermineWhetherPatientsAreNotOnArt() throws Exception { List<Integer> ptIds = Arrays.asList(6, 7); CalculationResultMap resultMap = Context.getService(PatientCalculationService.class).evaluate(ptIds, new EligibleForMchmsProgramCalculation()); Assert.assertThat((Boolean) resultMap.get(6).getValue(), is(false)); Assert.assertThat((Boolean) resultMap.get(7).getValue(), is(true)); }
@Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { CalculationResultMap ret = new CalculationResultMap(); CalculationResultMap genders = Calculations.genders(cohort, context); for (int ptId : cohort) { boolean eligible = "F".equals(genders.get(ptId).getValue()); ret.put(ptId, new BooleanResult(eligible, this)); } return ret; }
EligibleForMchmsProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { CalculationResultMap ret = new CalculationResultMap(); CalculationResultMap genders = Calculations.genders(cohort, context); for (int ptId : cohort) { boolean eligible = "F".equals(genders.get(ptId).getValue()); ret.put(ptId, new BooleanResult(eligible, this)); } return ret; } }
EligibleForMchmsProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { CalculationResultMap ret = new CalculationResultMap(); CalculationResultMap genders = Calculations.genders(cohort, context); for (int ptId : cohort) { boolean eligible = "F".equals(genders.get(ptId).getValue()); ret.put(ptId, new BooleanResult(eligible, this)); } return ret; }  }
EligibleForMchmsProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { CalculationResultMap ret = new CalculationResultMap(); CalculationResultMap genders = Calculations.genders(cohort, context); for (int ptId : cohort) { boolean eligible = "F".equals(genders.get(ptId).getValue()); ret.put(ptId, new BooleanResult(eligible, this)); } return ret; }  @Override CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context); }
EligibleForMchmsProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { CalculationResultMap ret = new CalculationResultMap(); CalculationResultMap genders = Calculations.genders(cohort, context); for (int ptId : cohort) { boolean eligible = "F".equals(genders.get(ptId).getValue()); ret.put(ptId, new BooleanResult(eligible, this)); } return ret; }  @Override CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context);  }