Adding an S option to Layout Based Forms

yisraelk wrote on Monday, July 07, 2014:

https://github.com/yisraelk/openemr/tree/yk1

Supports edit option S which uses the saved value from the previous encounter as the default value for a field in a layout based form. It’s a few lines of code in options.inc.php as well as a small new file called LBFrecent.php in /library.

Yisrael

wizard353 wrote on Wednesday, July 09, 2014:

Yisrael,

This looks like it would be a very useful function. I will have to investigate how to integrate it into the current OpenEMR release. Do you expect that this enhancement would be incorporated into a mainstream OpenEMR release in the near future?

I can think of two useful variations to the function, in addition to the capability you have described.

One option would be to return the first non-null instance of a value over a series of visits. In ophthalmology, at every visit, we must certify that we have lowered the eye pressure of glaucoma patients by at least 15% from their initial pre-treatment levels. To have a field containing the pre-treatment pressure that propagates forward into future records, without having to manually scan through the past notes, would be very useful.

A different useful option would return the maximum value of a field with the date of its occurrence across a series of visits.

Thanks,

Dave

bradymiller wrote on Friday, July 11, 2014:

Hi Yisrael,

I placed a code review on github. Looking forward to next revision. (David, do plan to bring this feature into the official codebase when it’s ready)

-brady
OpenEMR

blankev wrote on Friday, July 11, 2014:

Is the Pop-up available for this “S” and is it included in the WIKI page for LBF Forms?

There was/is another Character missing in the Pop-ups for LBF, can’t remember wich one though. And these short Pop-up remarks are just the thing needed when working with the LBF creations.

Please ignore this remark if it is there. I did not check this new S in LBF’s.

yisraelk wrote on Friday, July 11, 2014:

David,

Those variations sound quite useful. For me, what it is now is what I need and as a rank amuter coder, to figure out how to code those in would take me another few hours. But feel free to jump in and put that in.

Pieter,

Just added it to the popups. It is not in the wiki yet.

wizard353 wrote on Friday, July 11, 2014:

Yisrael,

I, too, am a n00b at PHP. Wrote my first code in PL/1 and FORTRAN on punch cards in 1971 on an IBM System 360, and then a DEC PDP 11/45. Got pretty good with Z-80 assembler. Do a little with BASIC and a trace of C these days. PHP is “terra incognita” for me.

When a missing semicolon in PHP brought OpenEMR to its knees, it brought me back to the days of the TDL-Xitan Z-80 assembler on CP/M, when a missing semicolon would do the same thing.

I think my first endeavor will be to make a LBV field that inserts the current clock time when clicked upon. The time of day is clinically significant for intraocular pressure readings. I would like to make it permissive, so if I want to indicate that the reading time was actually a half hour ago, I could overwrite and store the auto generated value.

Then, I want to work on calculated values. I’d like to be able to have code like:

IF InitialPressure > 0 THEN
Percent Reduction = 100 * (InitialPressure - CurrentPressure)/InitialPressure

That will take some extensive work.

Dave

fsgl wrote on Friday, July 11, 2014:

The LBV form has a Data Type, Text-Date, which brings up the PostNuke Calendar.

The Immunization module has automated time entry. A perusal of /openemr/main/main_screen.php may give configuration clues for IOP.

bradymiller wrote on Monday, July 14, 2014:

Hi,

Pointed one of the “up for grabs” demos to Yisrael’s code/branch:
http://www.open-emr.org/wiki/index.php/Development_Demo#192.168.1.135

-brady
OpenEMR

blankev wrote on Monday, July 14, 2014:

This Demo needs some tweaking. Does not work as all other Demo sites.

teryhill wrote on Tuesday, September 23, 2014:

Yisrael, I am having trouble getting your code to work. I added the lbf.inc file to /library and made the change to options.inc.php. Am I missing something?

Thanks
Terry

teryhill wrote on Wednesday, September 24, 2014:

I got it. I was trying to use a Nation Notes field and it will not work.

Thanks

Terry

teryhill wrote on Thursday, September 25, 2014:

Ok to get it to work with Nation Notes make this change in options.inc.php at line 802

else if($data_type == 34){

// Added to allow prefilling of nations notes with the ‘S’ option. by Terry Hill 9/25/14

if (strpos($frow['edit_options'], 'S') !== FALSE AND (strlen($currescaped) !== 0)) {
  $arr = explode("|*|*|*|",$currescaped);
  echo "<a href='../../../library/custom_template/custom_template.php?type=form_{$field_id}&contextName=".htmlspecialchars($list_id_esc,ENT_QUOTES)."' class='iframe_medium' style='text-decoration:none;color:black;'>";
  echo "<div id='form_{$field_id}_div' class='text-area'>".htmlspecialchars($arr[0],ENT_QUOTES)."</div>";
  echo "<div style='display:none'><textarea name='form_{$field_id}' id='form_{$field_id}' stye='display:none'>".$currescaped."</textarea></div>";
  echo "</a>";
}
else
{
  $arr = explode("|*|*|*|",$currvalue);
  echo "<a href='../../../library/custom_template/custom_template.php?type=form_{$field_id}&contextName=".htmlspecialchars($list_id_esc,ENT_QUOTES)."' class='iframe_medium' style='text-decoration:none;color:black;'>";
  echo "<div id='form_{$field_id}_div' class='text-area'>".htmlspecialchars($arr[0],ENT_QUOTES)."</div>";
  echo "<div style='display:none'><textarea name='form_{$field_id}' id='form_{$field_id}' stye='display:none'>".$currvalue."</textarea></div>";
  echo "</a>";
}

}