use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class AdmissionSoonAfterExitCohortDefinitionEvaluatorTest method testEvaluate.
@Test
public void testEvaluate() throws Exception {
Date startDate = DateUtil.parseDate("2013-10-03 00:00:00", "yyyy-MM-dd HH:mm:ss");
Date endDate = DateUtil.parseDate("2013-10-03 23:59:59", "yyyy-MM-dd HH:mm:ss");
AdmissionSoonAfterExitCohortDefinition definition = new AdmissionSoonAfterExitCohortDefinition();
definition.setOnOrAfter(startDate);
definition.setOnOrBefore(endDate);
EvaluatedCohort result = cohortDefinitionService.evaluate(definition, new EvaluationContext());
assertThat(result, isCohortWithExactlyIds(patient3.getId()));
}
use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class DiagnosisCohortDefinitionEvaluatorTest method testEvaluateByAnyCoded.
@Test
public void testEvaluateByAnyCoded() throws Exception {
createDiagnosisObs();
DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
cd.setIncludeAllCodedDiagnoses(true);
EvaluatedCohort cohort = evaluator.evaluate(cd, new EvaluationContext());
assertThat(cohort, hasExactlyIds(2, 6));
}
use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class DiagnosisCohortDefinitionEvaluatorTest method testEvaluateSimple.
@Test
public void testEvaluateSimple() throws Exception {
DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
EvaluatedCohort cohort = evaluator.evaluate(cd, new EvaluationContext());
assertThat(cohort.size(), is(0));
assertThat((DiagnosisCohortDefinition) cohort.getDefinition(), is(cd));
createDiagnosisObs();
cd = new DiagnosisCohortDefinition();
cohort = evaluator.evaluate(cd, new EvaluationContext());
assertThat(cohort, hasExactlyIds(2, 6, 7));
cd.setOnOrAfter(DateUtil.parseDate("2013-01-02", "yyyy-MM-dd"));
cd.setOnOrBefore(DateUtil.parseDate("2013-01-02", "yyyy-MM-dd"));
cohort = evaluator.evaluate(cd, new EvaluationContext());
assertThat(cohort, hasExactlyIds(2));
}
use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class DiagnosisCohortDefinitionEvaluatorTest method testEvaluateByCertainty.
@Test
public void testEvaluateByCertainty() throws Exception {
createDiagnosisObs();
DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
cd.setCertainty(Diagnosis.Certainty.CONFIRMED);
cd.setCodedDiagnoses(Arrays.asList(conceptService.getConcept(9)));
EvaluatedCohort cohort = evaluator.evaluate(cd, new EvaluationContext());
assertThat(cohort, hasExactlyIds(6));
}
use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class DiagnosisCohortDefinitionEvaluatorTest method testEvaluateByOrder.
@Test
public void testEvaluateByOrder() throws Exception {
createDiagnosisObs();
DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
cd.setDiagnosisOrder(Diagnosis.Order.SECONDARY);
EvaluatedCohort cohort = evaluator.evaluate(cd, new EvaluationContext());
assertThat(cohort, hasExactlyIds(2));
}
Aggregations