Logic Module
The logic module is a core module that provides the implementation of the OpenMRS logic service. The majority of the logic service implementation was moved into this module so that the logic service could evolve at a separate pace from the OpenMRS application. OpenMRS cannot run without this module installed.
For further details about the logic service, please refer to the Logic Service page.
Download
Download the logic omod file from the module repository:Â https://addons.openmrs.org/#/show/org.openmrs.module.logic
View/download the source code from git: Â https://github.com/CHIRDL-Openmrs-Modules/logic
Logic Module Release Notes
0.5.0.1
The purpose of this version was to have a version of logic that doesn't declare an upper bound on its allowed OpenMRS version. (0.5 only works up to OpenMRS 1.8.*, so it can't be used with OpenMRS 1.9...)
It includes a few other tickets whose code had already been committed:
LOGIC-92 - indexDate needs to be inclusive (tmdugan)
LOGIC-94 - Check the cache for a Rule before accessing token registration information from the database (sjmckee)
LOGIC-95 - Remove the support of finding concepts by ID. Logic is currently only finding them by name (sjmckee)
0.5
This version allows you to define rules in Groovy or Java and save them to the database (see User-defined Rules), has a better UI for managing tokens and rules, and has significant performance improvements when running rules on large cohorts.
Requirements
This version of the module works with the following OpenMRS versions:
in the 1.8.x line: any version after 1.8 Beta (from revision 17709)
in the 1.7.x line: from 1.7.2 (from revision 17710)
in the 1.6.x line: from 1.6.3 (from revision 17711 – use this custom version, identical to the one in the module repository but with a more relaxed require_version.)
User-visible changes
Ticket | Description |
---|---|
Implement asOf() operator for LogicCriteria | |
Edit / Remove Logic Token | |
Make logic module compatible with 1.6+ and replace Derived Concept with LogicRule | |
Patient data source of patient identifier is not implemented | |
PersonDataSource should let you access ther person's name | |
Tokens should be case-preserving case-insensitive | |
Better UI for managing logic tokens and rules | |
Groovy rules |
Under-the-hood changes
Ticket | Description |
---|---|
Logic Module contains antlr-2.7.6 in its lib folder | |
Logic Rule Token needs a uuid | |
LogicDataSources have their names defined in XML | |
LogicService.eval(..., String, ...) should treat the String as an expression, not a token | |
LogicContext's indexDate operates as a date+time, but it should just operate as a date | |
Logic cache never has any cache hits | |
Rename LogicRuleToken to TokenRegistration | |
Introduce a RuleProvider interface so modules can consistently provide and register rules | |
Allow modules to register LanguageHandlers via Spring | |
Allow users to change names of tokens, while still allowing RuleProviders to access their rules | |
Call afterStartup methods of RuleProviders after the logic module starts up | |
TokenService should cache rules it gets from RuleProviders, so they don't have to be recompiled every time | |
Rules have access to a full Patient, but LogicDataSources don't |
0.4.1
Ticket | Description | Author |
---|---|---|
LogicService.parse(String) on a badly-formed expression may run forever | djazayeri |