Graphing and trending vitals

bradymiller wrote on Wednesday, August 18, 2010:

hey,
As a physician, it’s really useful to be able to graph/trend vitals over time. Just committed this functionality (can test it out in the cvs demo when it refreshes this AM); it tests well although there are some rough spots (for example, need at least two vitals for it to work). Also made the mechanism generic, so will allow easy graphing of labs and any other stuff in the database.
-brady

bo2999 wrote on Wednesday, August 18, 2010:

Thanks for this added functionality. It is long overdue.

-bo

sunsetsystems wrote on Wednesday, August 25, 2010:

Brady, which modules did you add/change for this?

Thanks!

Rod
www.sunsetsystems.com

bradymiller wrote on Wednesday, August 25, 2010:

hey,

To start, here’s list of commits:
main: http://github.com/openemr/openemr/commit/66c0eb9917d032f0a85fd8962755f42b72676629
optimized: http://github.com/openemr/openemr/commit/deae2d582014ac95904c41f0e4c3dd36871c239a
bug fix: http://github.com/openemr/openemr/commit/cae7eb36b7890c934f417d4b4bdde8141830acf3

The main vital form (interface/forms/vitals/templates/vitals/general_new.html) now has two functions :
1. To enter in vitals, as was done previously.
2. To show all vitals and graph them (get to this screen from the Patient Summary screen on bottom left). To see this option on the patient summary screen there needs to be a set of vitals, and note the graph will only show up if there is more than one set of vitals for the selected vital to graph (to graph a vital, just click on the name).

The heart of this module is interface/patient_file/encounter/trend_form.php (wraps interface/forms/vitals/templates/vitals/general_new.html), which calls for the graph via ajax and places it and library/openflashchart/graphs.php which returns the json object to graph . I’ve coded them in a way to make them very generic, so will work with labs etc. Now, you basically pass the sql column, table, and graph title; adding features such as start/end dates and a sql column filter (ie. only want to show a certain lab) will make even more useful.

hope this helps,
-brady

sunsetsystems wrote on Friday, August 27, 2010:

Brady, thanks for this.

By the way a couple of things re the vitals form:

1. In the development demo site today I created encounters with dates 8/27 and 8/26, however both the text vitals display and the graph are showing them to be on the data entry date (and time), not on the encounter dates that were entered.  This looks like a bug.

2. Currently you are only graphing blood pressure, is that right?

Rod
www.sunsetsystems.com

sunsetsystems wrote on Friday, August 27, 2010:

Never mind about #2, I see now you can click on a row to chart it.

Rod
www.sunsetsystems.com

bradymiller wrote on Friday, August 27, 2010:

Rod,

The datetime stamp is pulled from the form_vitals table(this datetime is recorded when submit the vitals form).  Shouldn’t use the encounter date, since a patient can get serial vital signs during one encounter, and it’s important to know what specific date:time the vitals were actually measured. Would be nice to give the user the option to set the date:time when entering the vitals in (for example, if an RN enters vitals awhile after they’ve been measured).

-brady

sunsetsystems wrote on Friday, August 27, 2010:

OK.  I think the only good solution is to add a date/time field to the form that defaults to the current date and time.

Rod
www.sunsetsystems.com

avantsys wrote on Friday, July 27, 2012:

Brady (and everyone else), while the ability to create graphs for the vitals and for every numerical entry in the LBF (well, at least we know it works for them) forms, it is hampered by the fact that the whole graphing module is utterly closed source. Adobe Flash is simply not for us, given (a) Adobe’s contempt for all things open source, (b) Adobe’s plans to abandon the Linux platform.

What’s more, the usability of these graphs is very limited. We have no way to export these graphs as .png files to help doctors incorporate the graphs in their reports for their patients (or in scientific papers they might want to work on). Maybe it’s time we all sit down and come up with a better solution that will (a) be open to everyone, (b) give us the ability to export the graphs as images at the push of a button on the application?

I’m telling you guys this because some potential clients (clinics in university hospitals) are asking for such capabilities and their request makes sense to us.

Konstantinos
AvantSys Informatics

blankev wrote on Friday, July 27, 2012:

You must be aware of the many programs like Jing from TechSmith, with the pay version of Snagitt. It is just a click save event and you have your *.png image. I use it all the time with **Paint.exe **also a frees ware program ease to use for changing of file type. Since these programs are years as freeware available there should also be similar programs with open source background.

yehster wrote on Friday, July 27, 2012:

HTML5 canvas element would be a good way to implement graphing functionality that didn’t depend on flash. .PNG is the default export method and it supports other formats as well. If you would like to sponsor such a project, let me know.

mcaloon wrote on Friday, July 27, 2012:

Hello,
    There a a couple of jQuery plugins that also do graphing. Here is a review of some of them which include GPL licensing :slight_smile:

http://www.1stwebdesigner.com/css/top-jquery-chart-libraries-interactive-charts/

Mac

bradymiller wrote on Saturday, July 28, 2012:

Hi,
Sounds like a good idea (several of the jquery options look very enticing; they may even play well with the data json object already created in library/openflashchart/graphs.php). Just need to get somebody to sponsor it or contribute it (since most of the code is already there in library/openflashchart/graphs.php, would expect this to require minimal work).
-brady
OpenEMR

mcaloon wrote on Sunday, July 29, 2012:

Hello,
     I am going to take a crack at some jQuery prototypes. I will post to the hub for feedback in a few days hopefully. Haven’t looked at how a user gets to these graphs. Would this be connected to the UI redesign topic at all?

Mac

avantsys wrote on Monday, July 30, 2012:

We’re already beginning to study the implementation of graphing capabilities using HTML5 and jQuery, so we’re actually going to put effort and “elbow grease” into it. Who else is with us?

Konstantinos
AvantSys Informatics

avantsys wrote on Monday, July 30, 2012:

What we as developers have to keep in mind is that many doctors out there simply don’t have the time or the dedication to fiddle with their computers and with external applications to do their job - not to mention that we have to ensure that the computerized workflow will not be exceedingly slower than the one they had gotten used to.

I have come across many doctors who simply can’t be bothered with medical software, because all they do is prescribe; they say that the time and effort it’d take them to enter the necessary data for a single encounter could be better spent on prescribing for ten more patients - each one of them amounting for at least $50.

So, it would be pointless (to say the least) to ask the doctor to spend extra money for an external graphing application and then taking the extra step of using an external application (freeware or not) to convert the file into whatever other desired format and then keeping tabs of these files. His response to this will be “no way”.

So, we need to:

Keep It Simple, Stupid.

Keep It Organized and Easy for Us to Modify/Customize/Improve.

As for the graphing and trending of vitals etc, here are some requirements we’ve encountered and we’re already working on satisfying them:

1. Avoid depending or relying on proprietary software - especially if said software is slow and unreliable.

2. Ensure that the graphs will be easy to export as .png files (a dedicated button for this will fit the bill nicely).

3. Ensure that the graphs will be easy to include in the reports that will be created for the patients.

Konstantinos
AvantSys Informatics

mcaloon wrote on Tuesday, July 31, 2012:

Hey Konstantinos,
    What jQuery plugin did you decide to use or are your rolling your own? I started looking at the flash chart code to get at the JSON data for prototyping but haven’t figured out the approach for replacing the old stuff with the new jQuery implementation. Do you have a working github branch somewhere interested parties can take a peek at?

Mac