PainForm: an Analgesia Database

We've provided source code for a fairly complete analgesia database, written in SQL, Perl, C/C++ and AutoIt. It runs on a Personal Digital Assistant (Palm-based) and under Windows. Only try to use this code if you are interested in development, as it's not possible to simply download and run this freeware GPL program.

What is it?

We've provided a PDF overview that briefly describes what the database does, and why you should or should not consider looking at it.

The documentation

Here is the fairly extensive documentation for the various components described in the above overview.
  1. An early document that describes our initial thoughts about the system.
  2. Two examples of a paper form, one a `vanilla-flavoured' form that also contains a description of the form functionality, and the second a more elegant form and short manual! We think it's vitally important to get your paper form working fairly well before you try to create a paperless system.
  3. The first part of the documentation for our database. A description of the data tables, and how to populate them. The SQL instructions can be extracted from the source (below).
  4. The second part, which is far longer as it describes our scripting language, and then how we implement all menus using this language. All menu descriptions are stored within SQL tables, allowing easy alteration of menus as they are dynamically created (Quite a task, on the Palm). Note that some of the screen shots may not be fully up-to-date.
  5. The Perl program. This is an enormous PDF (over 400 pages) that describes the whole desktop Perl program, including all interfacing with external SQL databases, and communication with the PDA. A lot of the Perl is rather crappy, and hastily scribbled.
  6. Full documentation of the PDA program, written in C++. This fairly lengthy document describes all PDA-based implementation of my scripting language, and other major functionality, but does not contain the library routines used on the PDA which are described below. This documentation is somewhat more legible than the rest of the code.
  7. The Error library, written in C. This is a boring little document.
  8. The SQL library. I've implemented a stripped-down version of SQL that runs on the PDA. It is extremely restrictive, but performs adequately, if certain caching techniques are respected. Formatting of the SQL input strings is much more restrictive than it needs to be.
  9. The Scripting Library. Almost all script functions used in our scripting language are represented here rather than in the main program. This allows us to add more functions without bloating the main program. The PDF documentation is a crude wrapper for the code.
  10. The Numeric library. This is largely a stub, as my grand ideal of implementing IEE754 or even IEEE754r has never been realised. This library is still however required.
  11. The Caching library is a vital component, as in certain circumstances it speeds display of PDA screens by a factor of ten. It partially compensates for inadequacies in our code, and major efficiency issues with handling of file access under Palm OS.
  12. The Console library. This is the most crude documentation. The idea here is that the C++ program on the PDA can write to a `console' that can then be viewed. This is particularly useful in debugging. The coding is almost as crude as the style of documentation, as this was written very early on. Likewise for the associated stand-alone program OsBox, a console viewer.

DogWagger

In order to pull out the file source code from the following .TEX files, you will need my Perl program Dogwagger21.pl. Note that I've stored this program online as `Dogwagger21.xxx'. You can rename it to Dogwagger21.pl or simply run it from the command line as follows:
perl Dogwagger21.xxx

You will need Perl 5.6 with the Tk toolkit. Note that this used to be included by default with Perl, but in more recent versions it has been stripped out. Someday I'll get around to rewriting DogWagger so that it runs from the command line (using Tk was perhaps a mistake). The source code is here, and here's the PDF documentation (You can create a working version of Dogwagger from Dogwagger21.tex, using --- wait for it --- Dogwagger itself. I even once had a self-extracting version, but dumped this as silly, and it never worked brilliantly well).

The source code

Here are the corresponding LaTeX files that act both as a source for the above PDF documents, and the source code for the entire program. My DogWagger program, written in Perl, is required to extract the source files, after you've manually created the required target directories.
  1. The LaTeX source of the primitive paper form.
  2. Part I of the database.
  3. Part II (large).
  4. The Perl documentation source, including the Perl source code.
  5. The PDA program, written in C++. The libraries follow:
  6. The Error library. This includes a Makefile, header file, and DEF file. (If you don't know what these are, then you may not wish to read further:)
  7. The SQL library, with necessary associated files for its creation.
  8. The Scripting library.
  9. The Numeric library.
  10. The Caching library.
  11. The Console library, and the associated Os Box viewer program.

Copyright notice

The contents of these pages and documents are all Copyright © J.M. van Schalkwyk, 2005--2009. They in no way represent the views of his employer. They were not endorsed or sponsored by any party other than his long-suffering wife!