Search in sources :

Example 1 with Parameter

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()));
}
Also used : InpatientLocationCohortDefinition(org.openmrs.module.pihcore.reporting.cohort.definition.InpatientLocationCohortDefinition) Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) EvaluatedCohort(org.openmrs.module.reporting.cohort.EvaluatedCohort) EvaluationContext(org.openmrs.module.reporting.evaluation.EvaluationContext) Date(java.util.Date) Location(org.openmrs.Location) BaseInpatientReportTest(org.openmrs.module.pihcore.reporting.BaseInpatientReportTest) Test(org.junit.Test)

Example 2 with Parameter

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()));
}
Also used : InpatientLocationCohortDefinition(org.openmrs.module.pihcore.reporting.cohort.definition.InpatientLocationCohortDefinition) Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) EvaluatedCohort(org.openmrs.module.reporting.cohort.EvaluatedCohort) EvaluationContext(org.openmrs.module.reporting.evaluation.EvaluationContext) Date(java.util.Date) Location(org.openmrs.Location) BaseInpatientReportTest(org.openmrs.module.pihcore.reporting.BaseInpatientReportTest) Test(org.junit.Test)

Example 3 with Parameter

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");
}
Also used : Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) EncounterWithCodedObsCohortDefinition(org.openmrs.module.reporting.cohort.definition.EncounterWithCodedObsCohortDefinition) Date(java.util.Date) Location(org.openmrs.Location) MappedParametersCohortDefinition(org.openmrs.module.reporting.cohort.definition.MappedParametersCohortDefinition) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 4 with Parameter

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");
}
Also used : Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) InpatientTransferCohortDefinition(org.openmrs.module.pihcore.reporting.cohort.definition.InpatientTransferCohortDefinition) Date(java.util.Date) Location(org.openmrs.Location) MappedParametersCohortDefinition(org.openmrs.module.reporting.cohort.definition.MappedParametersCohortDefinition) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 5 with Parameter

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;
}
Also used : ObsDataSetDefinition(org.openmrs.module.reporting.dataset.definition.ObsDataSetDefinition) PatientObsQuery(org.openmrs.module.reporting.query.obs.definition.PatientObsQuery) Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) Date(java.util.Date)

Aggregations

Parameter (org.openmrs.module.reporting.evaluation.parameter.Parameter)12 Date (java.util.Date)11 Location (org.openmrs.Location)7 MappedParametersCohortDefinition (org.openmrs.module.reporting.cohort.definition.MappedParametersCohortDefinition)6 DocumentedDefinition (org.openmrs.module.reporting.definition.library.DocumentedDefinition)6 Test (org.junit.Test)2 BaseInpatientReportTest (org.openmrs.module.pihcore.reporting.BaseInpatientReportTest)2 DiedSoonAfterEncounterCohortDefinition (org.openmrs.module.pihcore.reporting.cohort.definition.DiedSoonAfterEncounterCohortDefinition)2 InpatientLocationCohortDefinition (org.openmrs.module.pihcore.reporting.cohort.definition.InpatientLocationCohortDefinition)2 InpatientTransferCohortDefinition (org.openmrs.module.pihcore.reporting.cohort.definition.InpatientTransferCohortDefinition)2 EvaluatedCohort (org.openmrs.module.reporting.cohort.EvaluatedCohort)2 EvaluationContext (org.openmrs.module.reporting.evaluation.EvaluationContext)2 List (java.util.List)1 BaseMatcher (org.hamcrest.BaseMatcher)1 Description (org.hamcrest.Description)1 Concept (org.openmrs.Concept)1 DiagnosisCohortDefinition (org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition)1 LastDispositionBeforeExitCohortDefinition (org.openmrs.module.pihcore.reporting.cohort.definition.LastDispositionBeforeExitCohortDefinition)1 EncounterCohortDefinition (org.openmrs.module.reporting.cohort.definition.EncounterCohortDefinition)1 EncounterWithCodedObsCohortDefinition (org.openmrs.module.reporting.cohort.definition.EncounterWithCodedObsCohortDefinition)1