Package org.openmrs.logic

The OpenMRS Logic Service provides access to granular and derived data.


Interface Summary
LogicCriteria Used to create a hierarchical representation of a criteria (e.g., similar to a parse tree).
LogicExpression LogicExpression is an internal representation of the LogicCriteria created through LogicService.
LogicService The Logic Service provides a mechanism for both registering and consuming business logic in the form of logic rules.
Rule Base class for all logic rules.

Class Summary
Duration Represents a duration of time — e.g., one year, two weeks, or 18 months.
LogicTransform LogicTransform is internal representation of the transformation applied to the LogicCriteria

count() will apply the Count operator and return the total number of Result instead of the Result itself first(2) will apply the First operator and return the first two Result out of the entire Result

Enum Summary

Exception Summary
LogicException Logic-specific exception

Package org.openmrs.logic Description

The OpenMRS Logic Service provides access to granular and derived data. Medical data is extremely complex. While a dictionary-based system provides tremendous flexibility in collecting data, consuming the data for decision support, reporting, research question, or even for display within the web application can be increasingly difficult. For example, even answering a simple question like "is the patient HIV positive?" may require a complex algorithm that considers the results of multiple lab results, temporal relations of results, orders, and questionnaire responses. Ideally, this "business logic" is defined in one place and easily accessible to all aspects of the system — e.g., whether we're displaying HIV status on a web page, generating a PEPFAR report, or executing a decision support alert, the same algorithm should be used. We call this bit of business knowledge a "rule." Rules should be easily accessible and return predictable and flexible results.

Rules can be fashioned from just about any source, but must compile into a Java class that extends org.openmrs.logic.Rule (@see org.openmrs.logic.Rule).

Data can be obtained from the logic service like this:

Patient myPatient = Context.getPatientService().getPatient(123); LogicService ls = Context.getLogicService(); Result age = ls.eval(myPatient, "AGE");


Generated Apr 27 2012 10:06 PM. NOTE - these libraries are in active development and subject to change