@Test public void evaluate() throws Exception { Program tbProgram = MetadataUtils.existing(Program.class, TbMetadata._Program.TB); PatientService ps = Context.getPatientService(); TestUtils.enrollInProgram(ps.getPatient(6), tbProgram, TestUtils.date(2011, 1, 1)); TestUtils.enrollInProgram(ps.getPatient(7), tbProgram, TestUtils.date(2011, 1, 1), TestUtils.date(2012, 1, 1)); List<Integer> cohort = Arrays.asList(6, 7, 8); CalculationResultMap resultMap = Context.getService(PatientCalculationService.class).evaluate(cohort, new InTbProgramCalculation()); Assert.assertTrue((Boolean) resultMap.get(6).getValue()); Assert.assertFalse((Boolean) resultMap.get(7).getValue()); Assert.assertFalse((Boolean) resultMap.get(8).getValue()); }
@Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { return passing(Calculations.activeEnrollment(MetadataUtils.existing(Program.class, TbMetadata._Program.TB), Filters.alive(cohort, context), context)); }
InTbProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { return passing(Calculations.activeEnrollment(MetadataUtils.existing(Program.class, TbMetadata._Program.TB), Filters.alive(cohort, context), context)); } }
InTbProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { return passing(Calculations.activeEnrollment(MetadataUtils.existing(Program.class, TbMetadata._Program.TB), Filters.alive(cohort, context), context)); }  }
InTbProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { return passing(Calculations.activeEnrollment(MetadataUtils.existing(Program.class, TbMetadata._Program.TB), Filters.alive(cohort, context), context)); }  @Override CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context); }
InTbProgramCalculation extends AbstractPatientCalculation { @Override public CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context) { return passing(Calculations.activeEnrollment(MetadataUtils.existing(Program.class, TbMetadata._Program.TB), Filters.alive(cohort, context), context)); }  @Override CalculationResultMap evaluate(Collection<Integer> cohort, Map<String, Object> params, PatientCalculationContext context);  }