Implementation of LBF visit forms in Onsite Portal

Hi everyone,
Based on numerous requests and ACE Health Solutions (Jit Chawla) preferred vendor annual contribution to the community, I will be introducing capability(v5.0.2 patch 5) to send LBF visit(encounter) type forms to the Portal Patient Documents to be completed by patients then returned for review via Dashboard. Feature will also be available in Patient Documents for reception/patient to complete on check in.
Eventually my hope is to allow the check in to pop out to a tablet in a wizard style for patients to complete during appointment check in i.e kiosk style.

This is also part of my ongoing effort to emulate features provided by our WordPress portal plugin that is currently not supported in Patient Portal.

The purpose of this post is for general information on workflow, capabilities and feedback.
Currently via Portal Dashboard, text/html templates using replacement directives are uploaded and assigned to a given patient or all patients. LBF will work in the same way by adding the {EncounterForm:LBFformname} directive to any normal template. e.g: PHQ-9.tpl

<span>This is a part of base template wrapping LBF form.</span>
<label style="font-size:14px">Witness Date: </label>{DatePicker}<label style="font-size:14px">Signed: </label>{AdminSignature}

the form selections and past status in portal:

the form ready for review:

And Dashboard review (cropped for brevity):

Some notes concerning building templates and directives/tags:

  • Note that in review the following items are available but not in patient version:
    – Assessment Score:
    – Score Indicates a depressive state of:
    – Administrator Signature:

This is due to a feature I added to Layouts editor for v5.0.2(4) namely, Exclude in Portal edit option:

This option is also used in the DEM layout to exclude patient seeing certain items in their Profile editor.

  • Reviewer may edit LBF before charting and flattening the form e.g to add scores etc.

Here is charted/locked form to patient:

and in Patient Documents chart:

Next Steps:

  • Ability to assign documents to encounters via popup of existing pending or follow up encounters.:
    – From Review
    – By provider in Encounters.
  • Add Demographics History Form for one to one charting from review.

The following are some new directives/tags i’ve made available in this version:

  • {FormEncounter} where I hope to include other encounter forms besides LBF in future.

  • {StandardDatePicker} This is the browsers date picker for input type=‘date’ (mm/dd/yyyy).

  • {DatePicker} our core date picker (yyyy-mm-dd). Depends on globals locale

  • {DateTimePicker} our core date and time picker (yyyy-mm-dd hh:mm:ss).

  • {TextBox:rrxccc} text area defined by row/columns ie {TextBox:05x120}

  • {varTextInput:length} define input text field length i.e {varTextInput:75rem} or {varTextInput:150px} etc.

  • You may add javaScript/JQuery to act on template loads. Soon to be directive for isolation e.g

<script>const templateVar='hideElement';$('#element').hide();</script>

Did some work in rendering/flattening templates by request @gutiersa :slight_smile: also date examples.

I’ve been wanting to do this for a long time and I hope it will prove useful to the community so thank you Jit, for this donation. And because i’m so terrible about putting new features in and not telling anyone, here’s a shameless plug.

Reworked Dicom viewer:
You can now load studies from entire folders/directories:

And save and retrieve image edits

And also added Dicom Tags and Help:

Next version will have the PACS viewer and server. You may also select Dicom viewer as a stand alone in separate tab from menu Miscellaneous->Dicom Viewer and select study from file, directory or Url.

Also i’ve added taking manual credit cards from Front Payments. Currently Stripe or Authorizedotnet.

Thanks for any feedback.


While i’m here i’d like to point out the following. Some of this is heading for API portal support:
Users have a couple new items to support portal, encounters and fee sheet.

  • New Portal user flag to indicate a user is authorized for portal actions. Mainly to allow non-auth users to support their doctor/care team etc to screen portal mail/chats and requests.
  • New Supervisor selection to assign a supervisory user to current user. Especially helpful in feesheet by defaulting supervisor to this users supervisor.
  • The portal-user user is now used to limit permissions of what a patient is allowed to see in portal by setting the ACL for portal-user.


Awesome stuff.
My contribution will be

  1. To add it all to the wiki.
  2. To set up a secure template server where people can connect and download templates to their openemr server.

How do I find these? Or is there a pre-patch?


That’d be great because this feature will require some hints as LBF is not very intuitive for new users.

Our contib directory is a good place for donated templates.
I plan to change template import where instead of importing to ‘Globals All’, we will import to a repository directory. Then from there, user can move to where the template is needed. i.e grab a Privacy template and place in a patient’s destination. Or will leave as is and inform user to only upload templates they will use straight to destination from their local and place all canned templates in contrib.

LBF’s will need to be created by user for their purpose or a sql import can be added in the contrib directory or we may provide a few canned LBF’s as part of install.

@gutiersa Whatever we do it is very important to remember to keep it as simple/easy as possible for me! :slight_smile:

I will be posting a pre patch here shortly after I get by peer review. I’m sure ole eagle eye will catch me not escaping something!:slight_smile:

1 Like

I think LBF has a high learning curve. This stuff is intuitive for programmers, but not for us. It takes major learning investment. Same happened with my previous EHR. I spent 3 years setting up the practice’s templates such that I could actually spend my time talking to the patients. Now I am doing this all over again with another EHR. (Shaking my head, because I can’t even figure out how to put an icon in here).

If the templates are in contrib, users still have to figure out where to find them, how to get them, and how to implement them.

Just do it the way the most popular app in the world does it, that way everyone can do use them.

I should be doing the templates while you focus on programming, but I still haven’t been able to figure out my email. Our world should not be so unfriendly.

I admit, LBF can be difficult to get use to. However, many users depend on this core templating engine as their only recourse for creating encounter forms for specific uses to their discipline. Most difficult for many is the row and column layouts but, once you get by that, LBF is pretty straight forward for most forms that are mainly questionnaires which often times, end up being transcribed elsewhere.
There are other reasons for LBF in patient documents such as using existing core forms such as History:

Note the help which can be added to templates but ignored in disposition.

This form is already in core and sorely needed in portal or intake.

For pure templates it is helpful to remember that they were meant for simple, mostly legal documents and it got carried away. However, they can be versatile enough to handle many document types if you always keep in mind, templates are simply tagged directive replacement where template resides inside a form tag wrapped by a div.


So adding an icon can be as easy as:

<span><i class="fa fa-envelope fa-2x"></i>{varTextInput:320px}</span>

or a label

<label class="fa fa-envelope">Please Enter Blah</label>{varTextInput:120px}

Another important point is text vs html. By default all templates will be cleaned up on render by replacing all “\r\n” with a <br /> tag unless the {ParseAsHTML} directive is used, where in that case, linefeeds are simply removed without any replacements allowing to format as html rendering only. Remembering one also has the <pre></pre> tags for pure text.

Concerning template repository: I’m still working out the best way to handle these in dashboard. I always try to make the UX as clean and easy as possible. Sometimes i’m lacking but, be assured it is forefront in my mind. So, i’ll come up with something!!!

A note on this project. I never accept a vendors sponsorship unless it is allowed to be put in OpenEMR core for the community use. Many times this is just token funding where I end up taking on the responsibility for the feature implementation/integration and support. This includes making sure we provide for the existing release and v6.0. I’m not crying poor me but wish to point out why I put up these forum posts. It’s to gauge if the community finds the feature useful and whether I should go through all the effort or not. In this case i’m hesitant. Six likes from three people doesn’t exactly scream let’s do this.

So, I may not go through the effort to support and patch v5.0.2 and just wait to maybe put in v6.0. It’s getting very tedious trying to support v5.0.2 while developing for upcoming v6.0 release. I may publish an unofficial patch for those that want the feature and willing to take responsibility for their own implementation.

I have no idea what you mean here!

1 Like

Sorry, never finished this. I have to get back to this. Problems with server.
I was trying to get to things like apps for apple and android phones. Having like an template download site.

But like I said. I have to get back to that.

Some more additions and improvements:

  • Changed dashboard template editor to a full dialog.
  • Added another radio group directive for true/false responses.
  • New Medical History canned template based on History LBF. Has ability to edit or add codes in review and also render to printable for document charting.
  • Items can be excluded from portal view but seen by reviewer.
  • LBF can still be included with additional template directives i.e maybe a signature or dates etc.

Finally a PR:Portal support for LBF template engine by sjpadgett · Pull Request #3946 · openemr/openemr · GitHub

I will do a pre-patch 5 for v5.0.2 and post here soon for those I hope will help me test. In the patch I added a new canned default template Medical_History that uses LBF with a patient signature:

In review:

Where reviewer is allowed to make edits not allowed by patient. Codes is a good example:

With History form, reviewer can then chart to demographics history, download or send printable to documents.
Flattened printable version after charting:

I think LBF is a good addition and should ease form diversity in Portal.


Nice work! Guessing @sunsetsystems (original dev of all this LBF stuff) will be very happy to see this template engine getting expanded to the patient portal :slight_smile: Looking forward to checking out the PR.


Here is patch for those wanting to try out. Remember this patches from 5.0.2(4) so previous patches are not included.
This patch includes all new fixes for patch 5 including

  • EOB bug fix
  • 2020 ICD10 code zips
  • Reworked portal custom report
  • Of course new LBF feature.

This is cool too! v6.0.0


And for v6.0.0:

1 Like

I am stuck on the use of github. Can you recommend a YT video that can help me understand github?
I would like to work toward catching up such that I can document. It is hard for me to document if I don’t understand or apply the information.
Is ports applications like in freebsd or is it short for portal?

Hi Sandra, Sorry for misunderstanding. By port I’m talking about porting code i.e making v5.0.2 version of feature compatible with v6.0.
I merged the PR into master(v6.0) so it’s just a reference in this thread so I can show off! :slight_smile:

If you want to test the new feature in v5.0.2(4) then apply the patch from here: Implementation of LBF visit forms in Onsite Portal
Else install v6.0 dev from master or downloads(I believe)

1 Like

I see, I did install master today, actually, I could not install it, check this out:

BTW, you should show off :slight_smile: it’s a lot of work

@sjpadgett Hi Jerry, Getting an error in the admin panel using this whenever I try to visit the Portal Audits page from the portal alerts menu.

Oh Snap!

You may want to try returning to the the previous page and verifying that all fields have been filled out correctly.

If you continue to experience this error please contact support.

Stack Trace:

#0 /var/www/portal/patient/fwk/libs/verysimple/Phreeze/Dispatcher.php(90): GenericRouter->GetRoute(‘GET:onsiteactiv…’)
#1 /var/www/portal/patient/index.php(52): Dispatcher::Dispatch(Object(Phreezer), Object(SavantRenderEngine), ‘’, NULL, Object(GenericRouter))
#2 {main}

Does portal patient documents work?
Sounds like ya don’t have php RewriteEngine On in php.ini or redirect module is not installed or enabled.
sudo a2enmod rewrite
sudo systemctl restart apache2

1 Like

This might be a chrown issue, i’ll come back to it tomorrow now.

@sjpadgett Edit: My issue was a mix of apache chrown permission issues or cached data from 5.0.2 (4) - after using ccleaner with all browsers closed it all seems to be working fine :slight_smile:

Are you going to add nation notes support? Or maybe for fields with that give the patent a basic text editor?

The portal LBF will the same in portal as an encounter visit form so nation notes would confuse patient for sure. Hell, it confuses me still after six years!:slight_smile:

A html text area should be more that sufficient where I gave a configurable text area with directive {TextBox:rrbyccc} e.g {TextBox:04by120} for 4 rows of 120 chars.

I have no plans to add an editor though I could at some point.