I have some questions about the LogicModule:
What is the difference between a velocityTest and logicTest, besides
the different syntax? Is the one more powerful than the other, or are
they fulfilling different purposes?
And is there any documentation on the logic operators and syntax for
these tests? I found all operators in the source code under the
org.openmrs.logic.op package, but wondering whether the operators are
somewhere listed/documented (esp. for users setting up html forms).
I found a list of operators at
but it doesn't seem complete (for example: AsOf, In,
GreaterThanEquals, LessThanEquals, Average are not listed there). Also
wondering about the use of brackets. Does it work just similar to JSTL
How to add a custom rule provider?
I want to register a new token, user.roles, for which I would need a
new rule provider, UserDataSource. I want to use logic expressions in
logicTests in the html forms (includeIf, excludeIf tags),
showing/hiding information based on the current user's roles.
How to best deploy such custom data source, or hook it into the
existing system? Would/should it need to be wrapped up as a module, or
just a jar?
How are the custom rules classes to be deployed (i.e. such as the
sample rule classes mentioned on
Or would that just needed to be entered into the 'Rule Content' field
I'm not quite clear whether you write the rule in the OpenMRS Admin
section of the Logic module (i.e. Groovy syntax), or actually write
and compile a java class and deploy it somehow, i.e. a java-class
based rule as described in "Registering a Rule with Logic Service":
About the existing data sources:
When I look into the existing set of rules in the 1.8.2 demo
(demo.openmrs.org), I see that they're using the PersonDataSource, but
I can't find that class in the source code of the OpenMRS core
anymore, however, browsing on Fisheye, I see that this class existed
up to OpenMRS version 1.5.x, but not beyond.
Therefore wondering, where has this class gone, or how does 1.8.2 work
without that class, when it's defined as the rule provider in the
logic module configuration though?
I've read the pages in the wiki at
https://wiki.openmrs.org/display/docs/Logic+Service, but above
questions are still open.
To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to [hidden email] with "SIGNOFF openmrs-implement-l" in the body (not the subject) of your e-mail.
Meta Healthcare Systems Ltd.
20/F Central Tower, 28 Queen's Rd Central, Hong Kong
T +852 8199 9605, M +86 159 0208 1701, Skype: mathias.lin
I'm going to reply incompletely and quickly (rather than never getting around to replying...) See inline.
On Sun, Apr 29, 2012 at 5:47 AM, Mathias Lin | Meta Healthcare <[hidden email]> wrote:
I have some questions about the LogicModule:
Different capabilities. The velocity one leverages the same stuff that <lookup expression="..."/> does, and was originally thought of as more of a short-term solution. It is easy to add specific extra functions here if necessary just for HFE. The logic tests depend on the logic module, so as its capabilities are developed, HFE will be able to leverage that.
The logic module is being deprecated as something we bundle in OpenMRS as a "core module". It will continue to exist, and (this is speculation) its ability to let you write sophisticated rules in Arden Syntax will continue to be developed, while the syntax you're referring to (which is indeed incomplete) is unlikely to move forwards.
The strategic replacement for distribution with OpenMRS will be the Calculation module, which we just had a sprint on.
You should be able to do this by providing it via a module. Depending on whether you want to support a couple of specific queries, or you really want to be able to mix-and-match them, you might consider just writing a couple of rules in Groovy.
Option 1 = Write rules in Java in a module. I have never done this, but they need to implement Rule, and you probably need to also have a "RuleProvider". Win Ribeka may be able to give you more info on this.
Option 2 = (I suggest trying this first) is to write them in Groovy via "Rule Definitions" on your admin page, at the editRuleDefinition.form url you mention. This stores the rule definitions in your database, so if you've got a single implementation, that's fine, but if you want consistent rules to get installed on different servers, this isn't great. Choose Groovy as the language, and put the code in Rule Content. (I recommend groovy over java if you're doing it this way.) The best way to test these out as you develop them is to keep the rule definition editor in one tab, and a Test Logic Expressions page open in another tab, so each time you tweak the rule and save it, you can refresh the other tab and see if it's working.
Option 3 = write data sources, and use these in rules
It was moved to the Logic Module: http://svn.openmrs.org/openmrs-modules/logic/trunk/
The documentation around this is mediocre at best. Please let us know how you end up proceeding, and if you can distill some of what you learn into wiki page edits or comments, that would be wonderful.
[hidden email] from OpenMRS Implementers' mailing list
|Free forum by Nabble||Edit this page|