use of org.openmrs.module.reporting.evaluation.EvaluationContext 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));
}
use of org.openmrs.module.reporting.evaluation.EvaluationContext in project openmrs-module-pihcore by PIH.
the class InpatientLocationCohortDefinitionEvaluatorTest method testEvaluate.
@Test
public void testEvaluate() throws Exception {
InpatientLocationCohortDefinition definition = new InpatientLocationCohortDefinition();
definition.addParameter(new Parameter("ward", "Ward", Location.class));
definition.addParameter(new Parameter("effectiveDate", "Date", Date.class));
Location womensInternalMedicine = Metadata.lookup(MirebalaisLocations.WOMENS_INTERNAL_MEDICINE);
EvaluationContext ec = new EvaluationContext();
ec.addParameterValue("ward", womensInternalMedicine);
ec.addParameterValue("effectiveDate", DateUtil.parseDate("2013-10-03", "yyyy-MM-dd"));
EvaluatedCohort result = cohortDefinitionService.evaluate(definition, ec);
assertThat(result, isCohortWithExactlyIds(patient1.getId(), patient5.getId()));
}
use of org.openmrs.module.reporting.evaluation.EvaluationContext in project openmrs-module-pihcore by PIH.
the class InpatientLocationCohortDefinitionEvaluatorTest method testThatTransferOutsAreNotIncluded.
@Test
public void testThatTransferOutsAreNotIncluded() throws Exception {
InpatientLocationCohortDefinition definition = new InpatientLocationCohortDefinition();
definition.addParameter(new Parameter("ward", "Ward", Location.class));
definition.addParameter(new Parameter("effectiveDate", "Date", Date.class));
Location womensInternalMedicine = Metadata.lookup(MirebalaisLocations.WOMENS_INTERNAL_MEDICINE);
EvaluationContext ec = new EvaluationContext();
ec.addParameterValue("ward", womensInternalMedicine);
Date endOfDay = DateUtil.parseDate("2013-10-03 23:59:59", "yyyy-MM-dd HH:mm:ss");
ec.addParameterValue("effectiveDate", endOfDay);
EvaluatedCohort result = cohortDefinitionService.evaluate(definition, ec);
assertThat(result, isCohortWithExactlyIds(patient1.getId()));
}
use of org.openmrs.module.reporting.evaluation.EvaluationContext in project openmrs-module-pihcore by PIH.
the class InpatientTransferCohortDefinitionEvaluatorTest method testEvaluateTransferIn.
@Test
public void testEvaluateTransferIn() throws Exception {
Location surgicalWard = Metadata.lookup(MirebalaisLocations.SURGICAL_WARD);
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");
InpatientTransferCohortDefinition definition = new InpatientTransferCohortDefinition();
definition.setOnOrAfter(startDate);
definition.setOnOrBefore(endDate);
definition.setInToWard(surgicalWard);
EvaluatedCohort result = cohortDefinitionService.evaluate(definition, new EvaluationContext());
assertThat(result, isCohortWithExactlyIds(patient5.getId()));
}
use of org.openmrs.module.reporting.evaluation.EvaluationContext in project openmrs-module-pihcore by PIH.
the class PersonAuditInfoCohortDefinitionEvaluatorTest method testEvaluateWithNoParameters.
@Test
public void testEvaluateWithNoParameters() throws Exception {
PersonAuditInfoCohortDefinition cd = new PersonAuditInfoCohortDefinition();
EvaluatedCohort actual = evaluator.evaluate((CohortDefinition) cd, new EvaluationContext());
assertThat(actual, hasExactlyIds(2, 6, 7, 8));
}
Aggregations