Script "labdata"

produnis wrote on Saturday, March 01, 2014:

Hi there,
I coded a script that generates a structured output of (all) patient’s lab data available in table “procedure_results”.

The code is available on github, see
https://github.com/produnis/track_anything/blob/master/track_anything/labdata.php

The script is actually part of the “track_anything”-form (becaus I didn’t want to change any “official” openemr-files), but it will run from within any encounter. [You will need to specify the script path in line #30 if you want to use it outside of track_anything]. All it needs is the patient-id in $pid (which is set if we are in an encounter).

The script scans table “procedure_result” for available parameter (e.g. patient’s Erys, Leukos or Glucose). The user is able to select from this list which parameter to show.

It outputs a list or matrix with all selected parameters’ results over time.

Please check the release notes
https://github.com/produnis/track_anything/releases/tag/v0.1.2

Again, any comment welcome!
Joe

mdsupport wrote on Sunday, March 02, 2014:

  1. In git instead of having a completely new project and selectively copy files, you should clone the standard project and create branches to track you development.
  2. If you look at first few lines of standard scripts, you will find some standard variables set by globals.php such $srcdir. Using those will save you some time and make code closer to standard.
  3. sqlStatement takes parameters array to prevent SQL injection. Best to use SQL in that fashion.
  4. Project uses some standard stylesheets. Instead of managing color schemes yourself, you can rely on those elements to handle presentation.
  5. As stated earlier, lot of places can use the (date,value) series from procedure results. If possible, you should isolate that logic in a function in a library file so scripts in addition to labdata can reuse your code. labdata.php can then format and present data in a way you need.

produnis wrote on Sunday, March 02, 2014:

Thx again for your answer. Could you please give me a hand on how to clone the standard project and create a branch?

cmswest wrote on Sunday, March 02, 2014:

nice video that explains the setup:

bradymiller wrote on Sunday, March 02, 2014:

Hi produnis,

Welcome to OpenEMR!!!

There’s a tutorial here to set up a OpenEMR github repo (also includes link to above video):
http://www.open-emr.org/wiki/index.php/Git_for_dummies

To ease testing/review process, place your form in the interface/forms directory.

thanks,
-brady
OpenEMR

produnis wrote on Monday, March 03, 2014:

Thx for the welcomes and your answers…

Thx to the youtube video I managed to set up a new branch and commited my changes to:

It brings the “track_anything” form in /interface/forms/ and “labdata.php” in /interface/patient_file/summary/.

I added a “labdata”-widget and a “track_anything”-widget to demographics.php
[So labdata is now availabe from patient’s demographics and not from track_anything-Track]

Things I have to code:

  • get correct css-stuff into scripts.
  • try to isolate the scripts pure logic into usefull functions

Things I can’t figure out:

  • In demographics.php, I would like to remove the button of the (new added) “track_anything”-widget, just like it is with patient’s ID Card/Photo-Widget. With my current code, the button is only removed, if ID Card/Photo-Widget finds some Photo/Card. If this widget has no Photo/Card (and thus isn’t present), the “track_anything”-Widget shows a button.

  • I would like to pass the “labdata”-Data to open flash chart. I am searching for exmamples on how to pass array(var, date) to open flash chart in order to print the stuff like Vitals does. But, to be honest, I don’t really understand the Vitals code. Could anyone point out a linenumber of Vitals where the call to open flash chart is passed?

Greetings from Germany

Joe

bradymiller wrote on Tuesday, March 04, 2014:

Hi Joe,

Will be much easier to review this code if you rebase all your code into one commit (would actually recommend placing the form stuff into the first commit and then the lab stuff in a following separate commit). This is done via the git rebase -r command (ie. interactive rebase). Let us know if you need us to show you how to do it, which we’d be happy to do. I’d rec. doing it in another branch such as track_anything_2 to avoid messing up anything you already have.

For those whom are just testing code, note this code can be tested in the following UP FOR GRABS demo:
http://www.open-emr.org/wiki/index.php/Development_Demo#192.168.1.131

thanks,
-brady
OpenEMR

bradymiller wrote on Tuesday, March 04, 2014:

Hi,

Regarding the vitals->graphing, main script is at library/openflashchart/graphs.php, which is called by the interface/patient_file/encounter/trend_form.php script. Recommend doing a grep for “trend_form.php” and you’ll see where it is used in the two current example (the vitals and LBF forms).

-brady
OpenEMR

produnis wrote on Tuesday, March 04, 2014:

Hi Brady,
I created a new branch “track_anything2”

It should (hopefully) consist of 2 commits:

  1. the “track_anything”-form with some code in /patient_file/summary/demographics.php

  2. the “labdata.php”-script in /patient_file/summary with some code in demographics.php as well

produnis wrote on Tuesday, March 04, 2014:

I filled the demo-page’s database with some random data.
Please check patient Joe Slam for a track_anything example,
and check patient Dr. Zoid Berg for tracks and labdata.php examples.
This version of labdata.php is missing css-integration (which it has in branch track_anything2), so things might look “too big”.

bradymiller wrote on Wednesday, March 05, 2014:

Hi Joe,
Those demos will refresh every morning (yours at 9:12 am PST), so don’t feel the need to keep re-refreshing the sample data. These demos are are nice because they allows testers that don’t have their own testing environment to provide feedback. When your demo resets tomorrow am, it will start using your new track_anything2 branch. Planning to review the code sometime over the next several days.
thanks,
-brady
OpenEMR

bradymiller wrote on Wednesday, March 05, 2014:

Hi,

Since you placed the sample data on the demo, I did take a quick look at it. One thing I noticed is that Esign feature on the encounter screen is affected by following bug:
https://sourceforge.net/p/openemr/discussion/202506/thread/9687253b/?limit=25&page=2#6990

It’s a good reminder regarding that bug. As an aside, hopefully we can get it worked out so the form dir name and form database name do not need to match for Esign feature to work.

-brady
OpenEMR

produnis wrote on Thursday, March 13, 2014:

Hi there,
I added “graph_popup-php”-feature to track_anything, which allows to plot numeric track-data via openflashchart.
[see this post https://sourceforge.net/p/openemr/discussion/202506/thread/5d5d753d/ ]

I did a “push -f” to get the stuff into one single commit, so if you already checked out the “track_anything2”-branch, you might need to pull it again.
(I read that doing a push -f might get things messed up, sorry for possible inconviniece)

Greetings,
Joe

produnis wrote on Sunday, March 23, 2014:

A new version of track_anything and labdata was pushed to track_anytihng2-branch, and is available via http://demo.open-emr.org:2105 in a couple of hours.

The ESign-Bug was fixed (renamed the db-table)

If you like to test “labdata”, here are some example-data for use with e.g.
http://demo.open-emr.org:2105

Got to Patient Zoid Berd.
In demographics, click “View recent Labdata”, just below the Vitals widget.

(If Zoid has a lot of lab-items, dont forget to scroll down your browserwindow after you submitted your choice. In my browser, it looks as if nothing happends, but the “interesting data” is “just hidden” by the bottom-frame “Bot”… )

produnis wrote on Wednesday, March 26, 2014:

I uploaded a demo-video of labdata here:

blankev wrote on Wednesday, March 26, 2014:

Incredible feature! Great video!

blankev wrote on Wednesday, March 26, 2014:

Now you showed what can be accomplished… where can I see the Demo you used to present this procedure result?

bradymiller wrote on Thursday, March 27, 2014:

Hi Joe and Pieter,

The “Up For Grabs” demo for this code now imports the sql data (this is a feature of the demo farm):
http://www.open-emr.org/wiki/index.php/Development_Demo#192.168.1.131

So Joe will not need to keep configuring it. Note I needed to modify your sql file a little to make it work:

-brady
OpenEMR

blankev wrote on Thursday, March 27, 2014:

That is something to have! Did some playing around and it is impressive for the non-US located practitioner. Full flexibility and much more.

Now for Joe:

Are there two implementations needed to get the full graphic capabilities or is there one going to be obsolete (Track XY) now there is the Producedure graph in place for ordered and result received Procedures?

blankev wrote on Thursday, March 27, 2014:

Brady,

I see that SQL use is possible (LabData and Race/Ethnics, with the programming of Joe, produnis and MU2 Demograph). Is there another option that Joe, LABDATA and Rod’s Document-Templates can be merged and handled in the same Demo without me having to learn to make my own Github working?

I like playing around with new options, but have a terrible headache learning GitHub, specially since there are persons so much better in the programming stuff (even the very beginners are…)

I can work and read as a Kinder Garten grader in the PHP files, but only if the correct lines need a little correction or have to be in a certain order.

The Lab requests used by Joe are in German. Is this something for the Translator-Spreadsheet? I could make a reasonable translation in English (Our Laboratories use both most of the time) and Dutch. SQL (translated in English standard) of Joe can be Find => Replaced with XL(…) made ready for including in the Language spreadsheet or a separate spreadsheet.

Please give me your thoughts.