AutoSave Implimentation

juggernautsei wrote on Wednesday, June 15, 2016:

READ

There has been several threads over the years for autosave feature. Has anyone successfully implimented an autosave function for the LBF’s?

This is going to be a nightmare because LBF’s are so varied and implimenting a javascript/ajax/jquery that would save any and every form is going to be a real challenge.

Of course trying to do the simplest thing that works has been what I was trained to do.

Thinking along the lines of is there a way to make an ajax call to the LBF save mechinism in the background without desturbing the page that is being edited.

Thoughts…

sunsetsystems wrote on Wednesday, June 15, 2016:

Personally I like to be in charge of when my form data is saved, and that’s the way web forms traditionally work. But I understand that in a busy practice people are sometimes interrupted and may forget to come back before their session times out.

What I have created and plan to share very soon is some code that will do the “are you sure you want to leave” prompt via a “beforeunload” event handler when there are unsaved changes. I have this working for LBFs, demographics and the layout editor.

It seems reasonable to add to this some logic that will simulate a click of the Save button if there are unsaved changes and the session is about to time out. All this can be done client side, no AJAX required.

Rod
http://www.sunsetsystems.com/

juggernautsei wrote on Wednesday, June 15, 2016:

You are right on the money with the people that are using the software and want the program to help watch out for their work. We have all done it, working on a form and get distracted. Only to resume and have to start all over again.

I was looking at the ajax because it would require no action or natural action on the part of the user. The best thing would be to save the document before the session timed out. Seems to me like we can just have logic to click the save button if they are idle for 5 minutes.

sunsetsystems wrote on Wednesday, June 15, 2016:

Auto-saving can be problematic when the data fails validation, and also falls into the category of surprising behavior that may be unwelcome. That’s why I like it being a last resort and tied to the session timeout stuff. We could introduce the concept of “registering” a save handler with the session timeout logic.

Again this assumes that the beforeunload handler is also in place to avoid direct user actions that would otherwise lose changes.

Rod
http://www.sunsetsystems.com/

mdsupport wrote on Wednesday, June 15, 2016:

Since this system deals with data that requires physicians to sign off and stand by the accuracy of the notes, we need to very careful about background processes. Changes committed to medical records without explicit action by user would be a definite no unless there is a draft mechanism.

I know it is frustrating when your input is met with ‘Invalid session’ response. But flip side is reviewing every form for autosaved information - which is impractical for busy practices. Unless there is a pre-built framework solution for saving drafts and offering to transfer it to current form, please consider convincing the potential sponsor to use their development funds for something more productive.

sunsetsystems wrote on Wednesday, June 15, 2016:

A draft mechanism is an interesting idea, and could be done in a way that is not form-specific.

Rod
http://www.sunsetsystems.com/

bradymiller wrote on Thursday, June 16, 2016:

Hi,

Just placing the following buttons at the bottom would likely suffice for most physicians whom are typing/editing notes:

‘Save and Continue’
This will save the note but not close it. This allows physicians to save the note very frequently with minimal annoyance and ensure don’t lose stuff(most physicians are well trained in this art after losing a note or two).

‘Save and Close’
This will save the note and close it.

‘Esign’ or ‘Sign’
This will save the note, sign it (request the user password to sign it), and close it for good.

Just having the above buttons/workflow on the notes should suffice since most physicians will function as auto-saving machines anyways(clicking the ‘Save and Continue’ numerous times).

-brady
OpenEMR

juggernautsei wrote on Thursday, June 16, 2016:

I did some more digging and found this package http://sisyphus-js.herokuapp.com/#controls-sample.

It is what Rod said that makes this most appealing is that it is all client side. I think Rod had a great idea to make it all client side so that the database storage would be the last action and not a constant action that can lead to errors and omittions.

I believe with this package the docs can work as they normally do and not have to click save but once and the rest is managed even if the browser is closed or timed out because it is all stored local and the package seems to restore all data.

I will check the license on this before integrating.

sunsetsystems wrote on Thursday, June 16, 2016:

Interesting. A couple of issues immediately come to mind.

  1. The user will need to log in again and navigate back to the form in question, and will likely not remember which patient or form they were working on.

  2. I expect that keeping PHI in browser storage after session timeout would violate security requirements.

Rod
http://www.sunsetsystems.com/

juggernautsei wrote on Friday, June 17, 2016:

Ok since saving data client side is a no no.
I tried this package http://jsfiddle.net/MadLittleMods/NxQ4A/.

I got it in but it really doesn’t save the page. I have not spent the time to figure out why cause I want to ask if you forsee issues with this method.

Sherwin
www.openmedpractice.com

sunsetsystems wrote on Friday, June 17, 2016:

That looks like an automated “save and continue” implementation. Aside from the validation issue I raised in post #4, you’d have to rewrite a fair amount of code and you still haven’t dealt with helping users remember that they need to finish something and how to get back there.

It’s an interesting problem. I am still inclined to favor a draft mechanism (and I think it would be less invasive to existing code), but the person doing the work gets to decide what they are willing to do.

Rod
http://www.sunsetsystems.com/

juggernautsei wrote on Monday, June 20, 2016:

Here is a working copy of the auto save feature.

No major code rewrite needed. The javascript is delayed five minutes after the last thing is typed. If there is no activity in 5 minutes, it simply clicks the save button for them. The who ever can simply click edit to resume documentation.

Now, I think that remembering who they were working on should be on their plate.

The only thing I think I would need to add is a Global setting to change the save interval. Right now it is hard coded.

mdsupport wrote on Monday, June 20, 2016:

I find it troubling to commit changes to live medical record without user action or put another way - due to user inaction.

If there is pressing need, Rod already has hook in the existing code to inject site specific code after the engine has done processing the layout. It may be better to provide this as an sample that administrator can copy and enable at individual layout level.

tmccormi wrote on Monday, June 20, 2016:

As the world moves to mobile devices you will that there is NO save button. changes are recorded as they happen in mobile apps. I also find that a bit disturbing, but it is going to be inevitable …

Even google docs web app has no save action, only revision review and roll back.

bradymiller wrote on Tuesday, June 21, 2016:

Hi,

The difference in a medical EMR is that these physician documents carry real legal implications. While this current code/feature would be appropriate for a specific client request, in order to support something like this in the main codebase, it would need to be clearly marked and made clear that this was both an auto-saved and incomplete document. Less importantly, it would also seem to make more sense to support an auto save that does a “Save and continue” workflow, meaning it does not leave the form after the save.

-brady
OpenEMR

juggernautsei wrote on Tuesday, June 21, 2016:

I can understand the save and continue and also marking the form with an injection that the form is incomplete because that would make it easier to generate a report or log of what forms have not been completed so the user can go back to those patient forms and complete them and remove the incomplete flag.

That sounds like a good work flow.

Also, this feature should not be on by default. The feature should have to be selected by the user so that they know they are turning it on and can expect this feature to occur.

I’ll work on doing the save and continue implimentation. I’ll get back to you when I have some concrete.

juggernautsei wrote on Tuesday, June 28, 2016:

Rod,

I see you posted the addon for the unsaved changes.
My question is does this halt the system from processing the timeout function?

Sherwin
www.openmedpractice.com

sunsetsystems wrote on Tuesday, June 28, 2016:

Good question! It does indeed. I’ll work up a fix.

Rod
http://www.sunsetsystems.com/

bradymiller wrote on Tuesday, June 28, 2016:

Hi Rod,
This basically just involves sending a flag in the link. Check out the mechanism that is used in the left_nav when monitoring the messages.
-brady

sunsetsystems wrote on Tuesday, June 28, 2016:

Brady, not sure what link you mean but session timeout is handled via auth.inc and not “background services”.