E-Sign Issues

arnabnaha wrote on Tuesday, October 21, 2014:

Hi all…
fixed the issue…with the help of kevin’s idea and Ken’s method. Basically Kevin’s thought gave me a blow to check it out…This is what I did

  1. I have a History form made out of xmlformgen
  2. the table name for the form is “form_history”
  3. Real name of the form is “History Form”
  4. Safe Name of the form is “history_form”

This is what was causing the trouble - the safe name and the table name mismatch.

So, I changed the safe name to “history” from “history_form”

I also went to phpmyadmin, and changed the registry table entries for the history form and other xmlformgen (in which I changed the safe name to match it up with table name)

Also changed the formdir name to the safe name in the forms table of the openemr database of the corresponding forms.

and this allowed for the E-sign to work perfectly.

NOW, NEED TO REMEMBER WHILE BUILDING XMLFORMGEN FORMS IS TO MATCH UP THE TABLE NAME WITH THE SAFE NAME AND EVERYTHING WILL BE FINE.

Examples:

  1. Table name: form_giexam - - - Safe Name: “giexam”

  2. Table Name: form_gensurveyform ----Safe Name: “gensurveyform”

Hope, developers or others will find a suitable solution for this, till then this is the only choice and we need to keep it in mind while building forms.

Thank you everyone…and I can say that the issue is closed…

blankev wrote on Wednesday, October 22, 2014:

Since you make thing easy for us, would you be so kind to make a WIKI page. That helps to NOT forget.

arnabnaha wrote on Wednesday, October 22, 2014:

  1. I will put this thing in wiki…will help us all…but under which sub heading should I post this in wiki?

  2. Is it a issue - If we have Graphic Pain map/Patient images form in an encounter, then esign donot work. Tested in wiki also, there it doesnt work too…

arnabnaha wrote on Wednesday, October 22, 2014:

Hi Brady,

Just to make sure, in future the forms get the correct table name after being built from xmlformgen, changed the safe name of the xml codes for the forms in the contrib/forms/xmlformgen forlder. here is the commit, if possible please update into the codebase…

bradymiller wrote on Wednesday, October 22, 2014:

Hi Arnab,

Did the forms work on testing?

Also, confirmed graphic pain map bug.

For the wiki, recommend placing it i wiki page for xmlformgen in red at the top and pertinent place to always use the proper format of name for safe name and table name. And I’d then link it to another section on that form for how to fix forms that were incorrectly made.

Ideally, we will come up with a fix for this, but agree with Ken on the other thread that there appears to be no straightforward way to grab this info from within the database. Do any of the developers know if below is possible:

  1. Run function in report.php for a form (as is done in encounter screen), but throw the output away.
  2. Figure out which sql table was first accessed during above run in report.php.
  3. Do above 2 steps when the table doesn’t exist during the first try of the esign call.

-brady
OpenEMR

-brady
OpenEMR

bradymiller wrote on Wednesday, October 22, 2014:

Note the post above is for everybody (not just Arnab). Am hoping to get other developer opinions of feasibility of methodology described above.
-brady

arnabnaha wrote on Wednesday, October 22, 2014:

Hi…Brady…the esign now works for these xmlformgen forms after the safe name changes. I tested it. I will place the solution in wiki…if I make any mistake in formatting in the wiki…please take care of it…

arnabnaha wrote on Wednesday, October 22, 2014:

Placed a Bug Tracker for Graphic Pain map and Patient Image form (image_draw) here:

https://sourceforge.net/p/openemr/bugs/387/

yehster wrote on Wednesday, October 22, 2014:

Some report.php access other tables besides just form data table (to convert identifiers to displayable text for example…)

bradymiller wrote on Friday, October 24, 2014:

Hi Kevin (and everybody else),

Good point. However, I think the report.php is a nice place to “anchor” the mapping of the table name for a form and fix this bug for all forms (new ones, legacy ones, and xmlgen ones) since it’s just a function so won’t break if include it. I envision the following steps to resolve the database in the function here ( openemr/Signable.php at master · openemr/openemr · GitHub ) would fix this bug:

Step 1:
Include report.php and see if a variable called $TABLE_NAME exists and that the table exists. If so, then use that. Would be easy to add this to the official forms and new forms.

if fail, then do Step 2:
Parse the report.php file for the first value of $table_name(it’s embedded in a function, so can’t get it via above include). If that table exists, then use that. This will capture the xmlformgen forms.

if fail, then do Step 3:
Do the method that now exists.

-brady
OpenEMR

bradymiller wrote on Friday, October 24, 2014:

Also,

For the pain map form, this appears to be an unrelated bug. When one of those forms shows up in the encounter it breaks all the esign buttons with following javascript error:
$(…).esign is not a function

-brady
OpenEMR

arnabnaha wrote on Friday, October 24, 2014:

This is the wiki article

http://www.open-emr.org/wiki/index.php/OpenEMR_Xml_Form_Generator#Important_-_For_fixing_E-sign_Issues

Please make any formatting change if needed. I dont know much of html, so tried with errors, Please correct it .

I will write the next half of the article regarding the change mechanism for the existing forms.

arnabnaha wrote on Friday, October 24, 2014:

Is there any way to give e-sign ACL values? I was testing and found that even the nurse/front office can sign an encounter. Then its gone, no way to revoke even by the administrator or the physician.

If e-sign be given ACL values, like nurse can sign or a front office can sign but the administrator or the physician can open and add forms to the encounter, but cant make changes to the values or form signed by the front office or the nurse.

Is it possibe or does this mechanism exist?

yehster wrote on Saturday, October 25, 2014:

Feels cleaner to create a new php file (table_info.php) rather than defining information in report.php (no need to bring in all the other code).

Then, can also just check for the existence of table_info.php as an override to the current assumption of form_.

mdsupport wrote on Saturday, October 25, 2014:

Since you already have registry, why not make sure all things related to forms are stored there?

Ideally LBF could also self register on first use in registry.

yehster wrote on Saturday, October 25, 2014:

At “registration time” where the name of the table still needs to come from somewhere.

A “declaration” of the table name somewhere in the form’s directory is an absolute requirement.

So either changes can be made to just eSign related code or both eSign code and registry code.

yehster wrote on Saturday, October 25, 2014:

Another option is instead of just getting the “table name” a function that returns the data to hash for a given form could be provided.

bradymiller wrote on Saturday, October 25, 2014:

Agreed,

Could just have a function (like form_resolve_table($formdir) in library/api.inc that returns the table name and just then call this function to populate the table name when construct the esign class; then it can also be used for other places using forms and needing this information). And could do following in that function to resolve the table name(based on your suggestions):

Step 1. Grab it from a variable in table_info.php script

If step 1 fails, then Step 2. Use the current method (assuming form_formdir) and see if the table exists.

If step 2 fails, then Step 3. Parse the report.php file for the first value of $table_name(it’s embedded in a function, so can’t get it via above include). If that table exists, then use that. (this is important to support xmlformgen forms)

If all 3 steps above fail, then die and send an error to the log. The user can then fix it by adding a table_info.php file to the form.

If agree, then will post it on the Active projects page and see if can get somebody to work on it.

(btw, I am unclear on “data to hash for a given form”. a quick example will likely help me)

-brady
OpenEMR

bradymiller wrote on Saturday, October 25, 2014:

Looks good. Thanks for posting it.
-brady

yehster wrote on Saturday, October 25, 2014:

The fundamental purpose here is figuring out “what data isn’t supposed to change” after eSigning.

If a form is just a single row in one table, then “select * from …” provides that data.

However, in the case of LBF, the data is spread across multiple rows in lbf_data.

A developer could also have a custom form that stores data in more than one table.

The table name is needed to “get form-specific data” as noted in the comment in the code that currently crashes.