Vell, Zaphod’s just this guy you know?

HL7 Common Terminology Services for MED

by chintan patel on October 2nd, 2007

Recently I had to work with HL7 Common Terminology Services and it was surprising how fast I was able to integrate the MED (Medical Entities Dictionary - the local terminology in use at NYPH) with it. In a nutshell, the Common Terminology Services (CTS) interface specifies a set of API calls to vocabulary/terminology to fetch relevant information, e.g. what is the ‘descriptive name’ for a given code or what are subclasses for a given code and so on.

The informatics group at Mayo provides an excellent reference implementation for the CTS API in Java - they have 2 implementations: one that works with their LexGrid local information model (with Lucene, LDAP etc) and other basic implementation for HL7 Reference Information Model (RIM) schema. They also provide sample databases to test the implementation out-of-the-box! Although, I use Mac OSX and HL7 RIM implementation would only work with MS Access database, so I had to transform MDB to MYSQL using this utility.
The next step was to import MED into HL7 RIM schema. So from the CTS implementation of Mayo, I tracked down the SQL queries and hence the terminology-relevant tables in the RIM

VCS_code_system: contains the metadata about the terminologyVCS_concept_code_xref: stores the actual codes but it also uses integer based internal ids for better indexing

VCS_concept_designation: contains the descriptive information for a code.

Then I had to make a Web Service/SOAP wrapper for it. I looked into available tools after a gap of about 4-5 years and I was amazed at the easiness of starting up a Web service.

  1. The Apache Axis folks have completely re-designed and re-written the older version Axis toolkit. The new version, Axis2, is more efficient and speedier with low memory-footprint. They rewrote the entire XML API (StAX) to achieve greater speed.
  2. The Eclipse Europa release with Web Tools Platform provides a one click creation/testing of Web services with Axis2. They also have an inbuilt Web services Explorer to test your service
  3. Mayo folks provide all of the CTS implementation and its dependencies in a SINGLE JAR file!! so all I had to do was dump the file into WEB-INF folder.

In all, I was able to get HL7 CTS API to MED up and running in matter of few hours!!

I m now looking for an internal server to host this and put the HL7 terminology tables in some in-memory database — and do some performance comparison with QRYMED - the tool currently used to interface MED for the information systems at NYPH.

Need a Break?

by chintan patel on December 10th, 2006

There seems to be a common need to put “breaks” in your X or Y axes while showing a dataset having large variance for some part. I recently ran into similar problem and there doesnt seem to be any inbuilt functionality in Matlab or Excel to do such things. Here are some of the possible workarounds:

Matlab Solution
I found a script BreakAxis in Matlab Central that exactly does that, however it seems to be engineered for plotting XY scatter plots - However, there didnt seem to be any funtionality for a bar plot. I ended up hacking the original code to work with Bar Plots
Bar Plot Fix for BreakAxis

1. The original code doesnt do a good job, when the “cluster” of XY values are separated by a large margin, for example, see the snapshot below:

Break Plot
BreakPlot(rand(1,201),[1:100,1000:1100],100,1000,’RPatch’);

2. Secondly, with the Bar Plot, one needs to scale the Y bars to make them comparable to the smaller ones. Hence, I added a ’scale’ parameter that will reduce the tall bars to make them fit into the graph.

scale = 0.95;

Y2(Y2>=y_break_end)=Y2(Y2>=y_break_end)-(Y2(Y2>=y_break_end)*scale);

bar(Y2, 1);

Also the yticks labels have to be scaled to reflect the change.

ytick(ytick>y_break_start)=ytick(ytick>y_break_start)+(Y(Y>=y_break_end)*scale);

here is the bar graph generated from the code

Break Bar
I have uploaded the BarPlotBreak.m matlab code is here and on matlab central

Microsoft Excel Solution

There are some workarounds to add breaks to your axes in M$ Excel but they need some additional ‘excel components’ and the overall procedure was really painful.

I found a simple solution steps to avoid the whole hassle

1. Manually change the Y bar values to make them comparable

2. Create a ‘wavy’ image as this and add to the Y axis.

3. Using the Drawing Toolbar (View->Toolbar->Drawing), add a ‘TextBox’ with white background over the Y axes where the scaled values are needed.

4. thats it !.

Below is an snapshot from one of my papers. The changes are circled red.
Excel Bar

Enjoy The Break !

News, Media and NLP

by chintan patel on November 20th, 2006

Recently in a poster/demo of Epitrends.org at AMIA 2006, we received several interesting feedback and insights. Someone showed us a news story that denied false rumours of the outbreak and we were counting it towards the “growing trend” (that was embarrasing :<)
In retrospect, I think its a very difficult problem if we consider it myopically as NLP only problem -- the larger picture, I think, is that the news media throws around so many speculations (positive and negative views) of issues that after a while it is just pointless trying to make "meaning" out of such statements.

I was looking at Google News now.. and something caught my attention

Google News Negation

The NYTimes story is reporting about

“Pentagon officials conducting a review of Iraq strategy are considering a substantial but temporary increase in American troop levels and the addition of several thousand more trainers to work with Iraqi forces, a senior Defense Department official said Monday.”
Whereas the ABC News is saying
There are no plans for a short-term increase in U.S. troop levels in Iraq, despite rumors that American forces could be temporarily boosted by as many as 20,000, a highly placed military source told ABC News.”

oh wait there is a third story in the cluster titled “Does Michael Jackson offer way to leave Iraq?
Automated bag-of-word like approaches can only go somewhat far - the real challenge lies in identifying the “global message” of a news story and asserting whether the story is “conclusive”, “negation” or just a “speculation”. I think building a “Assertion Strength Classifier” for news stories would be an interesting addendum to Epitrend to chaff off rumours and speculations.