OpenFlashChart problem in "_blank" or "_new" window

produnis wrote on Wednesday, March 12, 2014:

Hi folks,
I am playing with OpenFlashChart and I am facing a “strange” problem:

If I try to plot a graph within a “_blank” or “_new” browser-window, no chart is displayed. You could reproduce this “failure” this way:

  • open interface/patient_file/summary/vitals_fragment.php
  • go to line 55
  • add a target="_new" to the a-href, so that it looks like this:
a href='../encounter/trend_form.php?formname=vitals' target="_new" onclick='top.restoreSession()'>

This way, a new window opens when user clicks on “Click here to view and graph all vitals”, and no chart will be displayed.

I don’t understand why this happens, so any advice is welcome
:slight_smile:

greetings
Joe

blankev wrote on Wednesday, March 12, 2014:

Produnis,

I hope you will find a solution.

Question 1: Did you find a way in your charting vitals graph to make a in/ex-clusion option for date/time axis in the graph? For example I only want to make a graph of this week results.

Sometimes if older dates are included you get a rather disfigured graph. For example the O2 saturation levels or glucose during a follow up emergency every hour during a several month relapse.

Question 2: Is it possible to combine more lines in a graph with your software inclusions? For example RR levels.heart-rate and O2 levels

produnis wrote on Wednesday, March 12, 2014:

Pieter,
I am currently working on a function, which allows to pass var/date-arrays to openflashchart. So, if this function works, one could plot any data passed in such arrays.
This works with one line only, yet…

To get this function ready, I need to know why there are no graphs in “_new” or “_blank” browser-windows…

blankev wrote on Wednesday, March 12, 2014:

Thx for your reply, but I can’t be of any help … problem doctor versus developer.

yehster wrote on Wednesday, March 12, 2014:

A likely issue is that “top.restoreSession()” is also being called from the new/blank window, but is an invalid javascript call because that function is only valid in the context of the OpenEMR frameset.

A way to confirm that this is the case is to look at the javascript console for errors in your new window.

There’s info regarding top.restoreSession() on the wiki somewhere that may provide you with additional insight.

produnis wrote on Wednesday, March 12, 2014:

Thanks Kevin,
the javascript console states “TypeError: top.restoreSession is not a function”

I searched the wiki ( http://www.open-emr.org/wiki/index.php/OpenEMR_System_Architecture#PHP_Sessions_and_Browser_Windows ) but didn’t get a clue on how to fix that…

yehster wrote on Wednesday, March 12, 2014:

Not a simple problem to explain how to fix, but the general approach is to figure out where in the OpenFlash chart code top.sessionRestore is being call and temporarily comment it out. That might get things to display properly in the meantime, but will break/violate the session principles of OpenEMR.

If you can get the display to work in that scenario, the next step would be to mess with the javascript code where top.restoreSession is called to check and figure out if it’s being called as part of the frameset or in a new window. opener.top.sessionRestore() would probably be the correct function call to make in that context, and you can test for existence of the appropriate function to figure out which one to call instead of having there being the javascript error.

produnis wrote on Wednesday, March 12, 2014:

Thx again, Kevin,

using “opener.top.restoreSession()” instead of “top.restoreSession()” was the magic!
Graph pops up nice now
:wink:

yehster wrote on Wednesday, March 12, 2014:

Not sure how that’s going to impact existing graphs that don’t go to a new/blank window, but glad it’s working for you.

produnis wrote on Wednesday, March 12, 2014:

using “opener.top.restoreSession()” breaks graphs that do NOT go into a new/blank window, but that’s ok as this specific script is just for use with popup-windows.
I wrote a similar function for graphs that won’t go to new/blank windows, and that one uses “top.restoreSession()”

blankev wrote on Thursday, March 13, 2014:

I was playing with Demo:

http://demo.open-emr.org:2106/openemr/interface/main/main_screen.php?auth=login&site=default

Changed Abdominal Circumference into Cervix Dilatation
Other Notes into Hodge Descent H1-H4.

Now for a new patient this shows a great graph. Standing with cursor on the dot gives the time and this is relative in hours. So great for evaluation of counting the dilatation.

The Other Notes field can not be graphed. But this could be not so much of a problem.

I tried to add a field in Vitals, but that needs to be done somewhere in the software, where I am lost…

Question 1. How can there be fields added in Vitals
Question 2. How can there be a start date included in the graph created by Trend
Question 3. Systolic and Diastolic blood pressure do show together in the graph. Could it be possible to include more graphs of other Vitals checked in the same graph?

produnis wrote on Thursday, March 13, 2014:

Hi Peter,
you could try the following alternative (though you won’t be able to plot 2 lines in one graph, yet, but you will be able to plot anything you like)

Please check out my branch “Pieter” on github,
https://github.com/produnis/openemr/tree/Pieter

and set up a test-webinstance with this code.

In openemr, got to “Administration => Other => Forms” and install the “track_anything” form. Give it the “Clinical”-Category.

Go to “Procedures => Configuration” and create a new “Add to top level”.
Give it the name “Track XY” and ignore all other fields (if you wish, you can fill out any field, but it is not necessary). Hit “Save”.

Your “Track XY” should now show up in the list of all procedures. Click “Add” on the very right of Track XY and add any item you wish to track, eg add “Glucose”, add “Oxy”, add “Something else”.

So, you now should have a top-level-procedure “Track XY” which consists of several items you wish to track.

Go to any patient encounter.

Select from “Clinical” => “Track anything”.

Select the procedure to track => “Track XY”

Type in your data and hit “save”. Type in next data…

hit “stop” if you are done.

Now your data should show up in the encounter summary, giving you a “graph”-button. Click on that button and a graph will popup.

This way I am tracking patients’ glucose.
I put all the data I wish to plot into one encounter-track.

If you do this for several encounters, a button “track history” will show up, giving you the possibility to graph the data for any encounter seperately.

This way you might solve the problem of having a graph including all old (maybe outdated) vitals-data…

Hope my english was understandable
:wink:

Greetings

Joe

PS: I merged the code into my “track_anything2”-branch, which has a demo-instance here:
http://demo.open-emr.org:2105/openemr

It updates at 9:12 AM Pacific time, so you have to wait some 18h from now in order to test the stuff there…

blankev wrote on Friday, March 14, 2014:

Joe,

I tested this feature and it works. If you are still programming and need some USER advise let me know.

It looks promising, but there is still programming to do, before it is ready for release.

Don’t know if it has to do with your changes or if it is a problem with the test web-instance, but adding the Procedure tests more than I used to I am kicked out of the OpenEMR software and have to start again with last successful save.

Tnx for the work already done.

produnis wrote on Friday, March 14, 2014:

Pieter,
I added a test-patient to the demo-instance and was able to add your “Track XY” to a new encounter…
check the demo instance, patient “JHoe Slam”

Work ist still in progress, and I am happy for any feedback.
[e.g. Tomorrow, with todays update on the demo-instance, you will be able to edit any track-entry…]

blankev wrote on Friday, March 14, 2014:

As a user: I would like to see the date once and than the times until the date changes again on the X axis.

Like to combine different encounters, now I only see one encounter with many tests in that same encounter as a graph.

Love to see different plots in the same graph… Good example is Cervix dilatation and Hodge levels and fetal heart rate. Glucose can be different depending on what you want to plot. As a general Physician I usually ask for three tests. But in clinical setting you could like to see a day curve as more important.

Just quick comment. Don’t become disappointed. But this is for me definitely a wishlist. May be others can comment. ;-)) I will follow you and let me know if there is a new testing season opened.

produnis wrote on Friday, March 14, 2014:

thx for your feedback…

I am planning to add checkboxes in tables head, so the user can decide which data-column is added to the plot (multiple lines).

I think rudimental support to combine encounters shouldn’t be that hard to code, too…

I’ll add that to the agenda
:wink: