Groovy Scripts are used as extension scripts that can be executed when a particular event is triggered.
Some of the events can be
For any groovy script the following are configurable
Different types of groovy scripts that can be configured are
File Name | Location and Example File | Note |
---|---|---|
BahmniObsValueCalculator.groovy |
|
|
TreatmentRegimenExtension.groovy |
|
|
The bahmni.executeGroovyObsValueCalculator global property can be used to enable/disable groovy obs value calculation on consultation save. This property, when disabled, will increase the overall response time of consultation save. The default value is set to true. |
If One Configures, DstExtension.groovy under ObsToObsFlowSheet Control (Refer Sample Config), then the groovy is executed while the control (ObsToObsFlowSheet Control) is displayed. |
Configuration | Location and Example | Note |
---|---|---|
Add the groovy extension name as value of key "type" under the configuration section of ObsToObsFlowSheet Control |
|
|
One way to debug groovy scripts during development is to write statements to a temporary file, e.g., in BahmniObsValueCalculator.groovy, use the snippet below. groovy_debug.txt should be writable. Make sure to remove debugging statements and temporary file before deployment.
def file1 = new File(OpenmrsUtil.getApplicationDataDirectory() + "obscalculator/groovy_debug.txt")
file1.append 'debugging statement\n'