Several places in the Reference Application allow you to provide a logical expression that determines whether an App or Extension is displayed. (For example, require under Manage Apps, or Show If on Manage Forms.)
These allow the administrator to provide a snippet of JavaScript that will be evaluated against a given ContextModel that reflects the state of the app at that given time.
Where Conditional Includes are Supported
Home Page Apps
When adding an App to the home screen (see System Administration: Manage Apps) you have access to a require property, whose ContextModel contains sessionContext.
Example: (only shows this app if the user logged in with the Outpatient Clinic session location)
sessionContext.sessionLocation.uuid == '58c57d25-8d39-41ab-8422-108a0c277d98'
Patient Summary and Visit Dashboard
The Patient screen has two list of available actions: one for General Actions, another for Current Visit Actions (if there is an active visit). When viewing a specific visit, you have access to Visit Actions. When you add a custom form (see Configure Metadata: Manage Forms) this is added as a Visit Action.
General Actions have patient available in the context.
Current Visit Actions and Visit Actions have patient and visit available in the context.
Example: (only show this form for inpatients)
visit.admitted
Available Properties
sessionContext
Properties available:
- currentUser
- currentProvider
- sessionLocation
See this code for full details.
patient
Properties available:
- uuid
- person (see below)
See this code for full details.
person
Properties available:
- uuid
- birthdate
- birthdateEstimated
- gender
- dead
See this code for full details.
visit
Properties available:
- uuid
- active
- admitted
- startDatetimeInMilliseconds
- stopDatetimeInMilliseconds
- stopDatetime
See this code for full details.