This file is indexed.

/usr/share/doc/gnumed/user-manual/Gnumed/GmManualLettersForms.html is in gnumed-doc 1.4.6+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
	<title> GmManualLettersForms &lt; Gnumed &lt; Foswiki</title>
		  
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="robots" content="noindex" /> <link rel="alternate" type="application/rss+xml" title="RSS Feed" href="WebRss.html" />
	<link rel="icon" href="../rsrc/System/ProjectLogos/favicon.ico" type="image/x-icon" /> <link rel="shortcut icon" href="../rsrc/System/ProjectLogos/favicon.ico" type="image/x-icon" />
	<link rel="alternate" href="http://wiki.gnumed.de/bin/edit/Gnumed/GmManualLettersForms?t=1391005512" type="application/x-wiki" title="edit GmManualLettersForms" />
	<meta name="description" content="GmManualLettersForms" />
	 <!--[if IE]></base><![endif]-->
	
	<style type="text/css" media="all">
@import url('../rsrc/System/SkinTemplates/base.css');
</style>
<style type="text/css" media="all">
@import url('../rsrc/System/SkinTemplates/default.css');
</style>
<!--[if IE]><style type="text/css" media="screen">
pre {
	overflow-x:auto;
	padding-bottom:expression(this.scrollWidth > this.offsetWidth ? 16 : 0);
}
</style>
<![endif]-->

<meta name="foswiki.PUBURL" content="http://wiki.gnumed.de/pub" /> <!-- PUBURL -->
<meta name="foswiki.PUBURLPATH" content="/pub" /> <!-- PUBURLPATH -->
<meta name="foswiki.SCRIPTSUFFIX" content="" /> <!-- SCRIPTSUFFIX -->
<meta name="foswiki.SCRIPTURL" content="http://wiki.gnumed.de/bin" /> <!-- SCRIPTURL -->
<meta name="foswiki.SCRIPTURLPATH" content="/bin" /> <!-- SCRIPTURLPATH -->
<meta name="foswiki.SERVERTIME" content="29%20Jan%202014%20-%2015:25" /> <!-- SERVERTIME -->
<meta name="foswiki.SKIN" content="twikinet%2c%20pattern" /> <!-- SKIN -->
<meta name="foswiki.SYSTEMWEB" content="System" /> <!-- SYSTEMWEB -->
<meta name="foswiki.TOPIC" content="GmManualLettersForms" /> <!-- TOPIC -->
<meta name="foswiki.USERNAME" content="KarstenHilbert" /> <!-- USERNAME -->
<meta name="foswiki.USERSWEB" content="Main" /> <!-- USERSWEB -->
<meta name="foswiki.WEB" content="Gnumed" /> <!-- WEB -->
<meta name="foswiki.WIKINAME" content="KarstenHilbert" /> <!-- WIKINAME -->
<meta name="foswiki.WIKIUSERNAME" content="Main.KarstenHilbert" /> <!-- WIKIUSERNAME -->
<meta name="foswiki.NAMEFILTER" content="%5b%5cs%5c*%3f~%5e%5c%24%40%25%60%22'%26%3b%7c%3c%3e%5c%5b%5c%5d%23%5cx00-%5cx1f%5d" /> <!-- NAMEFILTER --><!--JQUERYPLUGIN::FOSWIKI::META-->
<script type='text/javascript' src='../rsrc/System/JQueryPlugin/jquery-1.4.3.js'></script><!--JQUERYPLUGIN-->
<script type='text/javascript' src='../rsrc/System/JQueryPlugin/plugins/livequery/jquery.livequery.js'></script><!--JQUERYPLUGIN::LIVEQUERY-->
<script type='text/javascript' src='../rsrc/System/JQueryPlugin/plugins/foswiki/jquery.foswiki.js'></script><!--JQUERYPLUGIN::FOSWIKI-->
<script type='text/javascript' src='../rsrc/System/JSTreeContrib/jquery.jstree.js'></script><!--JQUERYPLUGIN::JSTREE-->
</head>
<body class=""><div class="foswikiPage">
<a name="PageTop"></a> 
<p></p>
<p></p>
<h1><a name="Paperwork_handling_in_GNUmed"></a>  Paperwork handling in GNUmed </h1>
<p></p>
<a name="foswikiTOC"></a><div class="foswikiToc"> <ul>
<li> <a href="#Concepts"> Concepts </a> <ul>
<li> <a href="#Reports"> Reports </a>
</li> <li> <a href="#Forms"> Forms </a>
</li> <li> <a href="#Templates"> Templates </a>
</li> <li> <a href="#Form_engines"> Form engines </a>
</li> <li> <a href="#Placeholders"> Placeholders </a>
</li></ul> 
</li> <li> <a href="#Theory_of_Operation"> Theory of Operation </a> <ul>
<li> <a href="#OOo_template_specifics"> OOo template specifics </a>
</li> <li> <a href="#LaTeX_47XeLaTeX_template_specifics"> LaTeX/XeLaTeX template specifics </a>
</li> <li> <a href="#PDF_form_template_specifics"> PDF form template specifics </a>
</li></ul> 
</li> <li> <a href="#Adding_a_new_letter_template"> Adding a new letter template </a>
</li></ul> 
</div>
<p></p>
<h2><a name="Concepts"></a>  Concepts </h2>
<p></p>
<h3><a name="Reports"></a>  Reports </h3>
<p></p>
Reports typically are letters written to accompany the patient to and from hospital stays or consultant visits. They are compiled from templates into a final non-recomputable format. That final format is then usually presented for post-processing with a text editor or word processor right before printing. The report will then usually be printed onto plain, blank or special, pre-printed business letterhead paper.
<p></p>
<h3><a name="Forms"></a>  Forms </h3>
<p></p>
Forms, as opposed to reports, are often used for requesting particular therapies or diagnostic procedures. They are typically printed onto pre-printed forms with lines, boxes, and fields. Thus forms are best implemented with a dedicated on-screen mask to fill in which is then compiled and printed onto the paper form. As opposed to reports it is often not useful to make the compiled form editable before printing.
<p></p>
There is limited forms support in GNUmed so far.
<p></p>
<h3><a name="Templates"></a>  Templates </h3>
<p></p>
A template is a file which contains the constant parts of a document interspersed with placeholders for patient data.
<p></p>
<h3><a name="Form_engines"></a>  Form engines </h3>
<p></p>
A form engine is code inside the GNUmed used to turn a template into a printable output format. Currently GNUmed knows three such engines, each driving external software to create output: the Openoffice.org engine, the <a href="LaTeX.html">LaTeX</a> engine, the XeLaTeX? engine, the AbiWord engine, the plain-text generic engine, and the PDF-form (FDF) engine.
<p></p>
<h3><a name="Placeholders"></a>  Placeholders </h3>
<p></p>
Placeholders are usually category words that will be replaced by specific instances of that category for the current patient, say <em>lastname</em> is replaced by <code>Kirk</code>. 
<p></p>
Placeholders come in the format <code>$&lt;placeholder-name::usually-optional-arguments::usually-optional-maximum-length&gt;$</code>. Where arguments are not provided, and no length limit is desired, the separators <code>::</code> and <code>::</code> must still be supplied, e.g.  <code>$&lt;lastname::::&gt;$</code>. So, <code>$&lt;soap::ap::25&gt;$</code> is valid, as is <code>$&lt;soap::ap::&gt;$</code>, as is <code>$&lt;soap::::&gt;$</code>, as is <code>$&lt;soap::::25&gt;$</code>, but <strong>not</strong> <code>$&lt;soap::ap&gt;$</code> or <code>$<soap>$</code>.
<p></p>
Exactly what can be put into the arguments field will depend on the placeholder in question. More examples include:
<p></p> <ul>
<li> date of birth: <code>$&lt;date_of_birth::%Y-%m-%d::&gt;$</code> <ul>
<li> show date of birth formatted <em>Year-Month-Day</em>
</li> <li> format strings are listed in the <a href="http://docs.python.org/library/time.html#time.strftime" target="_top">Python documentation</a>
</li></ul> 
</li></ul> 
<p></p> <ul>
<li> progress notes: <code>$&lt;soap::ap::300&gt;$</code> <ul>
<li> show the 'a' and 'p' rows from among (i.e.) soAP notes, to a maximum of 300 characters
</li> <li> GNUmed will let the user select which soAP rows from which encounters
</li></ul> 
</li></ul> 
<p></p>
All data is passed to placeholder handlers 'as is'. 
<p></p>
More detail on using many of the placeholders is provided on the page <a href="GmManualPlaceholderReference.html">Placeholder Reference</a>. The full set of what has been programmed can be found within <a href="http://gitorious.org/gnumed/gnumed/blobs/master/gnumed/gnumed/client/wxpython/gmMacro.py" target="_top">this source file</a>. <a href="mailto&#58;gnumed&#45;devel&#64;gnu&#46;org">Ask</a> for more placeholders on the <a href="http://lists.gnu.org/mailman/listinfo/gnumed-devel" target="_top">mailing list</a> as you need them.
<p></p>
Future placeholders might consider those utilized in other systems, for example <a href="http://www.oscarmanual.org/oscar_emr_12/clinical-functions/e-forms/eform-magic" target="_top">in Oscar EMR</a>.
<p></p>
<h2><a name="Theory_of_Operation"></a>  Theory of Operation </h2>
<p></p>
GNUmed uses engines to drive external programs to combine templates holding placeholders with data for those placeholders into instances of a template and compile that into an output format. Currently, the supported engines are <a href="http://www.openoffice.org" target="_top">OpenOffice</a>, PDF forms, XeLaTeX, AbiWord, Text, and <a href="LaTeX.html">LaTeX</a> (there are two more: <code>gnuplot</code> and <code>image_editor</code> but they are not used to create reports of forms).
<p></p>
When generating a letter/form GNUmed will export the template from the paperwork template definition record inside the backend into a temporary file. That file will be scanned for known placeholders which are then replaced by their respective data values with regard to the active patient. Some of those replacements may require user interaction (such as selection of which progress notes to actually include). Next, GNUmed will open the substituted file in an editor suitable for the file type in order to facilitate further editing. Depending on the external program the finalized template will then either be printed directly via that application (OOo) or be compiled into PDF (<a href="LaTeX.html">LaTeX</a>, PDF forms). The resulting PDF is then printed using any number of methods (<em>Acrobat Reader</em>, <code>gtklp</code>, <code>os.startfile</code>, <em>Internet Explorer</em>, MacOSX? <code>open</code>, <code>gsprint.exe</code>, or the shell script <code>gm-print_doc</code>). Eventually, the user is asked which episode to file the new document under (which can be aborted to not file the document). If possible, a re-editable version of the document is filed alongside the finalized non-editable version.
<p></p>
Depending on the exact purpose of the above process some steps will be skipped. For example, printing a medication list will not open the substituted <a href="LaTeX.html">LaTeX</a> file in a text editor before printing.
<p></p>
<h3><a name="OOo_template_specifics"></a>  OOo template specifics </h3>
<p></p>
Letter definitions are stored in the database in the form of an OOo template file (.ott) along with some metadata (see table <code>ref.paperwork_templates</code>). Upon opening the document in OOo GNUmed sets up a callback in OOo in order to be notified about closure of the document. It then reads back the current filename of the document and uses that to import it into GNUmed. That way, the correct document is imported even if the user saved it under a different name meanwhile.
<p></p> <ul>
<li> in OpenOffice open a new document
</li> <li> design the letter template as you please
</li> <li> where appropriate include placeholders within the document <ol>
<li> placeholders can simply be written into the text
</li> <li> placeholder can also be added via the <em>Insert</em> / <em>Field</em> menu
</li></ol> 
</li> <li> save it as an .ott OpenOffice document <em>template</em>
</li></ul> 
<p></p>
There is one caveat with placeholders in OOo: With placeholders simply written into the flow of text you cannot put two of them onto the same line (perhaps even the same logical paragraph). The reason is that the OOo search-and-replace function does not support non-greedy regular expression searches <img src="../rsrc/System/SmiliesPlugin/frown.gif" alt="frown" title="frown" border="0" />   Their advantage is, however, that they automatically inherit the properties of their surrounding text which is not the case with placeholders explicitely declared via <em>Insert</em> / <em>Field</em>. Those, on the other hand, do properly work on the same line ... So, pick your poison (or choose <a href="LaTeX.html">LaTeX</a> <img src="../rsrc/System/SmiliesPlugin/wink.gif" alt="wink" title="wink" border="0" /> )
<p></p>
<h3><a name="LaTeX_47XeLaTeX_template_specifics"></a>  <a href="LaTeX.html">LaTeX</a>/XeLaTeX template specifics </h3>
<p></p>
These templates are written in the <a href="LaTeX.html">LaTeX</a> document preparation language. The templates as such will not be fully valid <a href="LaTeX.html">LaTeX</a> code because placeholder definitions start and end with the <code>$</code> sign which has a special meaning in TeX. Many other characters also have a TeX meaning (<code>_</code>, <code>\</code>, <code>%</code> etc) such that they may need to be escaped if you want them to appear as-is in the final PDF output. GNUmed provides the placeholder <code>$&lt;tex_escape::::&gt;$</code> which - within the Python code - properly escapes whatever is put inside the placeholder. This is particularly useful for VCS tags and similar things over which one has no explicit control.
<p></p>
If you are using <a href="http://www.lyx.org" target="_top">LyX</a> or another TeX-aware editor to create templates make sure to check the template file for special characters having been helpfully escaped by the editor but thus rendering invalid your placeholder definitions. This particularly applies to <code>$</code>, <code>%</code>, and <code>_</code> as they frequently occur in date/string formatting and placeholder names.
<p></p>
Have a look at the <a href="TemplateRepository.html">existing templates</a> to see how to achieve things like <a href="LaTeX.html">LaTeX</a> list item generation, <a href="LaTeX.html">LaTeX</a> table generation, or smart list item separators (eg. no trailing separator after the last item or no singular separator when the list is empty).
<p></p>
Use <code>.tex</code> as the filename extension for <a href="LaTeX.html">LaTeX</a> templates.
<p></p>
<h3><a name="PDF_form_template_specifics"></a>  PDF form template specifics </h3>
<p></p>
Such templates are created by taking a PDF form, inserting placeholders into the form fields, and importing this partially pre-filled form into the database as the template file. For use as a template do <strong>not</strong> <em>flatten</em> the PDF when saving the partially pre-filled form.
<p></p>
You will need to install both a PDF viewer capable of form filling as well as <a href="http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/" target="_top">pdftk</a>.
<p></p>
<h2><a name="Adding_a_new_letter_template"></a>  Adding a new letter template </h2>
<p></p>
With the template prepared as describe above follow this procedure:
<p></p> <ul>
<li> in the <em>GNUmed</em> menu go to <em>Manage Master Data</em>
</li> <li> use the menu item <em>paperwork templates</em>
</li> <li> in the dialog fill in the fields as needed and select the template file you created
</li> <li> save the new template
</li></ul> 
<p></p>
The new template should now be available from within GNUmed.
<p></p>
<hr />
<em>Next:</em> <strong><a href="GmManualTestResultConcepts.html">Test Result Management</a></strong>
<p></p>
<a name="TopicEnd"></a>
<p></p>
<p></p>
<p></p>
<p></p>
</div>
</body></html>