Skip to content

Commit

Permalink
BAH-4029 | minor improvement - adding a gaurd clause to check if conc…
Browse files Browse the repository at this point in the history
…ept is numeric
  • Loading branch information
angshu committed Jul 18, 2024
1 parent 5cd4dd0 commit 4cfbb74
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ private Obs newResultObs(Order testOrder, Date obsDate, Concept concept, LabOrde
* by openmrs by the {@link org.openmrs.validator.ObsValidator} during save
*/
private void checkResultRangesForAbsolutes(Obs obs, String accessionUuid) {
if (obs.getConcept().isNumeric()) {
if (obs.getValueNumeric() != null) {
ConceptNumeric cn = (ConceptNumeric) obs.getConcept();
if (cn.getHiAbsolute() != null && cn.getHiAbsolute() < obs.getValueNumeric()) {
log.error(String.format("Test results for [%s] is beyond the absolute high range, in Accession [%s]", cn.getName(), accessionUuid));
}
if (cn.getLowAbsolute() != null && cn.getLowAbsolute() > obs.getValueNumeric()) {
log.error(String.format("Test results for [%s] is beyond the absolute low range, in Accession [%s]", cn.getName(), accessionUuid));
}
if (!obs.getConcept().isNumeric()) {
return;
}
if (obs.getValueNumeric() != null) {
ConceptNumeric cn = (ConceptNumeric) obs.getConcept();
if (cn.getHiAbsolute() != null && cn.getHiAbsolute() < obs.getValueNumeric()) {
log.error(String.format("Test results for [%s] is beyond the absolute high range, in Accession [%s]", cn.getName(), accessionUuid));
}
if (cn.getLowAbsolute() != null && cn.getLowAbsolute() > obs.getValueNumeric()) {
log.error(String.format("Test results for [%s] is beyond the absolute low range, in Accession [%s]", cn.getName(), accessionUuid));
}
}
}
Expand Down

0 comments on commit 4cfbb74

Please sign in to comment.