FreeMED Review

From GPLMedicine

This is the review of the FreeMED Project written by the community. This review was initially written by Fred Trotter. The user community is very grateful to him.

Contents

History of FreeMED

FreeMed Software Foundation has a webpage which includes the history of FreeMED. The predecessor to the FreeMED begun in the 80s but the web-based project was officially released in 1998. Even so, this makes FreeMED the oldest of the PHP based projects. FreeMED has been forked several times. Developers have left FreeMED to form FreePM, which was the predecessor for the TORCH project, the FreeMED-YIRC project, the FreeB project and most recently, the ClearHealth project. The primary author of FreeMED is Jeff Buchbinder. Jeffs father, Irving Buchbinder has been instrumental in moving FreeMED forward. The FreeMED project has continued to move forward, adding feature after feature and slowly becoming a very substantial project. FreeMED is known for very conservative version numbering, and as of the writing the latest version is 0.8.3. The sourceforge download will display the latest version. sourceforge FreeMED downloads. FreeMED originally used the FreeB medical billing engine. It was later replaced with REMITT, a completely new billing and formatting engine. FreeB development also continues and is in use by other FOSS EHR projects.

Jeff Buchbinder clarified some inaccuracies mentioned by others regarding the REMITT project:

REMITT is a very suitable, faster and efficient billing engine and here is a point-by-point reasoning of this:

1. Remitt is also written in Perl.

But the actual code that performs the action of transforming and transmitting the billing data is programming language agnostic. It is completely possibly to rewrite REMITT in C/C++ or something else ... The only reason Perl was used was its excellent PDF rendering libraries and support for XML-RPC using SOAP::Lite. I wouldn't consider this anywhere near as much a liability as FreeB's dependence on Perl, since it is so intrinsically tied to the language for all of its processing. All of REMITT's actual processing is performed by the Perl interface to libxslt, and is completely customizable using simple XSL tranformations.

2. Remitt has a complex format system.

REMITT uses a W3C standard (XSL), and a simple monolithic XML format with XPath to traverse the object model. It requires no actual coding skill to create and/or modify formats, just XSL skills. This is far superior to the meta-compiled format that FreeB (editor: jeff is referring to FreeB 1.0, FreeB 2.0 is written in php and uses smarty for templating it should be noted that OpenEMR uses the 1.0 version and ClearHealth/MirrorMed uses 2.0) currently uses, which is an XML descriptor format, but which requires Perl coding knowledge to actually modify the guts of the processing routines. It's also non-trivial to add additional rendering types, since the looping involved can vary wildly from the implemented Perl code.

3. Licensing

FreeMED and REMITT are licensed under the vanilla GPL, as referenced at http://remitt.org/license.html

FreeMED Trademark

Currently the trademark to the word FreeMED is owned by Chris Beggy, who was an early project participant. He graciously allows the use of FreeMED by the FreeMED Software Foundation.

Chris does not define what codebase merits the name FreeMED, instead he allows the use of the Trademark for any open source EHR project. Nonetheless it is generally understood that Jeffs version of FreeMED is the legitimate one, largely due to Jeffs longstanding role as the administrator of the sourceforge project site for FreeMED. As a result there is no restriction on who can offer FreeMED services

FreeMED Community

FreeMED is highly internationalized with 6 translations completed and another 4 in process. The project is in the process of building, country by country, representatives of the project in each locale. At this time Philipp Meng is the first certified representative for FreeMED in Germany.

The FreeMED project has changed the method of development so that we will be able to compensate some of our community developers for work done. Our hybrid business model separates the Foundation from the business and support group.

The FreeMED project also releases a LIVECD. Usually within two to three weeks of release of a stable candidate (as of February 2006 that will be 0.8.2) a LIVECD is released for download. A LIVECD allows testing of FreeMED and features from any computer operating system by using a Knoppix distribution which then runs FreeMED from the CD-ROM drive. It does NOT store information nor is it appropriate for a live installation but does give a feel for how the program works and functions. To enter and manipulate data use the FreeMED Info demo site.

The chief architect of FreeMED is Jeff Buchbinder. Features are added at the direction of the FreeMED Software Foundation with suggestions from the community. This is substancially different from a project "mamager" role, Jeff is essentially the only developer on the project. The developer stats performed as part of the subversion study of the FreeMED project shows that Jeff Buchbinder has committed more than 90% of the codebase.

person percentage

rufustfirefly 71.1

jeff 22.7

fforest 4.2

- The user rufustfirfly and the user jeff are both Jeff Buchbinder. The second largest contributer was 4.2 percent. Jeff Buchbinder is employed by B-Mas making FreeMED largely developed by a single person. Of course it is possible that other users can contribute by sending patches to Jeff, it is not possible to sustain any kind of group development in this manner.

FreeMED Commercial Support

FreeMED support can be purchased through

B-Mas

Unified Medical Informatics (UMI)

UROWeb, LLC

Recently the support options for FreeMED have become confusing. Of the three companies listed about appartently, B-Mas considers UMI a subsidiary. Further, the blogosphere reveals that UMI is suing B-Mas

FreeMED Websites

FreeMED has several websites:

FreeMED Installation

See the EHR Installation Review Process

FreeMED Installation Procedure

FreeMED comes with generic debian and rpm packages. Arguably this makes them the most advanced installation routines available. However I am unable to use these because I use Fedora with XAMPP and not the rpm versions of mysql, apache and php. This servers as a reproducable test environment, but it also means that I will be unable to test the rpm and debian installations. If you can test these install formats, please replace this paragraph with your review.

FreeMED, like openEMR and ClearHealth/MirrorMED, is a LAMP application. That means that to use them you need to have some familarity with Linux/Apache/Mysql/PHP. I went to the web directory on my linux server and untared the tar file that I downloaded from freemeds sourceforge page. I used the following command to do this.

tar -xzvf freemed-0.8.1.1.tar.gz
mv freemed-0.8.1.1 freemed

The FreeMED tar politely untarred to a subdirectory called freemed-0.8.1.1 but I wanted it to live under the more simple freemed directory name. Thats what the second command does. Note that on different releases of FreeMED the file will be named something different.

At this point I pointed by webbrowser to http://localhost/freemed/ and found, pleasantly that I got an error message regarding the configuration of my index.php vs index.html. I am not sure why the index.html simply does not forward the user to index.php, but still, they had thought of this.

Then I pointed my browser to index.php and got another error message. This error message indicated that I needed to have modify the freemed settings file before I attempted to install the system. I used vi to change the database configurations in the file...

freemed/lib/settings.php

to something that I knew would work. However I did not create a "freemed" database I wanted to see how the installer would react to an absent database. Then I returned to the web browser and refreshed. The system asked me for the database username, database password and asked me to create a unique admin password. After placing the information I pressed the "Sign In" button, but the installation crashed with the error.

sql->constructor(SQL_MYSQL) : could not select database

This is due to the fact that I did not create the database before hand. I used the command...

mysqladmin -p create freemed 

to create the database. The screen responded with...

Database Password Accepted...
User table created.
Admin password set.
Dynamic modules database initialized.
FreeMED configuration database initialized.
All modules initialized.
You will now be returned to the the login prompt.
You can login using:

username=admin
password=WHAT_YOU_JUST_ENTERED 

replace WHAT_YOU_JUST_ENTERED with the admin password that you just created 

and a link to the main website. However, when I clicked the link I got an error that read.

FreeMED was unable to create a file to record the healthy status of the system.
The FreeMED directory should be owned by the user that the webserver is running as...
Usually this is 'apache'. You can also fix this by giving universal write access to the home directory of FreeMED.
But that is not advisable from a security standpoint. 

To fix this I used the command

chown nobody:nobody freemed/ -R

After this I was successfully loaded the login page, and using my login password I was able to get access to FreeMED.

FreeMED Installation Conclusion

At least on error from the FreeMED installation routine was not caught by the installer. This is especially confusing because I orginally wrote the code for the installer for both FreeMED and ClearHealth. I making the ClearHealth code I re-used the code from the FreeMED installer that detected when a database did not exist and installed it when it did not exist.

One of my great frustrations as a contributer to the FreeMED project is that features that I develop are dropped by the project. It appears that this has happened again. For some reason, the system attempts to access the database before getting to the code that tests whether the database is accessible, and deals with this appropriately. Also, instead of simply creating the database for the user, the system would simply output instructions for doing this on the command line.

The FreeMED installation is quite secure, there is a check to make certain that the initial configuration occurs from the localhost, and the web user must prove that he knows the database password in order to change the administration password for FreeMED. FreeMED does not use a default password.

In summary...

  • Catching Errors - Poor (requires one to understand a SQL error)
  • Ease of installation - OK (required one to perform mysqladmin work, but otherwise good)
  • Security - Excellent (provided IP, and database level security checks)

FreeMED Medical Billing System

The FreeMED Medical Billing engine is called REMITT. There have been allegations stating that REMITT is a derivative of FreeB, however the REMITT FAQ indicates that it is now a completely new codebase, which has been explained at great lengths by the main REMITT developer, Jeff.

From the REMITT website, REMITT is...

a revolutionary medical information translation and transmission system, which is primarily used for preparing and submitting medical billing data.

REMITT uses extensions of XSLT to transform XML claim information into various medical billing formats. It appears that this process is in the process of being patented, however, the code has recently changed to the GPL. So it does not appear that any patent can be used to the detriment of the FOSS community.

Currently REMITT supports the following formats

  • HCFA-1500/CRM-1500
  • ANSI NSF X12 837 Professional (X12 837p 4010A)

FreeMED Medical Accounts Receivable

medical accounts receivable will have to wait for a full medical billing review

FreeMED Scheduling System

There are a total of five calendaring views available in FreeMED. The first two are the users day and week view. They are accessible from the home screen and from the "User" main menu item. The day view displays the appointments for the current user and the week view displays the weeks appointments. It is not possible to schedule from these views.

Both the week view and the day view suffer from the double scroll bar problem. It appears that the calendar inside an iframe inside the main window. (Though no iframe is used) This means that there could be unpredicatable results when printing or when using FreeMED with smaller screens. On the 6.0 version of Internet Explorer that I am using for testing there is a half hidden scroll bar at the bottom of the page.

The other three calendars Anesthesiology Calendar, Daily Appointments and Group Calendar, are available under the Main->Calendar. The anesthisology allows the user to schedule for some for different locations and presumably in overlap of other provider types. It strange that a seperate schedule exists for this particular type of provider, instead of developing a generalized approach like ClearHealth/MirrorMed. That system allows for the corrdination of many different provider types and locations. It is unclear why anesthisology would be singled out like this, but it was probably to scratch a particular itch.

The next item on the Main->Calendar menu is a system to print a report of the daily schedule for a provider. Interestingly a bit of AJAX is used here to allow for provider selection in an autoselect fashion. (like google suggest).

The last Main->Calendar option is Group Appointment. After clicking the monthly calendar to select a particular day, this displays calendar with every providers appointments.

There are two ways to add an appointment. From the patient record it is possible to add an appointment, by clicking "add" in the appointment block. This will take you to a new clickable calendar interface. First one must use a small monthly calendar in the top left to select the day. After this you can select the patient, template, provider, duration, facility and next available. After modifying these values you select an open time on the calendar display, which will take you to an appointment confirmation screen. This confirmation screen will summarize the appointment and request information about which room to use, and allow you to add a note. At this point you can click "Confirm Booking", and the appointment will be created.

It is also possible to schedule an appointment without starting from a patient record, by going directly to the Patients->Schedule menu. This will bring up the same day schedule used above but without the patient section prepopulated. By typing in parts of the patient name, it auto matches values in the patient database. This functionality is similar to the suggestions that automatically appear when you type in search queries to Google. This functionality is called "Google Suggest" for the sake of clarity, this functionality can be called "Patient Suggest".

The FreeMED scheduling system has the feel of several seperate systems pasted together, it lacks several important features that are important in a medical scheduling engine. The FreeMED scheduling does seem to not allow for mulitple room scheduling. FreeMED cannot visually display the schedules for particular rooms. However it is possible in this version of FreeMED to select relatively good "Next Available" variables. So that you can simply choose the next blank time given certain simple constraints. Also the patient suggest feature is very advanced and clever use of AJAX. Overall the FreeMED scheduling system has potential but it needs to be made simpler to handle multiple providers schedules in multiple locations, it should also be possible to schedule from a week view.

Tracking Patient Data in FreeMED

Tracking patient data is not included in this version of the review

FreeMED Reporting System

FreeMED has confusing reporting engine that I was not able to test properly. There are two report areas, the first is found by going to Main->Reports. There are several reports here, some of which generate system errors when clicked.

The second layer of reports is found by clicking the "Query Maker" link on the first report page. This brings up the link to the Agata reporting system. FreeMED makes use of the Agata project, which is a separate reporting engine. Although the demo that was reviewed was buggy, this in theory gives FreeMED a considerable ability to generate arbitrary reports. Although Agata is powerful, the native language of the project is Portuguese, which can mean that documentation in English is lacking.

FreeMED Security

Like both of the other php based products, FreeMED uses phpGacl. Like all of the projects, FreeMED only lightly integrates the projects code. The standard phpGacl interface is used in FreeMED too.

FreeMED Architecture

FreeMED had the following results from the cyclic_guess script.

  • Total Files 357
  • Average Complex 20.6
  • Average Functions 11.04
  • Average Ratio 2.68

The goal of the cyclic test is to measure the complexity of the FreeMED project. Not the projects that FreeMED is based on. Libraries that where largely unmodified, like PEAR, and phpgacl, were not included in the review. However, the agata reporting libraries are left in because they have been modified extensively by the FreeMED project.

Take a look at the cyclic_guess summary for review 1

FreeMEDs cyclic guess ratio chart (for the time being cannot load images directly into the page because of a server error )

Some of the most complex files are central to FreeMEDs operation...

  • ./patient.php 1038 lines
  • ./show_appointments.php 206 lines
  • ./custom_records.php 525 lines
  • ./admin.php 396 lines

patient.php is an excellent place to start, since it is the most complex file, and it is central the emr. patient.php is the central patient searching system. Once a patient is found, a link to manage.php is listed. manage.php then loads the various emr modules and presentes them to the user. But for now lets stick to patient.php. patient.php is a single large file with no internal functions (although it calls functions from other parts of FreeMED). The file is primarily composed of GUI code. This code is mixed in with the logic of building the SQL queries needed to create lists of patients. So in one moment the code reads...

		html_form::form_table ( array (
			__("Salutation") =>
				html_form::select_widget(
					"ptsalut",
					array (
						"--" => "",
						"Mr" => "Mr",
						"Mrs" => "Mrs",
						"Ms" => "Ms",
						"Dr" => "Dr"
					)
				), 

			__("Last Name") =>
				html_form::text_widget("ptlname", 25, 50),
    
			__("First Name") =>
				html_form::text_widget("ptfname", 25, 50),

which is referencing the html building capabilties in phpwebtools. (phpwebtools is a parallel library project that is also managed by Jeff Buchbinder). It is easy to see how the the code above could translate into html code. Later in the same file you find...

    case "soundex":
        $query = "SELECT ptlname,ptfname,ptdob,ptid,id FROM patient ".
         "WHERE (soundex(".addslashes($f1).") = soundex('".addslashes($f2)."')) ".
	" AND ptarchive+0 != '1' ".
	 freemed::itemlist_conditions(false).
         "ORDER BY ptlname, ptfname, ptdob";
        $_crit = "Sounds Like \"".prepare($f2)."\"";

In this file as in the other three files mentioned above, there is SQL code freely mixed in with HTML code. This known in software design as Model 1. Model 1 mixes presentation code with logic code. Suppose that someone wanted to access FreeMED in a different way than via HTML. In order to do that these the functionality offered in these files would have to be totally re-written in order to work with that interface. It should be noted, that one file that does not seem to follow this pattern in manage.php. manage.php is a mere 57 lines, much less than the other files. This file performes some security functions, then farms most of the work out to a template system, which then loads the various modules of that handle aspects of the patients EMR. The template engine works much like the files above, but instead of accessing the database directly the template creates html and then inserts the html generated from the various modules.

The modules is where the core of the FreeMED EMR design lies. Each modules can have the following.

  • version Information
  • minimal version of FreeMED needed to run
  • functions to add data
  • functions to display the summary
  • functions to display detail
  • functions to create the data entry form
  • logic to update this portion of the EMR

The modules system in FreeMED is very complex, however there is considerable documentation on the subject available at the FreeMED API documentation

Generally the module system in FreeMED is different than standard software design. There is continuous and intentional mixing of display logic and business logic. The modules are not designed with standard programming practice in mind, rather they are designed with the needs of an EMR in mind. There is care taken to ensure that that each module of the EMR is independantly versioned. Different versions of the module are associated with a core version of the FreeMED project. There is effort to document the transitions from different versions of modules in the modules themselves. Each release of the module is intended to be able to upgrade the underlying sql tables that the module relies on. The modules are capable of displaying summary information, which is displayed together with all of the other modules on the patient management screen. But each module is capable of creating a full interface for its own data, which is displayed alone. FreeMED is designed to handle the differences between different generations of emr modules and therefore emr data.

It is difficult to review the architecture of FreeMED. It uses templates, but only superficially. The layout of the html is either controlled by the mega files that perform large portions of behavior (find patients, perform admin) or by modules. The modules themselves fly in the face of conventional programming methodology. The idea of maintaining data modularly seems to be a good one, but having ALL the funcionality for a particular set of data in one place seems problematic. Still the care FreeMED takes with versioning is an excellent idea.

If the FreeMED modular EMR idea could meet with a more standard MVC design. So instead of

modules/allergies.emr.module.php 

you might have

modules/allergies/allergies_model.php
modules/allergies/allergies_view_html.php
modules/allergies/allergies_view_summary.php
modules/allergies/allergies_view_wap.php
modules/allergies/allergies_controller.php

This would maintain the strengths of the FreeMED system, its modularity, but then also allow it to perform in other interface environments more easily. The core files such as the four mentioned above, should be refactored toseperate business logic and presentation logic. In short FreeMED needs to maintain its modular design, without ignoring standard OOP principles.

The FreeMED may be moving towards a more OOP design. It looks like there might be an effort to decouple the GUI from the data access

FreeMED CCHIT evaluation

CCHIT evaluation will not be performed for this version of the review

FreeMED emrupdate.com matrix

emrupdate matrix will have to wait for the next version

FreeMED Documentation

The general user and admin instructions for FreeMED are in the user manual.

FreeMED Conclusion

FreeMED is the oldest project, it's active development is directed by the Board of the FreeMED Software Foundation, and supported several companies. It uses a modular architecture, that is based on the capabilities of php 5. It has multiple features not found in other FOSS EHR projects.