Legacy Health IT: Case of the MUMPS

I recently recalled an article at The Daily WTF I read a while back on legacy health IT software, specifically regarding the language MUMPS, or “M”. It was developed by Mass. General Hospital and was pretty innovative in its time.

But that was 1960. Programming language have diversified and evolved (I like Python). But looking at a sample of code (Wikipedia) from this language makes it easy to understand why these large health IT companies find it hard to have an agile approach to software changes:

Here is some example code from Wikipedia:


%DTC
%DTC ; SF/XAK – DATE/TIME OPERATIONS ;1/16/92 11:36 AM
;;19.0;VA FileMan;;Jul 14, 1992
D I ‘X1!’X2 S X=”" Q
S X=X1 D H S X1=%H,X=X2,X2=%Y+1 D H S X=X1-%H,%Y=%Y+1&X2
K %H,X1,X2 Q
;
C S X=X1 Q:’X D H S %H=%H+X2 D YMD S:$P(X1,”.”,2) X=X_”.”_$P(X1,”.”,2) K X1,X2 Q
S S %=%#60/100+(%#3600\60)/100+(%\3600)/100 Q
;
H I X<1410000 S %H=0,%Y=-1 Q S %Y=$E(X,1,3),%M=$E(X,4,5),%D=$E(X,6,7) S %T=$E(X_0,9,10)*60+$E(X_”000″,11,12)*60+$E(X_”00000″,13,14) TOH S %H=%M>2&’(%Y#4)+$P(“^31^59^90^120^151^181^212^243^273^304^334″,”^”,%M)+%D
S %=’%M!’%D,%Y=%Y-141,%H=%H+(%Y*365)+(%Y\4)-(%Y>59)+%,%Y=$S(%:-1,1:%H+4#7)
K %M,%D,% Q

Compared to some example Python code:


my_list = ['john', 'pat', 'gary', 'michael']
for i, name in enumerate(my_list):
     print "iteration %i is %s" % (i, name)

I’m being a tad unfair here, as the above MUMPS code does not simply print a list of names (I think), but what should be clear is the degree to which some of this legacy health IT code is completely un-manageable. It might be worth asking your large EMR vendor which types of platforms they are using and what they think of their ability to add features and fix bugs in a timely manner.

Tags: , , , ,

6 Responses to “Legacy Health IT: Case of the MUMPS”

  1. Rob Says:

    It is unfortunate that the Wikipedia entry for Mumps contains this example of Mumps code: any programmer who wrote code that looked that like these days would be summarily fired because, as you suggest, it is almost impossible to understand and hence maintain and support. Actually there are historic reasons for that code snippet being written the way it was at the time.

    Like any language, it can be used or abused. Well-written Mumps code can be just as comprehensible, neat and tidy as Python code.

    By the way, these days, more and more people are using other, more mainstream, languages, such as Python, to access the Mumps database of legacy systems. The real key to the prolonged success of Mumps in healthcare has been the database, not the language.

    Meanwhile, Mumps is proving quite capable of supporting all the very latest techniques and technologies. For example, it underpins arguably the fastest and most efficient development platform for iPhone Apps – see http://www.mgateway.com/iwd.html, and in particular check out the videos under the Resources tab.

    To that end, legacy healthcare apps written in Mumps actually have a secure future in terms of keeping up with modern trends and developments.

    One last thought – if you want to see a language that has shot up in popularity but is almost totally incomprehensible and unmaintainable, take a look at Objective-C. Give me a pile of Mumps code any day in preference to that byzantine nonsense.

  2. Sam Habiel Says:

    You know, the only thing that the Mumps example is missing is
    comments. Otherwise it’s a very nice and succinct piece of code
    written in the style of early Mumps which I cannot fault given
    hardware limitations and language development at that time. I don’t
    know if anybody realizes this, but this is the fileman routine %DTC,
    an integral part of VISTA (see documentation at
    http://www.hardhats.org/fileman/pm/cl_dtc1.htm).

    The author’s comparison isn’t fair. This code does some pretty damned
    complex stuff (gives you the difference between 2 dates); the python
    code is just a potboiler.

    I personally cannot argue with the author’s point: most of VISTA code
    looks like that; and is difficult for outsiders to refactor. And the
    history of VISTA development informs us that it pretty much froze any
    development in the early to mid-90’s; much of the innovations of the
    90 and 95 M standards have not been applied (parameter passing; newing
    variables; never mind transactions). Notice in this example that the
    programmers gets the parameters from the symbol table an kills the
    variables at the end of the snippet… that pretty much dates it to
    before 1990.

    Sam

  3. orlowski Says:

    Hi guys,

    Thanks for the comments; They are always appreciated. I should have been more careful about comparing code. Such language comparison arent’t really productive.

    I did have a chance to meet and talk in person with Nancy Anthracite, the President & Chief Medical Officer of WorldVistA at a DCLUG meeting. She talked a lot about WorldVistA, the VA and MUMPS and spent much time praising the language.

    So perhaps I should distill the point I am trying to make: When researching EMR/EHR software, deeper questions can be asked when a vendor claims they can mold an existing piece of software to fit any office workflow. If code is poorly-written (in any language), updates, upgrades and knowledgable programmers willing to code them will only get more expensive.

  4. Kevin Toppenberg Says:

    I agree that much of the old code in VistA are written in an older style. I consider that code to be “compiled” code. It was done to squeeze performance out of older hardware. But many new coders (myself included) don’t use this style anymore. There are tools that can covert this into a more readable format.

    By the way, the Mumps version of this python code:

    my_list = [‘john’, ‘pat’, ‘gary’, ‘michael’]
    for i, name in enumerate(my_list):
    print “iteration %i is %s” % (i, name)

    would be (and I realize it is not exactly the same):

    for name=”john”,”pat”,”gary”,”michael” do
    . write “Name is “,name,!

    That’s not so scary, is it?

  5. orlowski Says:

    Indeed, it is not 🙂 I appreciate the civility with which you guys have updated my knowledge of modern MUMPS.

  6. kd4ttc Says:

    I am affiliated with a hospital that runs EPIC EMR, which means they use MUMPS as the underlying database technology. Anyone know of a Django App or module that allows access to a MUMPS database?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: