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()));
}
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()));
}
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());
}
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));
}
Aggregations