Template Language

From $1

Synapse EMR uses a simple template language to build graphical objects ( known as widgets ) which are displayed on screen.  The user interacts with these widgets with the keyboard and mouse, and the data so captured is then either:

  • entered into the consultation note as text
  • used to calculate the value from the values of other widgets eg. Framingham CVS calculator
  • posted into a database eg. outcomes data.

Furthermore, widgets may be prefilled with data from the patients record such as their existing diagnoses, gender, drugs etc.

The source for all of the templates can be found in the Settings/GUI Templates screen, and users can either modify the existing templates, or, create their own.  The purpose of this document is to provide enough information for users to create their own templates.  Templates can then be shared online in the template Online Library.

The two main areas to be covered include how widgets are displayed on screen, and how the captured data is then processed.

Screen Display

The template language is infact almost identical to the language used to create Synapse EMR's own GUI.  It is called RebGUI, and full documentation can be found on the principal author's website at http://www.dobeash.com/RebGUI/user-guide.html  .  There are some features which have been disabled and new ones added principally to control the text generation.

Absolute Positioning

The simplest way to place a widget on screen is to use absolute positioning.  Now the co-ordinate system is with 0x0 ( this is known as a pair; we do not use algebraic notation such as 0,0 ) at the left top corner.  So, to place a widget near the top left we can do the following:

at 10x0 slabel "Sciatic nerve stretch test"

which gives the following display. 

./simple label.png

 

Tip: IMPORTANT: click here to see how you can learn "Template Code" by entering code bits into Synapse.

You will note that there is a default margin of 4x4, and then the text is indented to the right by another 10 units.  So, our label is really at 14x4 in our coordinate system.

We can specify other characteristics of our label such as size and colour by following the above with these values.

at 10x0 slabel "Sciatic nerve stretch test" red 60

giving the following appearance.

./coloured label.png

Relative Positioning

 Now we can place our next widget using the absolute positioning technique above, or we can take advantage of the default relative positioning when no absolute positioning is used.  In essence, a widget is placed to the right of the last widget, and separated by some default spacing when absolute positioning is not specified.

at 10x0 slabel "Sciatic nerve stretch test" red 60 field

./relative positioning 1.png

Now say we want our next widget to got to the line below.  We can specify this using absolute positioning like

at 0x0 slabel "Sciatic nerve stretch test" red 60 field
at 0x5 slabel "Femoral nerve stretch test" red 60 field

or, we can use the keyword return which tells the layout engine to put the widget one line below and as far left as it can.

at 0x0 slabel "Sciatic nerve stretch test" red 60 field return
slabel "Femoral nerve stretch test" red 60 field

./return.png

Now this doesn't give us the exact display in both cases as the relative method will use various default spacing that is operative at the time.  The absolute method above will produce a layout with very little vertical space as it only specified 5 units of y descent from the top of the widget above. This of course can be changed.

But the point of using relative positioning is that if you need to change the widgets by adding in another one in the middle of the layout, it should work with no problems, whereas with absolute positioning, you would have to recalculate manually the new locations.

You can read about the other directives to control spacing, and layout at the Dobeash site mentioned above, and these include: after, tight, margin, #L#V, space, reverse, indent, and pad

Widget List and other control words

Standard RebGUI Widgets

  • area
  • check-group
  • edit-list
  • field
  • group-box
  • label
  • radio-group
  • table
  • text
  • field

radio-group

The radio-group widget is a structure that only accepts a single input via mouse click.  Although there is more than one area to select, those areas are deselected in a mutually exclusive fashion.  Because of this, the radio-group acts as a control to determine whether the text following it will be used or not.  By convention, the first radio is considered negative, and the second radio is considered positive.  If the positive radio is clicked, then following text will be included.  If neither radio button is used, then no text is included.

Let us see some examples to explain how this works.

label "Tinel's test" (wide) radio-group "" 20x5 data [ "-v" "+v" ] field " with thenar wasting"

./radio one.png

 Here the first radio has been selected.  This will result in the following text being inserted

Tinel's test negative

If the second radio is selected instead, then the following will be inserted:

Tinel's test positive with thenar wasting

If neither radio was selected, then no text will be inserted.

This example also shows how some abbreviations are used and expanded from the text in the radio-group.  The table below shows what is currently available:

 

 L left
R
right
+
present
-
absent
+v
positive
-v
negative
 N normal
A
abnormal

If you use some text that is not one of the abbreviations above, then it will be included as written.

The other facets of the radio-group are the "" following which can be used as default text, and the 20x5 which is specifying the size of the radio-group.  The (wide) following the label is specifying a default width for the label to help align columns of labels.  The width sizes are in the table below:

 

 wide 40
very-wide
60
thin
35
very-thin
 25

Synapse Text Widgets

  • hcheck-group
  • sfield
  • slabel
  • stext
  • sedit-list

Synapse Outcome Widgets

  • edate
  • etext
  • cfield
  • dfield
  • ifield
  • outcome

Patient Variables

The following variables are available inside a template

<$diagnoses>
<$procedures>
<$currentmedications>
<$age>
<$sex10>
<$sex>
<$systolic>
<$diastolic>
<$weight>
<$height>
<$cholesterol>
<$hdl>
<$esr>
<$crp>

They generally are replaced with single values except for the first three which return tables of data.

Synapse Directives

  • calculator
  • sql-database
  • imaging
  • laboratory