Welcome to the TFP Medical Information System!!

[Computerized Fax Prescription Refills and Printed Rx's | Demographic Data | Problem List | Progress Notes and History and Pysical | TCP/IP Server/Client Pharmacy Refill Program

Overview

Computerized Prescription Refills

The Tulare Family Practice Information System started as a program to send prescription refills to drugstores by computerized faxing. It has since been expanded to include prescription writing, generation and storage of demographic information, progress notes, problem lists, past history information and e-mail based HMO referral authorization generation and tracking. These modules are integrated. I have expended a lot of effort to studying the work flow in my daily practice and trying to find ways to use the computer to reduce the duplicated effort found in my previous paper based medical record system. I have tried not to put things into the program unless it actually saved me or my staff time, reduced the number of steps involved, made the information much easier to find or allowed the information produced by the program in one operation to be automatically used by another operation within the program. For example, doing the prescription refills or writing a prescription automatically produces the patient's medication list which can then be inserted into a progress note or a history and physical. During the process of generating a progress note, the computer scans the patient's problem list file and automatically inserts a diagnosis such as hypertension into their problem list without any effort on your part. The problem list can then be inserted back into a progress note or a history and physical whenever you need it. The computer is thus used to magnify your effort and reduce duplication of steps. Of course there is still some need to key in data but generally, you only have to enter a piece of data such as a drug name, or demographic data one time.

The computerized prescription program saves time by storing the refills in each patient's file on the computer. The previous refills can be seen on the screen so you don't need to pull the patient's file to see when the last refill was done. The refill file can be scanned by the computer so if there are previous refills for the same medication, the data fields can be filled out by the computer saving repetitive typing or recording the refills each time by hand. It is only necessary to click on the patient's name and the drug they need to record a refill and send it to be faxed. The messages are sorted for drugstores and placed in a spool. When the send fax button is pressed, all spooled faxes are faxed by the computer to the appropriate drugstore. The faxing process then does not need to be attended. Feedback messages are displayed as to the status of the faxes. This saves staff time that would be taken up by calling the pharmacist on the phone or faxing the refills by hand, recording the transactions by hand and pulling and refiling paper charts.

An up to date list of all the patient's refills can be printed out at any time for inclusion into their paper chart. Functions have been added to check for drug interactions, allergies, appropriate doses and synonyms for the selected medication with warning flags that pop up when a problem is detected. A hardcopy prescription and a patient education monograph can be printed out for each drug if desired and given to the patient. The windows can double as miniature web browsers and bring in data off the network either locally or from the internet when you are on-line.

Demographic Data

This module is for storing demographic data on each patient. Once this data is entered, it can be extracted for other uses such as the prescription printing routine, and is immediately available when you are working in any other module. The patient's demographic data is automatically loaded into the display each time the patient's name is clicked, as it is in the other modules. This makes it easy to view any information about the patient when working in a module without having to wait for the data to reload again. This is particularly nice in Linux under Xwindows using a pager such as in FVWM. There is function in this module for generating an authoriazation request for a specialist referral which can be faxed or e-mailed to the HMO office. The forms are filled out auomatically by the program from the demograhic data and a copy of any portion of the patient's progress notes can be inserted into the request. There is also a similar function that generates a fax to the specialist consultant as a referral letter that also can include a copy of any part of the patient's progress notes. The computer stores the names addresses, fax numbers of the HMO offices and the consultants.

Problem List Module

This module allows you to store a problem list for each patient. As with the other modules, whenever you are working on a particular patient, the program automatically calls up the data on that patient in the other modules so it will be immediatly available if you need it. The process of loading the data in the modules occurs in the background without any action on the part of the user. I recently converted this into a toplevel window that only pops up when you press a button on the main window instead of being displayed all the time. Also entries for immunizations, important tests and procedures, family history, social history and habits are included. This data can be inserted into a progress note if desired when using the progress note module. Conversely, the problem list is actually generated by the computer during the process of writing progress notes or doing a history and physical. Each time you store a progress note or history and physical, the patient's problem list file is scanned and if an important diagnosis such as hypertension is not present in the problem list, it is added automatically along with the date of first entry.

Progress Note Module

This module allows you to generate progress notes or a history and physical using menus that pop up and dynamically reconfigure themselves depending on the problem selected from a list of common office chief complaints. I have been able to eliminate the need for a transcriptionist to type my daily progress notes using this module. The problems with legibility of handwritten notes are also eliminated.

The progress note files are stored as HTML that can be displayed in any web browser. The use of HTML is very nice for use with a search engine coupled to a web server suche as APACHE. You can then access your data through a web browser to extract information with a search engine such as SWISH-E. This works very well on Linux and I have used it for drug recalls such as recently when Duract was recalled. When you save a progress note, a copy is appended to the patient's progress note file and another is automatically appended on to a file for that day's work. The day's work file is printed out at the end of the day on sticky paper which is then placed in the patient's paper chart. Whenever you work on a patient's data in any module, their progress notes will automatically be loaded into the HTML display window so you can read them if needed to help make decisions on their prescription refills or progress notes. When run under Windows95 or 98, you can use IBM's ViaVoice program to dictate directly into the window in order to add phrases that may not be available in the menus.

Being able to view the progress notes, demographics and problem list at the same time is very useful when doing refills as it eliminates the need for your staff to pull the chart in most cases which saves valuable staff time. I find it takes me about the same or a bit less time to do my progress_notes with this program as dictating into a tape-recorder. The advantage is that no trascriptionist is required. A less skilled person can be employed to file the day's print out on the patients' paper charts.

TCP/IP Server/Client Pharmacy Refill Request Programs

These are a set of small client/server programs based on the Tcl/Tk "sockets" programming library. A simple client program that can be run by a pharmacist can send requests for refills to the TFP_drugrefill.tcl program acting as a server to receive TCP/IP packets and the physician can respond back to the pharmacist clicking choices with the mouse. No typing is necessary on refills that have been done before. Any drugs or other data which has been entered before never has to be typed again. Records are stored of the transactions on the server end.

Encryption has been added to the program with 128 bit RSA security which uses a public-key/private-key scheme. When the messages are trasmitted over the network, they are in an encrypted form and would be almost impossible to decipher should they be somehow directed to the wrong destination. This would actually be a much better way to do refills than faxing because the data is in a ASCII format that Tcl/Tk can scan using a powerful "regular expressions" function and manipulate in various ways to accurately extract information and use it for any other desired processes. This is not possible with faxes. This is due to the fact that faxes are a type of bitmap image file and must be run through an optical character recognition program to convert the data to ASCII computer text before it can be used as data for the refill program. This conversion is slow and also is not that accurate especially for dealing with medications where no errors can be tolerated.

About the Program

The program is being written by Alex Caldwell, M.D. in the language Tcl/Tk the "Tool Command Language". It is being tested and debugged in actual daily use in a busy 4 doctor family practice office. Tcl/Tk was generously made availble by it's author Dr. John K. Ousterhout previously of the University of California, Berkeley, then Sun Microsystems and now heading his own company "Scriptics" who are now supporting the development of Tcl/Tk. Many other programmers have contributed extensions and libraries for Tcl/Tk that I used in this program. These include the HTML library by Steven Uhler, the spynergy library by Mike Doyle and the object oriented tcl++ package by Matt Newman. Originally this program was written in Tcl/Tk for Linux the Unix clone operating system and has since been ported to Tcl/Tk for Windows95/98. Anther program written by Dr. Caldwell was included on the Scriptics Tcl/Tk web site among other examples of what can be done with Tcl/Tk plugin for Netscape/Internet Explorer. I also have some CGI scripts I wrote that work under the Apache web server for such things as a Web based HMO authorization submission system, a web browser HTML gateway to the fax drug-refill program and a search engine for extracting information from your medical record system.

System Requirements and Installation

Linux

The program requires Tcl/Tk 7.6/4.2 or above. I'm using Tcl/Tk 8.03 right now. I recently added functions that requrire the installation of the itcl2.2 or itcl3.0 object oriented extentions to Tcl/Tk. This is because I couldn't resist some of the cool widgets included with itcl. The ones used are the spinner widgets for entering numerical data like vital signs, and the itcl html rendering text widget. I compiled itcl3.0 using my Tcl/Tk 8.03 sources and the programs are set up to run under the itkwish3.0 interpreter but you could also change the first line in each program to run under wish8.0 and then load the itk3.0 shared library. I run the programs quite nicely on a 486 that has an AMD DX4120 with 48mb ram and 1mb video card on a VESA bus. It runs really zippy on a pentium. The speed isn't too critical in this application except in the rendering of html or in the statistics report functions. You must obtain and install Tcl/Tk and itcl2.2 or 3.0. Either version seems to work just as well. The programs look for it in the /usr/local/bin directory. You can edit the first lines in the programs if you installed itkwish somewhere else. For printing a prescription, I have the program set up to use "apsfilter" which is very common on Linux. If you don't have this installed, the line in TFP_drugrefill.tcl in the printRx procedure that sends the file to the printer could be modified if desired to not use apsfilter with something like "exec cat $rootdirectory/drug_programs/tempRxfile > /dev/lp1 &" or "exec pr -h Prescription $rootdirectory/drug_programs/tempRxfile > /dev/lp1 &". The programs are intended to be untarred in your home directory. If you install it somewhere else it probably won't work right out of the box but you could edit the files if you know tcl/tk and change the lines that refer to where the variable $rootdirectory is set to the directory where you installed it. A number of directories will be created in your home directory. The file ~/drug_programs/launcher is the file that starts up the programs. Tk_familypractice is a group of small programs that communicate using the Tcl/Tk "send" command. For the send command to work you have to compile Tcl/Tk and itkwish with the SECURITY_FLAGS = -DTK_NO_SECURITY line in the Tk makefile uncommented. Alernatively you can use Xauthority to enable the send command. See the man page for the send command. This is very important as many important functions to the program depend on the send command.

Windows 95/98

I have now finished converting the Windows version from Tcl/Tk 7.6/4.2 to Tcl/Tk 8.0 for windows 95/98. I've changed from itcl2.2 to tcl++ by Matt Newman which is a pure Tcl (no compiled extension required) version of the itcl widgets. I have had trouble with the dde 2.0 package available at the Neosoft Tcl/Tk archive which enables the send command under Tcl/Tk 8.0. I therefore switched to John LoVerso's comm send package for Tcl/Tk which enables a similar functionality to the send command but uses TCP/IP sockets. You need to install the Tcl/Tk 8.0p2 package in the default location under c:\Program Files\tcl for the program to run. You don't need to install the comm send package or the itcl++ package as I included those in the Tk_familypractice.zip file. As long as you have installed Tcl/Tk to the default location c:\Program Files\tcl they should be in the right place. If you installed Tcl/Tk somewhere else, you will have to install the whole mess yourself. I used Winzip to package the archives and you should unzip them into the c:\ directory. Everything will be installed in the directories c:\bgfax and c:\Program\ Files\tcl\bin and c:\Program Files\tcl\lib directories.

These changes are making the maintainance of the Linux and Windows versions much easier since before I was not able to find a version of the dde library that worked reliably so I couldn't use the send command under Windows and had to write essentially a different program for Windows. I couldn't keep up with maintaining both versions. Now I can have all the files exactly the same in the Windows and Linux versions. The programs read an environment variable $tcl_platform(os) at startup to make any platform specific initializations. The main differences between the two platforms have to do with the different directory tree structure and file name syntax as well as the external programs for faxing and fax viewing being different on the two operating systems. Eventually, if tcl++ can be ported to Tcl/Tk 8.1 for windows which has a reliable send command for windows, I will probably move things to Tcl/Tk 8.1.

If you get a message when running the program about running out of environment space, try adding a line like this to your autoexec.bat file: shell=c:\command.com c:\/c:4086 /P . I had to do this on Windows 95. When I upgraded to Windows 98, however, the problem went away and I don't seem to need it.

The program is started by running the program C:\Program Files\tcl\bin\drug_programs\drugrefill.bat . Be sure to put quotes around the Program Files directory name if you are running it from a script as the space will otherwise not be recognized.


Some other difference is that the programs depend on an external program to actually send faxes so a different fax program gets called depending on which operating system is in the $tcl_platform(os). Also, the programs are started from a file called drugrefill.bat in the drug_programs directory under windows which is a DOS batch file. I used some batch file programming to get the return code from the bgfax program to report back to the Tcl/Tk drugrefill program whether the faxes are successfully sent. This done in a different manner in a "pipe" in Linux, although it looks the same when you run the program. One difference however, is that on Linux the GUI remains responsive while you are faxing and you can do other things. On Windows, the GUI becomes unresponsive to user input until the fax routine is finished.I believe it would be possible to write a pure Tcl/Tk fax program since Tcl/Tk can read and write to the serial ports.\ You might have to use the Expect Tcl/Tk extension which can automate interactive programs. It would be a pretty big job. I'm not aware of any pure Tcl/Tk fax program. Tkhylafax is kind of a Tcl/Tk GUI to program in C that does the acutal faxing, I believe.

Running the program

I have tried to put balloon help messages everywhere. You can learn what the buttons and other widgets do by placing the cursor over them and reading these. The tasks used most are refilling prescriptions to pharmacies by faxing and creating progress notes. You can also create or edit a probem list, allergy list and demographic information for each patient. You can add or edit files which store information on drug interactions and patient drug infomation monographs. The socket based TCP/IP pharmacy/office client/server based prescription programs are not enabled by default. I plan to add a dialog box for a choice on startup soon, but for now it is necessary to uncomment the lines near the top of the TFP_drugrefill.tcl program that start with ECHO . The files for the drug interactions have to be in a specific format to work - the name of the interacting drug and a colon with a space on either side of it followed optionally by a brief note about the interaction. Example:
hismanal : cardiac arrhthmias
could be entered into the file for the drug erythromycin. Likewise, the drug dose files have to have no spaces between the words so use something like 1p.o.-q.i.d. or 1p.o._q.i.d. The spelling of any drug in the interaction or allergy file has to be the same as the way you use it in the drug list or the program will miss it. You have to use a consistent pattern in entering the names of the drugs. I chose to use all lower case letters for the drugs, so if you put in an upper case on the beginning it will think it's a different drug. If a drug is not in the list, the first time you send a refill or do a new prescription for it, it will be added to the list. You can remove a drug by right clicking on the list box and entering the name in the dialog box.

Program History

The program started out sometime in 1996 as a unix Bash shell program that could control the program mgetty+sendfax on Linux. Around that time, I had begun to program in Tcl/Tk and started developing a GUI interface to the program. This has evolved gradually as my knowledge of Tcl/Tk expanded. I would add a new feature when I would learn about some new feature of Tcl/Tk that seemed useful.

  • 07/04/98 - added a pop-up menu to add the no. of refills to the quantity entry box. Eliminates need to type the no. of refills.
  • 07/13/98 - added button so drug information can be displayed or printed for currently selected drug.
  • 07/13/98 - added menubutton so that acceptable doses for currently selected drug can be displayed on a pop-up menu so you can change dose easily.
  • 07/23/98 - added a button and function to display information about the drug you have currently selected. Patient information can be displayed or printed for the patient about the medication he is taking.
  • 07/27/98 - added an entry box to namebrowser and drugbrowser listboxes so you can enter a few letters of the person's name or the drug and the list will be scrolled to the appropriate place.
  • 07/31/98 - added a function that calculates some simple statistics on number of patients, number of drugs and total number of Rx's for each drug.
  • 09/15/98 - moved progress_notes directory to Windows directory of my dual boat Windows95/Linux system. That way, you can work on the same files whether working under Windows95 which is better when using IBM Via Voice to dictate into the Tcl/Tk text widget windows and switch back to Linux which has better networking features. You have to watch for permission problems however as there can be only one owner of the files on the Windows side and you can't set any group or user permissions so the user running the program under Linux has to be able to mount the directory so that he is the owner. Otherwise he cannot write to the files. This is done by an entry in the /etc/fstab file user,rw for the directory.
  • 10/5/98 - converted the quantity box to a iwidget3.0.0 spinner widget so you can use mouse to click to increase or decrease the quantity of meds.
  • 10/9/98 - added procedure to check for drug information file on the selected drug and reconfigure the information button if info file exists for that drug.
  • 11/01/98 - changed the problem list module to a toplevel pop-up window. This keeps the display less cluttered as this module isn't needed as much and the data is still just as quickly available when a button is pushed in the main window. Also changed it to a text widget instead of a frame with many entry boxes. This allows the format of the data to be free flowing in the PMH and problem lists and it can still be inserted into the progress notes when desired from the progress note generator.
  • 11/01 - 11/08/98 - reworked the progress note generator. Menubuttons are used to select common office problems and the other menubuttons in the subjective and objective areas, assesment and plan dynamically configure themselves to a menu of choices appropriate for the particular problem. A the note is generated after the choices are made. It can still be directly edited in the window. When saved, the note is appended to the patient's file and to a file for each day which is automatically created by the tcl/Tk clock command. I also used the itkwidget3.0 spinner widget for weight, height, B/P, Temp. and respirations. This makes entering these very fast. They can increment in large jumps in one directon to get to another range quickly then slower in the other direction for fine tuning the value. This is very cool. Also used the itkwidget3.0 scrolledhtml widget for the text in the progress note editor/viewer. This enables viewing the rendered HTML notes whenever desired. Unfortunately, the itkwidgets are not yet working under the Windows version of Tcl/Tk. But they are supposed to be coming soon. Under windows, you could use IBM viavoice to dictate directly into the progress_note_generator.
  • 11/11/98 - added function to refresh the namebrowser and the drugbrowser whenever a new name or drug is entered into the drug-refill or the progress_note module. Also added a button to both browsers to do this whenever desired.
  • 11/15/98 - added a password dialog to get into the program. Program exits after maximum of 3 tries.
  • 11/16/98 - added a function to allow modifying the root directory into which you installed the program files.
  • 11/17/98 - added a function to insert the drug refill file into the progress note, removing any duplicated entries from the file.
  • 11/23/98 - rewrote the Windows 95/98 version to eliminate the dependency on the send command which I was not able to get to work with the [incr]tcl extension. It works good. Also it's faster without the send command.
  • 11/25/98 - added function in namebrowser listbox to remove all patient files and to move them from one name to another name. This is needed to cleanly remove a patient's files or to change them to another name when they get married or if you entered the name wrong when the patient was first entered into the system. This is activated by a right mouse click.
  • 11/30/1998 - added function to drugbrowser to make new drug file if a synonym is added to a drug's synonym file for the new synonym drug.
  • 12/04/1998 - added color tags to problem list header and to the drug interaction pop-up and allergie pop up to hilight the significant text.
  • 12/04/1998 - started a prescription writing module will store the printed prescriptions just like the refills then drug list will be more complete as some people don't refill drugs at drugstores etc.
  • 12/05/1998 - further work on prescription printing routine. Added allergy checking, dose checking, drug interaction checking to the printing routine. Added printing of date, patient name, address, D.O.B. phone no. from the demographic file to the printed Rx's. Set up printing to be filtered through apsfilter.
  • 12/11/1998 - fixed synonym procedure to add the same interactions for the synonym file as the original file.
  • 12/12/1998 - enabled right click on medication in refill file window to Stopped to the matching lines. This is then scanned for in the progress note generator and the stopped meds won't be included when the medications are inserted into the progress note.
  • 12/14/1998 - Added function to the demographicform to enable generation of an HMO referral authorization request. It produces an HTML forms based version of the request form with the data filled in from the demographic information you have entered on the patient. It calls netscape and load the form which can then be e-mailed or stored on the web-server.
  • 12/14/1998 - added a sample clinical algorithm for sore throat as a preliminary trial of the idea of using these to record responses that could be used to help generate the progress notes. Algorithm tree shows changes of color as you move through it but recording of responses is not yet functional.
  • 12/15/1998 - added function to include the prescriptions generated that day for a patient into the progress note for that day's visit into the plan automatically. This uses regular expressions to scan the refill file and insert any Rx's that match the date the note is written. This really saves some time and effort when doing progress notes. With the act of generating the prescription, your note is partly filled out for you.
  • 12/16/1998 - added function to progress note generator to send the current HTML note to the demographic form for inclusion in an authorization request if needed.
  • 12/19/1998 - added routine to browsename.tcl to remove a patient's files from the system.
  • 12/19/1998 - added function to TFP_drugrefill.tcl to check for a new patient when printing a prescription and create the files for the new patient. Prompts you to enter the demographic information into the demographic form so it can be used in the printed prescription.
  • 12/20/1998 - added buttons in note_gen.tcl to selectively clear the subjective, objective, assesment and plan data out of the note you are working on. Added entries for same variables that allow free text entry only into either the subjective, objective, assesment or plan. That way, you can edit the part you want without having to start the note all over. Unfortunately, if you want to remove part of a note, you still have to remove the whole subjective or the whole objective. I plan to try to fix that possible a procedure that would remove the cut selection using regular expressions to extract only the selected part out of the variable. I think this will work.
  • 12/27/1998 - modified demographic form program to generate a faxable refill form instead of just an HTML version. Need to have a selection for various IPA offices. Right now only Tulare IPA can be used and you have no selection.
  • 12/27/1998 - changed progress note generator to send the selected text from the progress note to the demographic form so you can send the exact part you want instead of the whole thing. Also you can send either the rendered version for a fax refill or an HTML version for the HTML version.
  • 12/28/1998 - added function in progress note generator to allow editing the problem list file. When saved, new files are created for each new problem to hold the symptoms, exam findings, assesments and plans for each problem. Changed the problem list selection from a pop-up menu to a top-level with a scrolling list box. This seems to work better as the list of problems got too long for the pop-up menu and it was very unwieldy to select from it as it would not fit on the screen on a 15" monitor.
  • 12/28/1998 - added menubutton to demographicform.tcl so select which managed care organization office to send the fax version of the authorization form to. The name and fax phone no. are stored in the drugstore file with their fax no.s. The faxes can be send with the usual fax sending button in the TFP_drugrefill.tcl program window.
  • 12/29/1998 - linked the Sore Throat algorithm program to the progress note generator so that your decisions are recorded and used to generate the progress note and if you get to a prescription, the TFP_drugrefill.tcl program is activated to print out a prescription for the patient.
  • 12/30/1998 - added procedure to allow removing or renaming all a particular drug's files in the drugbrowser.tcl program. Uses middle button click on the selected drug to activate. Added procedure to send assesment which will include icd9 code to the demographic form for inclusion in the authorization request.
  • 01/03/1999 - rewrote the windows version demographic form to copy the Linux version.
  • 01/04/1999 - rewrote the windows version note generator to look just like the Linux version.
  • 01/05/1999 - changed the behavior of the problem entry and menu box to act like the ones for subjective, objective, assesment and plan global variables. This allows you to do one problem at a time when writing your note. You can add another problem to the same note easier.
  • 01/06/1999 - fixed a couple of bugs in the browsedrug.tcl program dose and quantity boxes were being set back to null after the tgrep procedure had run instead of before. Fixed note_gen.tcl program to set the tempproblem variable back to null when the reset button is pressed.
  • 01/07/1999 - fixed problem in note_gen.tcl where the subjective, objective, assesment and plan variable were too long in the temporary fax file and this caused the efax program to be unable to convert the line into readable characters in the program that converts the ASCII file to a G3 tiff file for the faxing.
  • 01/07/1999 - fixed problem where CPT code (the $assesment) was not being sent to the demographic form for the HMO authorization request. This was because the $assesment needed to be passed as a single list item instead of separate items.
  • 01/07/1999 - redid the format of the temporary fax file for the fax HMO authorization request. Did not like the routine to insert more
    symbols because it made the HTML notes too narrow and wasted paper on the printed notes. Now the HTML notes are as wide as the HTML viewer will allow but the fax file now more then 70-80 characters so the fax conversion doesn't try to compress the characters on a line that is too long.
  • 01/08/1999 - reorganized the storage of the HMO authorizations. There is now a file for each patient that stores all thier authorizations and it grows as new ones are added. There is now a new directory for pending authorizations. The filename ending is stamped with the date and time it was created. There will need to be a mechanism for marking them when they are completed.
  • 01/09/1999 - added procedures into the progress note generator to make it into a history and physical synthesizer. Now you can choose which mode you want. Defaults to progress note mode. History an physical mode lays out data with different headings like Chief complaint, History of present illness instead of S.O.A.P format however, much of the data inserted is the same.
  • 01/12/1999 - added procedure "insertProblem" to the progress note generator to make it scan the patient's problem list file for the currently selected problem. If it is not in the list, it will be added to the problem list and stamped with the current date to become a permanent part of their problem list. Used regular expressions to search for the right place in the file to insert the problem.
  • 01/14/1999 - upgraded the above routine to allow inserting more than one problem into the problem list each time a progess note or history and physical is saved. It seems to work great. Used a for-next loop and lists.
  • 01/15/1999 - added a routine to the progress note_gen.tcl and the demographicform.tcl programsto generate a fax referral letter to consulting physicians offices. You add their names and addresses to the file ReferallLetterList in the demographics directory in the same format as the examples. The first element of the line in the ReferallLetterList must match an entry in the drugstorelist file in the drug_programs directory. This way, the TFP_drugrefill.tcl program still keeps track of the fax numbers and sends out these faxes just like for the drug refills. The patient's name, and the name and address of the consulting doctor are added by the computer to the letter and a copy of the progress notes you select from the progress note generator are inserted as well. Similar to how the fax authorization scheme works.
  • 01/16/1999 - changed the note_gen.tcl program to allow easy editing of the symptom and physical exam menubuttons by a right click on any of them. May try binding the text widget that comes up to allow clicking on a line to enter data into the note. This may be better for longer menus because the menus don't scroll and are akward when they get too long.
  • 01/17/1999 - added tag in menu editing windows in the progress note generator to allow double left clicking to insert phrases. This is much more convenient when adding a new phrase to the menus. The toplevel menu is better for long menus than the pop-up menus because they can be scrolled. Hope to add some other tags that could check for the patient's sex and add the appropriate pronouns and possesives.
  • 01/19/1999 - added tag in menu editing windows in the note_gen.tcl program to allow removing individual phrases from the progress note or H. and P.. Before, you could only remove the whole problem or the whole subjective, objective, assesment or plan part and had to start each one all over if you added something and wanted to remove it. The phrases turn red when inserted by a left click and turn black again after being removed by a right click.
  • 01/21/1999 - added a sort function to TFP_drugrefill.tcl so the drugstore menu choice buttons are in alphabetical order. They used to be created from an array get command which caused the order to be all mixed up and to change whenever you added another name to the list.
  • 01/21/1999 - added a routine to the demographicform.tcl program to allow adding or removing Dr.s from the referral letter list that will change the menu buttons for this selection. This will be expanded to the choices for the HMO office menubutton and the specialty provider and healthplan buttons later. Now, you have to actually go into the program and add choices there which is inflexible for regular users.
  • 01/22/1999 - changed the drug_information toplevel box in TFP_drugrefill.tcl to use the Itkwish scrolled html widget which works much better at rendering the html than the previous spynergy based version. If you want to print it, a button is provided which will load the file into netscape and it can be printed out from there.
  • 01/23/1999 - figured out how to do substitutions of variables or Tcl/Tk commands from the menus into the progress notes. in note_gen.tcl. This opens up a lot of possibilities for having the computer automatically inserting the patient's name, and the appropriate sex based pronouns such as he/she, his/hers etc. which I previously had to avoid. You can also use it for right-left-both substitution which is very useful and I included radiobuttons to choose left-right-both in the menu editor.
  • 01/23/1999 - added a spinner widget for the pulse in note_gen.tcl program.
  • 01/26/1999 - added bindings to menubuttons in demographicform.tcl to allow editing of list of specialists and list of specialties for the HMO.
  • 01/27/1999 - modified "LoadDoctors" procedure in TFP_drugrefill.tcl to allow reloading the menus for doctorlist, employee list and message list. Message menu now reconfigures - when you change doctors the name of the doctor in the message changes too.
  • 01/31/1999 - added function reminder in note_gen.tcl to send a future reminder date to the demographicform.tcl program which uses the procedure storereminder to store it in a file with the patient's name, address and reminder message that will be printed out after the future date as a reminder letter to the patient. Adds a note in the progress note that the reminder is being stored.
  • 02/01/1999 - added procedure in demographic form to allow editing the lists of PCP's, specialists and specialties in the menubuttons. Still need to restart the program to load the new menus. Will change that soon.
  • 02/02/1999 - modified the procedure authorization in demographicform.tcl to include PCP signature in the authorization form. to fax the signature, you have to save it from netscape as postscript. Might be able to save a Tcl/Tk html window as postscript instead if it is using the canvas widget.
  • 02/03/1999 - modified the "View Authorization" button in note_gen.tcl to a menubutton which allows you to either view the current patient's authorization file or you can see a list of all the files in the pending authorization file and browse them as desired. Need to add a function to delete the pending files when the authorization is completed.
  • 02/04/1999 - fixed bug in TFP_drugrefill.tcl in which the function for deleting a pending fax file did not recognize the selected file as a variable. This was because the routine was converted to a procedure from a global routine previously.
  • 02/06/1999 - added to the reminder procedure in note_gen.tcl so if a reminder is printed because the reminder date is reached, it removes the line from the ReminderFile. That way, the reminder will not be printed again the next time the procedure is run.
  • 02/16/1999 - fixed bug in test3.tcl program where it was not deleting the second page of a temporary fax file from the fax spool directory.
  • 03/02/1999 - fixed format in proc faxreferralletter in demographicform.tcl to insert 3 newlines between each note when writing the referral letter file to the temporary fax directory.
  • 03/15/1999 - added procedures in demographicform.tcl and TFP_drugrefill.tcl programs whereby when the files that save the data to load into the menus for the menubuttons are edited and saved, the menus reload themselves. Before, you had to restart the program to update the menus.
  • 03/29/1999 - began rewriting the programs to use the tcl++ widgets under Windows so the same program files can be used under both Linux and Windows. Finished the browsename.tcl program.
  • 04/04/1999 - wrote code for Linux that reads incoming fax files from Lab or Xray and allows quick storing in a directory for the currently selected patient's lab and xray results. The incoming faxes are received using mgetty+sendfax and the files are viewed using "viewfax" a small program for Linux.
  • 04/07/1999 - 04/10/1999 - finished converting the Windows version to the tcl++ widgets which are a pure tcl ( no compiled extension required ) implementation of the itcl widget set. Also converted Windows version to run under Tcl/Tk 8.05 using John LoVerso's comm.tcl library package that implements a send like command using Tcl/Tk's socket library. This allows the least possible differences between the Windows and Linux versions and makes maintaining the two operating system versions much easier.
  • 04/24/1999 - finished integrating two algoritms by Dr. David Pepper into the Windows version. They will now work the same way as the Linux version. One is for Sore throat and the other for asthma.
  • 04/28/1999 - moved the demographicform.tcl and note_gen.tcl programs to the drug_programs directory. Redid the GUI layout of note_gen.tcl so the buttons are organized more logically. Added a color chooser for the background color of the frames. Activated by right clicking in a frame.
  • 05/01/1999 - fixed some problems in demographicform.tcl that were keeping the windows version from being able to generate files needed for the HMO authorizatons. This was because I was still using some Unix specific external programs to move and append some of the file information. Now I'm using only the Tcl file command which is platform independent.
  • 05/10/1999 - cleaned up problem where a printed Rx for a patient could be inserted into a note for another patient if you changed the name of the patient and then started writing a note. Also have completely synchronized the Windows and Linux files - they are all exactly the same now.
  • 05/12/1999 - added program BloodPressurePlot and a button in TFP_drugrefill.tcl "vitals" to activate it. It scans the selected patient's progress note file using regular expressions and finds all the blood pressures and weights and plots them on a graph against the dates of the office visits. Has potential to be used for many other parameters you want to follow such as protimes, blood sugars, mammograms, prostate exams etc.
  • 05/18/1999 - fixed problem with edit and print buttons in TFP_drugrefill.tcl where they were not finding the file in the Url entry. Also I had not made this platform independent. Now the editing part is pure Tcl/Tk and the printing uses netscape on both Windows and Linux. Netscape has to be in your path on Linux and in Windows it has to be in the default location c:/Program Files/Netscape/Communicator/Program/netscape.exe.
  • 05/19/1999 - fixed syntax error on routine that would not allow success delete procedure to work resulting in some instances of multiple faxes being sent repetitively.

    Known Problems

    • The search button in TFP_drugrefill.tcl doesn't work in Windows version under tcl++ I don't know why yet.
    • Efax program seems to be rather fussy about which modems it likes. I have used US Robotics Sportsters 33.3 internal fax modem and a BOCA 14.4 internal fax modem. These are class 2 modems and seem to work well with efax. A Diamond 33.3 faxmodem which is class 1 doesn't work with efax, although mgetty+sendfax will work with this type. Currently only efax is working with the program. Although earlier I did use mgetty+sendfax to send faxes, I now use it only for receiving the faxes. I haven't included any code for this program. You will have to compile it or install it yourself.
    • There aren't too many drug interactions, or drug information files entered at this time. You would have to put these in yourself. I've just provided the mechanism for them and a few test files, also the synonyms for only a few drugs have been completed. These can be updated gradually as you use the program, however, which is how I gradually built up the drug dose files. You only have to enter a dose or interaction one time.
    • In Linux it is necessary to install the whole mess as root and it may not run right unless it is installed from the root's home directory which on my system is the directory /root. I am trying to clean this up. I had it working from any home directory but then I added a lot of new features and haven't had time to go in an change all the instances of the absolute path /root to a variable which will allow installing it anywhere. The /var/local/bin directory which is the spool directory for the outgoing faxes will always probably need to be created by root.
    • I don't have a very good mechanism for a unique patient ID. I just make sure the names, if the same, include some unique feature such as the middle initial or if that was the same, you could append a birthdate like _09_Sep_1948 to the person's last name to make sure they are distinguishing patient's with similar names.

      Future Enhancements

        • Develop install program that on Linux would install everything in the users home directory. This was working but needs to be cleaned up again after major additions to the program in last few months.
        • Need an installer program for Windows95, including adding appropriate lines to the autoexec.bat file to add the program directories to the users PATH.
        • Enable the paste from the Windows95/98 clipboard into the text widgets.
        • Add a button to enable or disable the help balloons.
        • Set up windows95/98 version to print from ghostscript instead of netscape or add control to let user decide which printing route to use.
        • Consider moving progress_notes, problem_list, demographics, drug_refills and drugs directories on Linux machine to the windows directory tree, this way you can operate on the same files from either Linux or Windows 95/98 on a dual boot system. (Has been done for the progress notes). The main problem is that the windows files can have only one owner which is the only one who can write to the files. This is the user that mounts the directory i.e. "root" unless the directory is mounted with the option user,rw option. Then it is still necessary for the user to mount the directory if it is mounted under root or another user. Otherwise, they can't write to the files.
        • Add lab results display for each patient - could be in html table format or use text widget with grid option. Hopefully use data transmitted from the hospital electronically so it would just automatically be there in the right place. This would be easy to implement on my end but requires the actvive cooperation of the hospital programmers which I have found to be a difficult stumbling block. They just don't get as excited about all this as I do. I have added a temporary lab results display that just stores and displays faxes you directly receive on the computer using mgetty for the time being. I did experiment with OCRshop for Linux on a trial basis and it seems to work pretty good. Right now my lab can only send me faxes not computer files so I may play with OCR and see if I can write a script that will convert the faxes and then store the lab results automatically for each patient.
        • Make the toplevel for the problem list into a tabbed notebook for the PMH, problem list and imortant recent procedures and immunizations.
        • Encrypt the stored data on the hard disk automatically, requiring a password to view patient inforation. Could be done with "ripem" a freely available program that is used in the socket based refill request programs already when transmitting a request over the network.