Getting started with OpenICE: Setting up OpenICE on linux environment

OpenICE is an application built by the MDPnP (Medical Device Plug and Play) group out of Harvard/Partners Healthcare in Boston, MA. The lab’s focus is to build applications that increase interoperability success.

Although broken at the time of this writing, their website generally featured a web application demo that demonstrated real time streaming of operating room devices (think physiological monitors and ventilators) to a browser.

The last OpenICE update was >1.5 years ago but it is still possible to make use of the tools that have been created.

I had trouble getting their code in GitHub to work appropriately. The simulated devices could be called up but the supervisor which includes apps to actually do something with the data coming from devices would crash on my linux machine. I was advised to build from source. Below are instructions that worked.

1. Setup the correct Java environment.

I had the most up to date java environment when I was building from source and that wouldn’t work. I was instructed to only use Java 8 Oracle update 60 which is an older version. 

  1. Download the JDK for your linux version
  2. Un-tar the version you downloaded and place where you like. I placed mine in /opt/ folder
  3. Use the following commands to install this java version as an alternative available
  4. sudo update-alternatives --install /usr/bin/java java /opt/jdk1.8.0_60/bin/java 1
    sudo update-alternatives --install /usr/bin/javac javac /opt/jdk/jdk1.8.0_60/bin/javac 1

    substitute your path for the location you placed your version. Then you must set that version as the used version using:

  5. sudo update-alternatives --config java

    this will prompt you to give a number for the version you’d want to use as a default. Select the version and confirm that it is set by seeing the * next to the number.


2. Get the code to build
  1. Clone the repository located at:
  2.  git clone


3.  Build with Gradle
  1. Build by using the following command in your cloned github repository
  2. ./gradlew


What’s next?

  • OpenICE should really be something that works and is ready to go. The code hasn’t been updated so may some inspired individual could take the reigns in having it work on all platforms out of the gate?
  • Build information should specify the JDK needed more clearly or be able to be built with something other than Java Oracle like OpenJDK.


Now on to seeing if I can get Hello OpenICE to work…

Interactive Manual of Anesthesiology: Difficult Airway Algorithm

I am in the process of revitalizing an old project that got left behind during the busyness of residency. It is an interactive manual for things associated with perioperative care. My goal is to launch several tools that are helpful for anesthesiologists at the point of real time care.

The first item to launch is a simple app for the difficult airway algorithm.

Check out the app here.

See the behance portfolio item here

Send  me your feedback!


Now Listening for Spotify/Linux: Auto publish what song you’re listening to in realtime

Here is a quick python script to update a file with what you’re listening to on spotify on Ubuntu/Linux in real time. It updates every 30 seconds.

Tested with Python 3, Ubuntu 16.04 and Spotify Linux Client (no longer maintained).

This saves to a txt file locally which you can then use to cURL to an online server to broadcast your current playing song (Adele on repeat anyone??).

import dbus
import sched, time
#s = sched.scheduler(time.time, time.sleep)
currentTrack = ""
currentArtist = ""

session_bus = dbus.SessionBus()
spotify_bus = session_bus.get_object("org.mpris.MediaPlayer2.spotify",
spotify_properties = dbus.Interface(spotify_bus,

def getsong():
 metadata = spotify_properties.Get("org.mpris.MediaPlayer2.Player", "Metadata")
 # The property Metadata behaves like a python dict
 #for key, value in metadata.items():
 #print(key, value)

 # To just print the title
 global currentTrack
 currentTrack = metadata['xesam:title']

 global currentArtist
 currentArtist = ','.join(metadata['xesam:albumArtist'])

 if currentArtist != '' :
 f = open('./nowlisten.txt', 'w')
 output = currentTrack+' - '+currentArtist #format output here


while True:



Streaming Databases for physiological data (EKG, ABP, SPO2 etc)

My current research project is a design and implementation of a remote anesthesia monitoring application. Building such an application has many potential uses including tele-anesthesia and for in-house staff supervising multiple anesthetists: the opportunity to be alerted when something goes awry.

I decided to focus on building a mobile application using fullstack javascript for interactivity and decided on meteor, angular2, ionic2 and python for some backend work. While testing my app I needed to figure out how to simulate real time physiologic data.

I grabbed data from physionet an awesome database of physiological “stuff”. They have waveforms of data from real patients collected and annotated. How to use physionet is an entirely different article which I will detail at another point but the short story is that I grabbed a subset of one of the databases, exported it to a CSV file, edited the headers for standardization across my app and used the ‘elapsed time’ column to create essentially a unique index based on time that I could use to grab and stream data in order.

With many data points my data looked like this in a .csv file


I then used mongodb to put all this data in a collection that could be queried.  The trick to simulating the data is to use the current time to query the database quickly and push this queried and timestamped data into another database which as it is updated appears to be collecting data from a patient in real time.

See the video below for how it will appear in an app:

Elapses: Creating a Unity stopwatch indicator w/ Python

Elapses: Unity stopwatch app indicator

Though there are many productivity apps for tracking time when I  converted my desktop and laptop over to dual-boot Ubuntu (16.04)/Linux I wanted to take my favorite simple time tracking app Thyme with me but it was only for Mac.

Searches for a unity app indicator to go on the menu bar and show me how much time I had been spending on a task were fruitless. I found a few alarm apps with timers but I couldn’t get a stop-watch mode which was what I really wanted. As long as I could look up and see the time tracker without having to pull up another window I would be happy. Chrome (my browser of choice) has many timer/stop watch apps but these also required having another window open which would easily be hidden as I worked away.

So I decided to build my own unity stop watch indicator using python (using 2.7.x). The resources for the app indicator documentation (not very good or helpful) are here: Please note this resource is for python3 and we are using  python 2.7 here. Most of the code still applies though.

Start by checking if Python is installed and what version by opening a terminal window and typing:

python --version

If you don’t have python already you an install it from the terminal using:

sudo apt-get install python

Once python is installed you can install a library called python-appindicator.

sudo apt-get update
sudo apt-get install python-appindicator

You may also need:

sudo apt-get install wmctrl

This library will be needed for creating the actual app indicator.

Next, open your favorite editor (I use atom) or the python IDLE and start a new file. Add the code below:

import gobject
import gtk
import appindicator
import os, sys
import time
from datetime import timedelta

if __name__ == "__main__":

 saveseconds = 0 #global variable to save how many seconds the clock has run
 dir_path = os.path.dirname(os.path.realpath(__file__))
 source_id = ""

 def on_timer(args=None):
 savetime = int(time.time() - timestart) + saveseconds
 return True

 def finish(args=None):
 return True

 def stoptime(args=None):
 global saveseconds
 saveseconds += int(time.time() - timestart)
 return True

 def starttime(args=None):
 global timestart
 timestart = time.time()
 global source_id
 source_id = gtk.timeout_add(1000, on_timer)
 #sets timer to run every 1s
 return True

 def cleartime(args=None):
 global saveseconds
 saveseconds = 0
 return True

 #format below is (id, icon_name, category, icon_theme_path)
 ind = appindicator.Indicator ("elapses", "hourglass", appindicator.CATEGORY_APPLICATION_STATUS, dir_path)
 ind.set_status (appindicator.STATUS_ACTIVE)
 ind.set_label("Elapses"); #name of program and initial display

 ##Setup Menu Items
 menu = gtk.Menu()

 stop = gtk.MenuItem("Stop")
 stop.connect("activate", stoptime)

 start = gtk.MenuItem("Start")
 start.connect("activate", starttime)

 clear = gtk.MenuItem("Clear")
 clear.connect("activate", cleartime)

 exit = gtk.MenuItem("Exit")
 exit.connect("activate", finish)

 ind.set_menu(menu) #set the menu with added items

Save this to a file with a .py extension. I named mine Edit the following line:

ind = appindicator.Indicator ("elapses", "hourglass", appindicator.CATEGORY_APPLICATION_STATUS, dir_path)

The format above follows: (id, icon_name, category, icon_theme_path).  To make the icon show up place a icon image file in the folder (dir_path) with your .py file and change the file name above. If you put it in another folder other than the current one, replace dir_path with the location of the icon.

To make this executable use the chmod function as such:

chmod +x

To make a desktop launcher use (edit with your own paths) and save as elapses.desktop:

#!/usr/bin/env xdg-open

[Desktop Entry]
Comment=Stop Watch


GitHub code will be uploaded soon!


Resources/Tutorials that helped me along the way: