Search in sources :

Example 6 with DiagnosisCohortDefinition

use of org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition in project openmrs-module-pihcore by PIH.

the class PihCohortDefinitionLibrary method getSpecificCodedDiagnosesBetweenDates.

@DocumentedDefinition(value = "specificCodedDiagnosesBetweenDates")
public DiagnosisCohortDefinition getSpecificCodedDiagnosesBetweenDates() {
    DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
    cd.addParameter(new Parameter("onOrAfter", "reporting.parameter.onOrAfter", Date.class));
    cd.addParameter(new Parameter("onOrBefore", "reporting.parameter.onOrBefore", Date.class));
    cd.addParameter(new Parameter("codedDiagnoses", "mirebalaisreports.parameter.codedDiagnoses", Concept.class, List.class, null));
    return cd;
}
Also used : Concept(org.openmrs.Concept) Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) List(java.util.List) Date(java.util.Date) DiagnosisCohortDefinition(org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 7 with DiagnosisCohortDefinition

use of org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition in project openmrs-module-pihcore by PIH.

the class DiagnosisCohortDefinitionEvaluatorTest method testEvaluateByCoded.

@Test
public void testEvaluateByCoded() throws Exception {
    createDiagnosisObs();
    DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
    cd.setCodedDiagnoses(Arrays.asList(conceptService.getConcept(9)));
    EvaluatedCohort cohort = evaluator.evaluate(cd, new EvaluationContext());
    assertThat(cohort, hasExactlyIds(6));
}
Also used : EvaluatedCohort(org.openmrs.module.reporting.cohort.EvaluatedCohort) EvaluationContext(org.openmrs.module.reporting.evaluation.EvaluationContext) DiagnosisCohortDefinition(org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition) Test(org.junit.Test) PihCoreContextSensitiveTest(org.openmrs.module.pihcore.PihCoreContextSensitiveTest)

Example 8 with DiagnosisCohortDefinition

use of org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition in project openmrs-module-pihcore by PIH.

the class DiagnosisCohortDefinitionEvaluatorTest method testEvaluateByCodedExclusions.

@Test
public void testEvaluateByCodedExclusions() throws Exception {
    createDiagnosisObs();
    DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
    cd.setExcludeCodedDiagnoses(Arrays.asList(conceptService.getConcept(9)));
    EvaluatedCohort cohort = evaluator.evaluate(cd, new EvaluationContext());
    // everyone with a coded diagnosis that isn't concept 9
    assertThat(cohort, hasExactlyIds(2));
}
Also used : EvaluatedCohort(org.openmrs.module.reporting.cohort.EvaluatedCohort) EvaluationContext(org.openmrs.module.reporting.evaluation.EvaluationContext) DiagnosisCohortDefinition(org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition) Test(org.junit.Test) PihCoreContextSensitiveTest(org.openmrs.module.pihcore.PihCoreContextSensitiveTest)

Example 9 with DiagnosisCohortDefinition

use of org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition in project openmrs-module-pihcore by PIH.

the class DiagnosisCohortDefinitionEvaluatorTest method testEvaluateByAnyNonCoded.

@Test
public void testEvaluateByAnyNonCoded() throws Exception {
    createDiagnosisObs();
    DiagnosisCohortDefinition cd = new DiagnosisCohortDefinition();
    cd.setIncludeAllNonCodedDiagnoses(true);
    EvaluatedCohort cohort = evaluator.evaluate(cd, new EvaluationContext());
    assertThat(cohort, hasExactlyIds(2, 7));
}
Also used : EvaluatedCohort(org.openmrs.module.reporting.cohort.EvaluatedCohort) EvaluationContext(org.openmrs.module.reporting.evaluation.EvaluationContext) DiagnosisCohortDefinition(org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition) Test(org.junit.Test) PihCoreContextSensitiveTest(org.openmrs.module.pihcore.PihCoreContextSensitiveTest)

Aggregations

DiagnosisCohortDefinition (org.openmrs.module.pihcore.reporting.cohort.definition.DiagnosisCohortDefinition)9 EvaluatedCohort (org.openmrs.module.reporting.cohort.EvaluatedCohort)8 Test (org.junit.Test)7 PihCoreContextSensitiveTest (org.openmrs.module.pihcore.PihCoreContextSensitiveTest)7 EvaluationContext (org.openmrs.module.reporting.evaluation.EvaluationContext)7 List (java.util.List)2 Date (java.util.Date)1 Criteria (org.hibernate.Criteria)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1 Cohort (org.openmrs.Cohort)1 Concept (org.openmrs.Concept)1 Obs (org.openmrs.Obs)1 DiagnosisMetadata (org.openmrs.module.emrapi.diagnosis.DiagnosisMetadata)1 DocumentedDefinition (org.openmrs.module.reporting.definition.library.DocumentedDefinition)1 Parameter (org.openmrs.module.reporting.evaluation.parameter.Parameter)1