Archive for November, 2006

11.28.06

National Strategy Workshop on eMedication

Posted in Architecture, Conferences, Presentations, SOA at 1:54 pm by kkj

This thursday I was invited to speak at a national strategy workshop on medicines data arranged by MedCom with the purpose of discussing the current situation, the vision, and what needs to be done to get there. The last speaker of the day, I presented DGWS from the context of the SOSI project and the challenge, which started it all: to be able to exchange data between EHR medicines modules and the national medicines profile (PEM) at The Danish Medicines Agency.

Rather early in the day, it was agreed that the vision for medication in Danish EHR should be:

  1. Health care personnel must have easy access to correct and up-to-date information about the current medication for the patients they treat.
  2. M.D.s must have easy access to complete information about drugs, their usage, and effect.
  3. Patients must have easy access to correct and up-to-date information about their own medicines and how to administer it.

All slides from the workshop are available from The Danish Medical Association where the conclusion of the workshop is also available (in Danish).

11.11.06

Meet Silver Bill

Posted in .NET at 1:56 pm by kkj

He is there 24×7, he will always reply, and you can tell him anything! Meet Silver Bill. Online psychiatrist extreme who can only be reached thru MSN Messenger.


Silver Bill hard at work

Since fooling around with scroll texts in Delphi over Messenger last year I have been wanting to write a small chatbot that would run over IM in dot-net, but haven’t had a really good reason to dive into it. Well the holiday season is near, and I am responsible for the company x-mas party. What better way then than to announce the details through our new virtual employee in the H&R department?

Silver Bill is a dot-net port of Charles Hayden’s 2002 Java version of the renowned virtual shrink Eliza as originally invented by Joseph Weizenbaum in 1966. Bill works like Eliza, but has been spiffed up a bit with the finer details of when and where the Silverbullet x-mas party will take place. To protect this event from being overrun by the press I have, however, deleted them from the configuration file in the downloadable zip.

MSN Messenger plugins must implement the IMessengerAddIn interface, which defines a few lifecycle methods. When the plugin initializes, Messenger calls the Initialize method, passing in a MessengerClient instance that can be used to manipulate the running instance a bit.

When a message arrives from a chat buddy, Messenger calls IncomingMessage and this is where Bills inner Eliza kicks in and makes a proportional response by analyzing the message, matching it against the configuration file and picking the right line. Bill has a set of different images and status texts that he cycles through, randomly deciding whether to move to the next picture and text or not. This happens right after the reply has been sent.

The last two callback methods, Shutdown and StatusChanged are not in use by Bill. The code digest below shows the interface implementation, constants and initialization code omitted:


namespace ElizaMessenger
{
public class ElizaAddIn : IMessengerAddIn
{

public void Initialize(MessengerClient client)
{

}

public void IncomingMessage(object sender, EventArgs args)
{
IncomingTextMessageEventArgs eventArgs = (IncomingTextMessageEventArgs)args;
String response;

try
{
response = eliza.processInput(eventArgs.TextMessage, eventArgs.UserFrom.FriendlyName);

if (isFirstMessage)
{
isFirstMessage = false;
response = “Hey ” + eventArgs.UserFrom.FriendlyName + “. ” + response;
}
}
catch (Exception e)
{
// Dump exceptions onto the response window.
response = “Exception:” + e.Message + ” - ” + e.StackTrace;
}

m_client.SendTextMessage(response, eventArgs.UserFrom);

// Switch image at 50% probability
if (random.Next(100) < 50)
{
setImage(images[imgCount++ % images.Length]);
m_client.AddInProperties.PersonalStatusMessage = statusmsg[msgCount++ % statusmsg.Length];
}
}

public void Shutdown(object sender, EventArgs args)
{
Console.WriteLine(”Shutdown: {0}”, args.ToString());
}

public void StatusChanged(object sender, EventArgs args)
{

}

}

}

I figured out how to do the MSN limbo by reading up on an MSDN Article which goes over the interface. It isn’t all that fantastic, but gives you a starting point. For details on tweaking the configuration file, please refer to the original Java version.

For the caveats:

  • This being my first .NET application, and at that a port from Java the style is probably not optimal
  • Bill will currently share state among multiple chat sessions. This makes him less convincing, but I haven’t had the time to fix it yet

Enjoy.