Integrating LifeSensor into your Medical Primary System, using the ICW SDK
Find out how to combine the added values of LifeSensor together with your primary systemBy: Olaf Bublitz, Product Manager ICW Software Development Kit
February 23, 2007
Abstract
In this article you will find some advice on how system vendors of primary systems can easily connect their applications to the ICW eHealth infrastructure.
The content is addressed to system architects and developers of primary systems. The following scenario gives a practical example of using the SDK:
A patient with a LifeSensor account goes to a pharmacy. He wants to pick up a previously prescribed prescription. During this process a connection to the LifeSensor Personal Health Record is established to check if the previously prescribed medication has contraindications to other medications the patient is currently taking. It is conceivable that this check could also be carried out at the doctor's practice.
This article outlines which components of the eHealth infrastructure are involved in this process and how the SDK has to be used to meet the requirements of this scenario. To simplify this example and to focus on the LifeSensor communication the prescription was dispensed in the ?classic? way via a paper form. The SDK also supports you when handling ePrescriptions, but this will not be part of this article.
Background / Overview
Checking contraindications when selling medications will be a typical requirement for next generation pharmaceutical systems. To achieve this goal primary systems need to interact with comprehensive patient information like the LifeSensor Personal Health Record.
To enable your primary system with communication abilities you can include the ICW SDK functionality to reduce the communication overhead and programming efforts to an absolute minimum.
The ICW SDK provides an Application Programming Interface (API) which can be accessed with a wide variety of programming languages. The SDK allows you to smoothly integrate primary systems with the LifeSensor Personal Health Record. At the same time, the SDK ensures greater independence, because required changes to the interfaces within the eHealth infrastructure will usually only require an update of the SDK. In this case, the interface to the primary systems remains unaffected.

- Overview of the communication between the involved components:
Prerequisites
On the workstation where the primary system is installed you also have to install the SDK, see the SDK Installation Guide for more information. The SDK is currently available in two editions; the COM and the Java edition. In our example we?ll be using the Java edition. The ICW SDK Java Edition is designed for JRE 1.4 but it also works with Java 5.
To get access to the Personal Health Record the patient needs a valid LifeSensor account. The patient has to give read permissions to the physician so his medication list or only specific entries in the list can be viewed in his Personal Health Record.

- The data flow in our example scenario
Code Design
Here is an overview of the steps needed to implement access to the Personal Health Record:
The complete functionality of the ICW SDK is encapsulated in one ?platform? object.
First we have to initialize this object with a valid configuration (that is, the URL of LifeSensor server and so on).
Then we will need the authorized physician to login with his username and password combination. With this login we will search for the patient information in the LifeSensor database (that the patient has permitted us to see). The information contains a list of the patient's medication (current and historical) which we can cross check with the medications on his actual prescription.
Code Implementation
In your Java program you have to import several classes. You can either import the classes you want to use individually or you can import the whloe package. To import the whole package use: import com.icw.sdk.*;
The following code excerpt shows a class that provides a method for a contraindication check. In this example the primary system calls the method checkContraIndicationWithLifeSensor with the user information and a list containing the medications the patient has on his prescription ( list_primary_sys_prescription ):
/** * Creates a HealthRecordManager and searches for the user with the given patient name. Then * a new HealthRecordManager is created on that record. With that HRM a new medication is * available. The list of all available Medications could be retrieved and checked. */ public class ContraIndicationCheck { private final static String DOC_USERNAME = "phys1"; private final static String DOC_PASSWORD = "example_password"; private void checkContraIndicationWithLifeSensor(Map sdkConfigMap, String patient_famname, String patient_givname, List list_primary_sys_prescription) throws Exception { try { // instantiate central platform object Platform platform = Platform.newInstance(sdkConfigMap); // get health record manager UserManager uman = platform.getUserManager(ICWLoginType.USER_PASS, DOC_USERNAME, DOC_PASSWORD); // Got UserManager. Searching for Patient entry. // For this example using the name. In practice a unique ID should // be used!) List users = uman.findAccessibleUsers(new Clause("(famname=’" + patient_famname + "’)" + "(givname=’" + patient_givname + "’)")); if (users.size() != 1) { // error not unique patient info ... // do error handling return; } // assume list size == 1 for this example User current_user = (User) users.get(0); HealthRecordManager hrm = platform.getHealthRecordManager( ICWLoginType.USER_PASS, DOC_USERNAME, DOC_PASSWORD, "lifesensor", current_user.getID()); // Got HRM, now get and check medication list // retrieve List of medications List meds = hrm.find(ICWEntryType.MEDICATION, new Clause("")); Medication med_to_check; Iterator iter = meds.iterator(); while (iter.hasNext()) { med_to_check = (Medication) iter.next(); // only check medicals currently in use... if (!med_to_check.getState().getValue().equals("stopped")) { // check this medical entry with the // list of prescription entries normally // using the PZN you get by med_to_check.getCode() } } } catch (SDKException e) { System.out.println("Exception caught."); System.out.println("SDK error string is :" + e); System.out.println("SDK debug string is :" + e.getMessage()); System.out.println("Primary system error string:" + e.getSystemErrorString()); System.out.println("Primary system error code :" + e.getSystemErrorCode()); } } ... }
Expected Results and Error Handling
In this example the access to the Personal Health Record is read-only, so no changes are made in the Personal Health Record. If any problems occur (for example, the system is configured incorrectly, LifeSensor is not reachable or other problems originating on the backend ) the SDK maps all errors to the centralized SDKException as you can see in the catch block in our example.
Conclusion
Using the SDK you can easily integrate extensive functionality with just a few lines of code. Of course this example can only give a brief introduction to the possibilities of the complete SDK. For further information, please have a look at the SDK Technical White Paper and the SDK Developer Guidelines.
Concerning the forthcoming ePrescriptions, the SDK also provides you with functionality to handle the steps of authentication, uploading and downloading prescriptions to smartcards, and so on. For this purpose the SDK includes methods to communicate with the connector and the attached card readers for the use of smart cards like EHC and HPC.
In any case, the SDK will improve the integration process of modern eHealth infrastructure components.
