Pagination on Insurance Companies list

I have around 700 insurance companies imported into the database.
700 records is not a big data set. But while loading the Insurance list, it takes ages to load them, and also there is no pagination. Anyone has any idea, why the loading takes so much time? And how should I improve the load time?

fyi - I am using Openemr 6.1

Hi @Nitish_Patra , it’s a known issue. Just started an item for tracking.

Thank you @stephenwaite for creating a tracker. Hope to see that issue get resolved soon.

I added a form of pagination to the insurance doing this.

Put this on line 4 of the genral_list.html file.

 {headerTemplate assets='common|datatables|datatables-colreorder|datatables-dt|datatables-bs'}

change the table tag to this:

<table class="table table-striped" id="insurance">

At the table tag add this

    $(document).ready(function () {


I did not find a good way to do pagination in smarty. The only pagination I found for smarty was more than 10 years old.

But adding the data tables to insurance really helps. We have 3000+ in our table and even with indexing it takes a long time for them to load to the screen. When they do load to the screen, then the data is managed by the datatable very well.

1 Like

Hi @juggernautsei , Thank you for the code snippet. I used that piece of code, and it worked. Unfortunately, the initial load time still remains the same as you mentioned. It does help and I hope that this issue gets resolved soon as a patch. I am curious how this issue still exists even though it is a known bug at version 7.

hi @Nitish_Patra , you can try out the work around for insurances with this patch that includes other bug fixes by @sjpadgett.

Hi @stephenwaite , i applied the patch as per the instructions on v7 patch 2. No changes in the insurance page. Still loads slow and no pagination. One of my teammate observed that the loading issue is because of the join with the phone_numbers table while loading the list. So we removed those columns in the list view file and commented the code which joins the phone_numbers and the speed increased drastically. Anyway the phone numbers could be seen inside the view on an insurance company click. So the trade off is fine for us. And for pagination @juggernautsei 's code snippet works good.

Hi @Nitish_Patra , the new feature is available when editing insurances.

Will check out that join to see if it can be optimized.

Oh I see. I misunderstood the screen in the first place. Thanks for considering about the join.
fyi library\classes\InsuranceCompany.class.phpinsurance_companies_factory() , the while loop causes the speed issue.

All you vendors out there coming across issue such as this, how about fixing or modifying and submitting a PR! Sounds like you know what the solution is.

Somebody could convert the smarty to twig. If you need pagination it is doable in smarty with a little effort.
As far as I’m concerned this is a feature request and not really a bug.

1 Like

@sjpadgett I searched the web for smarty pagination and could not find anything that wasn’t 10yrs old. I tried for a while to shoehorn the code in. I couldn’t muster up enough brain power to make it work. I am always pressed for time so I had to move on and the data tables were the best I could offer.

I appreciate for the contributors for giving their time and efforts on OpenEMR development. I am not used to both smarty and twig, so I am not trying to work on PRs right now. :smiling_face_with_tear: