Writing letters in GNUmed

Theory of Operation

GNUmed uses OpenOffice for writing letters. Letter definitions are stored in the database in the form of an OOo template file (.ott) along with some metadata (see table ref.paperwork_templates). When the user selects a certain letter template by name GNUmed exports the corresponding template file, starts OOo and opens the template in it. It searches for known placeholders within the new OOo document and replaces them with values corresponding to the current state of GNUmed (active patient etc). It then sets up a callback in OOo in order to be notified about closure of the document. Eventually, GNUmed imports the document into the document archive under the current patient.

Adding a new letter template

The new template should now be available from within GNUmed.

The placeholder concept

Placeholders are usually category words that will be replaced by specific instances of that category for the current patient, say lastname is replaced by Kirk. Here is a list of currently known placeholders. Ask for more placeholders on the mailing list.

Placeholders come in the format $<placeholder-name::optional-arguments::optional-maximum-length>$. If there are no arguments for a given placeholder (say, lastname) the arguments field must be left empty if you want to set a maximum length. So, $< lastname>$ is a valid placeholder as is $<lastname::::5>$ (the arguments field in the middle is empty) but not $<lastname::5>$. Exactly what can be put into the arguments field depends on the placeholder in question. The data is passed to the placeholder handler as is. The maximum length field can be left off (but not empty). So, $<soap::ap::25>$ is valid, as is $<soap::ap>$, but not $<soap::ap::>$ (the length field is empty).

Examples are:


Next: Test Result Management