This document describes the design changes to be made to OpenMRS App Framework for it to be able to support the OpenMRS reference application.
The purpose of the AppFramework module is to act as a) a source of all the apps in the system and b) a way to define news apps in the system through modules or via implementations. It thus provides simple classes/configuration through which other modules can specify apps that they want to define and an API through which these apps and their configuration can be queried. Apps can also define a set of extension points than can be used to enhance their functionality.
This module is expected to be used by User Interface modules to define the apps in the system and by the reference application to draw the apps and their extensions.
App - An app in the context of OpenMRS is an independent functional entity that provides a certain amount of user functionality that is separately installable/upgradeable. In the context of the App Framework, an app is a representation that points to a URL which contains the entire app.
ExtensionPoint - Each app exposes certain points (denoted by simple string ids) that it can be enhanced at. Other modules/implementations can then write/specify these extensions. An extension point is what links extensions and an app together.
ContextModel - Each app provides a certain context in the form of a set of parameters which can be used by its extensions. It essentially provides the state information of the app so that it can then be used by the extension to do something useful. This state is passed to the rendering of the app as a map and the renderer can display the app accordingly.
Extension - An extension is a small piece of configuration that can be defined external to the apps so as to enhance their functionality. It can also be used to integrate different apps together by implementers via configuration in a manner that the users of the app might not have expected.
On patient dashboard App, there are 2 extension points
- show global patient actions
- show actions for patient for active visit
On XRay Order App, there is 1 extension point
- to quickly show patient information
On patient dashboard app, an extension is added
- to order an X-Ray directly
On X-Ray order app, an extension is added
- return back to current patient
There would be a user specific copy of these APIs as well, read more here.
Extensions can specify rules which decide at runtime whether they are displayed or not. Some examples below.
<rule>context.isOpdAvailable() && patient.checkedIn == true</rule>
<rule>globalcontext.sessionLocation.name == 'Outpatient' && appcontext.activeVisitId != null</rule>
activeVisitId != null
BeanShell - http://www.beanshell.org/intro.html