Search in sources :

Example 1 with BmiEncounterDataDefinition

use of org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class BmiEncounterDataEvaluatorTest method shouldReturnNullIfNoWeight.

@Test
public void shouldReturnNullIfNoWeight() throws Exception {
    EncounterBuilder eb = data.encounter();
    eb.patient(createPatient());
    eb.encounterDatetime(DateUtil.getDateTime(2015, 4, 15));
    eb.location(Metadata.lookup(MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL));
    eb.encounterType(Metadata.lookup(EncounterTypes.VITALS));
    eb.obs(Metadata.getConcept("PIH:WEIGHT (KG)"), 45.4);
    Encounter enc = eb.save();
    EncounterEvaluationContext context = new EncounterEvaluationContext();
    context.setBaseEncounters(new EncounterIdSet(enc.getEncounterId()));
    EvaluatedEncounterData res = encounterDataService.evaluate(new BmiEncounterDataDefinition(), context);
    assertNull(res.getData().get(enc.getEncounterId()));
}
Also used : EncounterBuilder(org.openmrs.contrib.testdata.builder.EncounterBuilder) EncounterEvaluationContext(org.openmrs.module.reporting.evaluation.context.EncounterEvaluationContext) EncounterIdSet(org.openmrs.module.reporting.query.encounter.EncounterIdSet) Encounter(org.openmrs.Encounter) EvaluatedEncounterData(org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData) BmiEncounterDataDefinition(org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition) Test(org.junit.Test) BaseReportTest(org.openmrs.module.pihcore.reporting.BaseReportTest)

Example 2 with BmiEncounterDataDefinition

use of org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class BmiEncounterDataEvaluatorTest method shouldReturnNullIfNoHeight.

@Test
public void shouldReturnNullIfNoHeight() throws Exception {
    EncounterBuilder eb = data.encounter();
    eb.patient(createPatient());
    eb.encounterDatetime(DateUtil.getDateTime(2015, 4, 15));
    eb.location(Metadata.lookup(MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL));
    eb.encounterType(Metadata.lookup(EncounterTypes.VITALS));
    eb.obs(Metadata.getConcept("PIH:HEIGHT (CM)"), 152.4);
    Encounter enc = eb.save();
    EncounterEvaluationContext context = new EncounterEvaluationContext();
    context.setBaseEncounters(new EncounterIdSet(enc.getEncounterId()));
    EvaluatedEncounterData res = encounterDataService.evaluate(new BmiEncounterDataDefinition(), context);
    assertNull(res.getData().get(enc.getEncounterId()));
}
Also used : EncounterBuilder(org.openmrs.contrib.testdata.builder.EncounterBuilder) EncounterEvaluationContext(org.openmrs.module.reporting.evaluation.context.EncounterEvaluationContext) EncounterIdSet(org.openmrs.module.reporting.query.encounter.EncounterIdSet) Encounter(org.openmrs.Encounter) EvaluatedEncounterData(org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData) BmiEncounterDataDefinition(org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition) Test(org.junit.Test) BaseReportTest(org.openmrs.module.pihcore.reporting.BaseReportTest)

Example 3 with BmiEncounterDataDefinition

use of org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class VitalsDataSetManager method addObsColumns.

@Override
protected void addObsColumns(EncounterDataSetDefinition dsd) {
    addObsColumn(dsd, "WEIGHT_KG", "PIH:WEIGHT (KG)", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "HEIGHT_CM", "PIH:HEIGHT (CM)", converters.getObsValueNumericConverter());
    addColumn(dsd, "BMI", new BmiEncounterDataDefinition(), null);
    addObsColumn(dsd, "MUAC", "PIH:MIDDLE UPPER ARM CIRCUMFERENCE (MM)", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "TEMP_C", "PIH:TEMPERATURE (C)", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "HEART_RATE", "PIH:PULSE", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "RESP_RATE", "PIH:RESPIRATORY RATE", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "SYS_BP", "PIH:SYSTOLIC BLOOD PRESSURE", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "DIA_BP", "PIH:DIASTOLIC BLOOD PRESSURE", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "O2_SAT", "PIH:BLOOD OXYGEN SATURATION", converters.getObsValueNumericConverter());
    addObsColumn(dsd, "CHIEF_COMPLAINT", "CIEL:160531", converters.getObsValueTextConverter());
}
Also used : BmiEncounterDataDefinition(org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition)

Example 4 with BmiEncounterDataDefinition

use of org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class BmiEncounterDataEvaluatorTest method shouldCalculateBmi.

@Test
public void shouldCalculateBmi() throws Exception {
    EncounterBuilder eb = data.encounter();
    eb.patient(createPatient());
    eb.encounterDatetime(DateUtil.getDateTime(2015, 4, 15));
    eb.location(Metadata.lookup(MirebalaisLocations.CDI_KLINIK_EKSTEN_JENERAL));
    eb.encounterType(Metadata.lookup(EncounterTypes.VITALS));
    eb.obs(Metadata.getConcept("PIH:WEIGHT (KG)"), 45.4);
    eb.obs(Metadata.getConcept("PIH:HEIGHT (CM)"), 152.4);
    Encounter enc = eb.save();
    EncounterEvaluationContext context = new EncounterEvaluationContext();
    context.setBaseEncounters(new EncounterIdSet(enc.getEncounterId()));
    EvaluatedEncounterData res = encounterDataService.evaluate(new BmiEncounterDataDefinition(), context);
    assertThat((Double) res.getData().get(enc.getEncounterId()), is(19.5));
}
Also used : EncounterBuilder(org.openmrs.contrib.testdata.builder.EncounterBuilder) EncounterEvaluationContext(org.openmrs.module.reporting.evaluation.context.EncounterEvaluationContext) EncounterIdSet(org.openmrs.module.reporting.query.encounter.EncounterIdSet) Encounter(org.openmrs.Encounter) EvaluatedEncounterData(org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData) BmiEncounterDataDefinition(org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition) Test(org.junit.Test) BaseReportTest(org.openmrs.module.pihcore.reporting.BaseReportTest)

Aggregations

BmiEncounterDataDefinition (org.openmrs.module.pihcore.reporting.encounter.definition.BmiEncounterDataDefinition)4 Test (org.junit.Test)3 Encounter (org.openmrs.Encounter)3 EncounterBuilder (org.openmrs.contrib.testdata.builder.EncounterBuilder)3 BaseReportTest (org.openmrs.module.pihcore.reporting.BaseReportTest)3 EvaluatedEncounterData (org.openmrs.module.reporting.data.encounter.EvaluatedEncounterData)3 EncounterEvaluationContext (org.openmrs.module.reporting.evaluation.context.EncounterEvaluationContext)3 EncounterIdSet (org.openmrs.module.reporting.query.encounter.EncounterIdSet)3