use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateByCreationDetails.
@Test
public void testEvaluateByCreationDetails() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setCreatedOnOrAfter(DateUtil.parseDate("2005-09-22", "yyyy-MM-dd"));
cd.setCreatedOnOrBefore(DateUtil.parseDate("2005-09-22", "yyyy-MM-dd"));
cd.setCreatedByUsers(Arrays.asList(userService.getUser(1)));
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(2));
}
use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateByChangedDetails.
// ignoring this pending resolution of: https://issues.openmrs.org/browse/TRUNK-5691
@Test
@Ignore
public void testEvaluateByChangedDetails() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setChangedOnOrAfter(DateUtil.parseDate("2008-08-18 12:25", "yyyy-MM-dd HH:mm"));
cd.setChangedOnOrBefore(DateUtil.parseDate("2008-08-18 12:26", "yyyy-MM-dd HH:mm"));
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(6, 7));
}
use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateIncludingVoided.
@Test
public void testEvaluateIncludingVoided() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setIncludeVoided(true);
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(2, 6, 7, 8, 432, 999));
}
use of org.openmrs.module.reporting.cohort.EvaluatedCohort in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateByVoidedDetails.
@Test
public void testEvaluateByVoidedDetails() throws Exception {
Date today = DateUtil.getStartOfDay(new Date());
// in standardTestDataset.xml patient 999 is voided, but has no dateVoided. Fix this
Patient voidedPatient = patientService.getPatient(999);
voidedPatient.addName(new PersonName("A", "Non-voided", "Name"));
patientService.voidPatient(voidedPatient, "testing");
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
cd.setIncludeVoided(true);
cd.setVoidedOnOrAfter(today);
cd.setVoidedOnOrBefore(today);
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(999));
}
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()));
}
Aggregations