Tuesday, July 6, 2010

Physiological Data Visualization

Visualization of time series data is necessary to understand several physiological activities of patients. This data is obtained from patients by mostly non-intrusive procedures. The pulse oximeter ( A device that indirectly measures oxygen saturation in patients blood), the electrocardiogram (Used to record ECG or EKG signals which is a representation of the electrical activity of the heart obtained by placing leads on the skin on different parts of the body) and the EEG (Electroencephalography - for measuring electrical activity of the scalp produced by neurons firing in the brain) are some examples of the same. The Sana team is working in collaboration with Rich Fletcher from the MIT media lab to use wearable sensors to monitor such activity especially with relevance to developing countries.

In order to get the data from such devices into the Media viewer I needed to get the data to a standard format. Now most doctors and clinicians all over the world use different standards and devices which makes it a difficult task to standardize the visualization part. The physionet is one such resource which supports different standards allowing interconversions, and provides a framework for creating standardized data for physiological signals. To start with one, I used the ECG signals from physiobank (The MIT-BIH Arrythmia database) as the basic data source. I added an interfacing mechanism which would extract the data from physionet compatible file/data formats into Comma seperated Values (CSV). The wfdb library provides functions which can be used in C/C++ to perform almost any task with the data. The ECG signals in the MIT-db comprise of a data (.dat), annotations (.at) and header (.hea) files for every recording. The data file is in binary and cannot be read directly. The processing is carried out using the wfdb package through C/C++ or using wfdb-swig and swig wrappers (Check it out if you are interested in building wrappers around your C/C++ code to enable almost complete portability to other programming languages) for Java, perl and several other languages. I mainly used the rdsamp library with parameters as shown to get the MLII lead data for the record 100.

E.g: rdsamp -r 100 -c -H -f 0 -t 10 -v -pd -s MLII

Owing to the uncertainty in formats for the different signals, we decided on using csv file format as standard input to the time series module in the media viewer. The csv file is stored alongwith the other media files that are uploaded during an encounter with the patient. Normally for an Encounter with the patient the record is stored as Observations into OpenMRS. The ComplexOb support in OpenMRS is to enable things like an X-ray image (The images handled by the media viewer) and other media to be stored for any encounter. I have presumed that the physiological data(mapped with time series visualization) would be one such complexObs uploaded during the encounter. This complexObs needs to be a CSV file for the media viewer to understand and plot the time series graph. Converting the different formats to a csv file is something that needs to be handled (Though I have tested it with physionet compatible formats, other standards need to be studied across the world). However once the csv file is present as complexObs associated with the encounter, the media viewer on load fetches that data similar to the images/audio/video and displays it.

The time series visualization module is built of charting components in flex. the data providers are associative arrays populated with data from the csv files. Hovering over the plot gives the x,y coordinates as a tooltip. A grid is displayed by adding annotation elements to the background. The file is selected from the list of thumbnails shown at the top.

In this a form has been added at the bottom of the plot to enable adding label (as title of the plot) and other information to the graph. This data will have to be stored and associated with the csv file.

Comparing two signals side by side vertically is a use case with applications that enable a doctor to compare the patients data from different leads. the media viewer lets one compare two signals horizontally as well as vertically. The signal to be displayed on either segments of the screen can be selected by focussing on either of the two sides and selecting the csv thumbnails. A slider seperating the two lets you change screen spans for either pf the two plots accordingly.

The vertical side by side viewer with form elements for adding label and comments.

This module is a prototype and depending on usability requirements can be modified further. If you have any suggestions concerning the same, feel free to contact me.

Pratik Mandrekar

1 comment:

Anonymous said...

I use CSV file format to transfer data between Excel spreadsheets and my mass mailer.