Wiki cleanup in progress: If you're having trouble finding something, read these tips.

Groovy Module

Overview

This module was created as a proof of concept (for embedding Groovy into OpenMRS) and to serve as a base module for other modules that want to use Groovy scripting as well.

For a quick overview of some of the cool groovy features, see this spring source training video

Setup

Download and install the Groovy module omod file from the module repository.

Usage

Find and click on the Groovy Scripting Form link within the Groovy Module section of OpenMRS' administration page. You should be taken to a simple web form with a single textarea followed by a "GO" button. Type any valid Groovy script into the textarea and click the button to execute the script.

Some variables are automatically provided (most of these represent the API service):

  • cohort
  • concept
  • encounter
  • form
  • locale
  • logic
  • obs
  • patient
  • person
  • user

List 100 concepts?

Display some encounters?

Display some observations

Search for patients by name

Manage modules

A more complex example

java.lang.ClassFormatError: Invalid method Code length 82342 in class file Script1

Solution: Java only allows methods that are 64K long. Reduce the size of your groovy script.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.