Configure Orderset rules
Purpose
Orderset rules to be applied to calculate the dosage that can vary from implementation to implementation. To facilitate that, Rules engine is designed with extensibility in mind. By default Bahmni provides two rules "mg/kg" and "mg/m2" out of the box and these rules can also be configured with the help of csv file. Please check link for further information.
Extending rules engine with new rules:
Rules engine can be extended by writing appropriate groovy scripts and deploying at rules engine folder. Rules engine does nothing but transferring calls to its appropriate dosage calculator rule. Dosage calculator rule should adhere to the following interface in order to pickup automatically by the rules engine and apply the calculation.
public interface DosageRule {
Dose calculateDose(DosageRequest request) throws Exception ;
}A sample groovy rule:
The following groovy rule is only for illustration purpose. Write a groovy class implementing DosageRule interface and attribute the class with "RuleName" attribute to assign a name for this particular rule. Rule assigned here will automatically populated at the drug order set creation Rules dropdown. If No rule name is assigned using "RuleName" attribute, then class name will be chosen as the rule name by default.
After writing the rule, the same has to be deployed in the appropriate place for the rule engine to pickup automatically.
Bahmni Wiki · CC BY-SA 4.0