Keyword Based Text Expansion Macros

GNUmed supports the use of keyword based text expansion (substitution) macros in its SOAP notes, in document descriptions and in the free_text document template placeholder.

These work as follows:

  • sample text macros (and any additional ones that you have since created) can be found and managed via GNUMed¬ís Master data > Manage lists > Keyword based text expansion macros menu
  • there are two ways to invoke a macro, both of which involve a match search
    • automatically where, after each keystroke, the last character entered is checked for a range of end-of-word characters (spaces and punctuation)
    • manually, in those implementations of GNUmed that so support, by (as in Macro)
  • the match search checks the last-entered "word" against start-of-string matches within the keyword space of existing text macros
  • outcomes
    • if only one keyword matches, it is replaced
    • if more than one keyword matches, a list of the matches is offered to the user to choose from
    • In case the user activates a multi-line macro inside a single-line text field, GNUmed will ask which line of the macro to insert into the text field
    • if there is no match, GNUmed leaves things as is


Suppose you have created two keyword macro text expansions which you have named **dm1 and **dm2 which expand to 'diabetes mellitus I' and 'diabetes mellitus II'.

In a SOAP note or in a document description or in a free_text document template placeholder (as part of writing correspondence) you type the characters **dm followed by a space or punctuation such as a colon (:).

GNUmed will trigger on the space or colon, and will match and offer both "**dm1" and "**dm2".

You can write **dm1: elevated sugars and GNUmed will turn this into Diabetes mellitus 1: elevated sugars for you.

We strongly recommend that keywords that also have real-use (niddm) with some modified, say "**", such that one can safely write "niddm" as well as expand on "**niddm". But it is all up to the whims of the user. If the users configures "the" to be a keyword for expansion each and every "the" will get expanded.


Each keyword
  • must be a single, uninterrupted string (no spaces)
  • its word parts, if semantically multiple, need to be 'bound' (for example, by - or _ ).
  • cannot contain any of the following: !?'\".,:;)}\]\r\n\s\t

Effective October 2012 (client 1.0, server / database version v16), a text control mixin was implemented, allowing the possibility to use these expansions in any wx.TextCtrl instance in GNUmed.

For the time being, these have been enabled in any widget which uses gmGuiHelpers.cMultiLineTextEntry. Single-line text fields might access a multi-line expansion, one of whose lines having then to be selected, anywhere that client/wxpython/gmTextCtrl.cTextCtrl is being used.

--- This topic: Gnumed > GnumedManual > MenuReference > MenuGNUmed > KeywordBasedTextExpansionMacros
Topic revision: 29 Jan 2015, JamesBusser
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback