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.
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 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:
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: https://unity.ubuntu.com/projects/appindicators/. 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:
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.
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 os, sys
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 = ""
savetime = int(time.time() - timestart) + saveseconds
saveseconds += int(time.time() - timestart)
timestart = time.time()
source_id = gtk.timeout_add(1000, on_timer)
#sets timer to run every 1s
saveseconds = 0
#format below is (id, icon_name, category, icon_theme_path)
ind = appindicator.Indicator ("elapses", "hourglass", appindicator.CATEGORY_APPLICATION_STATUS, dir_path)
ind.set_label("Elapses"); #name of program and initial display
##Setup Menu Items
menu = gtk.Menu()
stop = gtk.MenuItem("Stop")
start = gtk.MenuItem("Start")
clear = gtk.MenuItem("Clear")
exit = gtk.MenuItem("Exit")
ind.set_menu(menu) #set the menu with added items
Save this to a file with a .py extension. I named mine elapses.py. 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 elapses.py
To make a desktop launcher use (edit with your own paths) and save as elapses.desktop: