use of org.openmrs.module.reporting.evaluation.parameter.Parameter 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.parameter.Parameter 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.parameter.Parameter in project openmrs-module-pihcore by PIH.
the class PihCohortDefinitionLibrary method getClinicalCheckInAtLocation.
@DocumentedDefinition(value = "clinicalCheckInAtLocation")
public CohortDefinition getClinicalCheckInAtLocation() {
EncounterWithCodedObsCohortDefinition cd = new EncounterWithCodedObsCohortDefinition();
cd.addParameter(new Parameter("onOrAfter", "reporting.parameter.onOrAfter", Date.class));
cd.addParameter(new Parameter("onOrBefore", "reporting.parameter.onOrBefore", Date.class));
cd.addParameter(new Parameter("locationList", "reporting.parameter.locationList", Location.class));
cd.addEncounterType(Metadata.lookup(EncounterTypes.CHECK_IN));
cd.setConcept(conceptService.getConceptByMapping("Type of HUM visit", "PIH"));
cd.addIncludeCodedValue(conceptService.getConceptByMapping("CLINICAL", "PIH"));
return new MappedParametersCohortDefinition(cd, "onOrAfter", "startDate", "onOrBefore", "endDate", "locationList", "location");
}
use of org.openmrs.module.reporting.evaluation.parameter.Parameter in project openmrs-module-pihcore by PIH.
the class PihCohortDefinitionLibrary method getTransferInToLocationDuringPeriod.
@DocumentedDefinition(value = "transferInToLocationDuringPeriod")
public CohortDefinition getTransferInToLocationDuringPeriod() {
InpatientTransferCohortDefinition cd = new InpatientTransferCohortDefinition();
cd.addParameter(new Parameter("onOrAfter", "reporting.parameter.onOrAfter", Date.class));
cd.addParameter(new Parameter("onOrBefore", "reporting.parameter.onOrBefore", Date.class));
cd.addParameter(new Parameter("inToWard", "mirebalaisreports.parameter.inToWard", Location.class));
return new MappedParametersCohortDefinition(cd, "onOrAfter", "startDate", "onOrBefore", "endDate", "inToWard", "location");
}
use of org.openmrs.module.reporting.evaluation.parameter.Parameter in project openmrs-module-pihcore by PIH.
the class BaseObsDataSetManager method constructDataSet.
public DataSetDefinition constructDataSet() {
ObsDataSetDefinition dsd = new ObsDataSetDefinition();
dsd.addParameter(new Parameter("startDate", "mirebalaisreports.parameter.startDate", Date.class));
dsd.addParameter(new Parameter("endDate", "mirebalaisreports.parameter.endDate", Date.class));
// Rows defined as patients who had an encounter of the configured types during the given period
dsd.addRowFilter(Mapped.mapStraightThrough(new PatientObsQuery(cohortQueries.getExcludeTestPatients())));
dsd.addRowFilter(Mapped.mapStraightThrough(obsQueries.getObsDuringPeriod(getQuestionConcepts())));
// Define columns
addPrimaryIdentifierColumns(dsd);
addPatientNameColumns(dsd);
addBirthDateAndAgeColumns(dsd);
addGenderColumns(dsd);
addCoreEncounterColumns(dsd);
addAddressColumns(dsd);
addPersonAttributeColumns(dsd);
addObsColumns(dsd);
return dsd;
}
Aggregations