Using Stored Procedures & Triigers in LBF Forms

I have read the dev thread on SQL Stored Procedures & Triggers which goes back some years.

For those of us not yet confident enough to attempt calcualtions in LBF forms in php. Is there any reason why one could not use SQL triggers and Stored proceurse in LBF forms?

For example, I have a form to evaluate the risk of DVT’s that has predefined score values. I was thinking of using a custom lookup table to hold the description and score and in the LBF using required boolean choices to trigger a stored procedure to update a read only(LBF) score for the evaluation.

For me this would be a pretty staright forward task. My question is: Is there any reason why I should not do this?

I have the form_ID, field_id and with these in a lookup table the trigger just needs to execute a lookup and sum on the values to give a risk factor score and update the LBF_Data score total field value.

I appreciate that doing this in a core table or system process has huge ramifications. However referencing just LBF data, I can not seee that is would cause issues.

As long as you’re willing to maintain it and keep up with any updates from the OpenEMR community, shouldn’t be a problem as that’s the beauty of opensource and running your own system.

You could even package all your changes in a module inside the table.sql file if you wanted to try and keep it cleaner / maintainable for future use.

If you’re doing this for a client and you know at some point you may not be around to maintain this system, I’d be careful in introducing a change like this without a heavy degree of documentation for whoever comes after you as its not a pattern we use in OpenEMR.

1 Like

Hi Stephen, Thanks for your reply. I am a bit blown away with OpenEMR. In a few weeks I have got the basics for our pratice up and running in a way that suits the UK.

It is, like all clever frameworks a steep learning curve. I am very happy to say that our practice nurse commented yesterday that the little I have done is better than the BIG clinic they left using Sales Force and Extensions.

That is more down to OpenEMR, and the forum than my expertise. I think the UK useage is quite small?

We will create a trigger that will execute a stored procedure with some checks and balances so that it is isolated.

I think there may well be a mraket for us to sell some services in the UK. All the forms we are creating are pretty much for UK compliance. I really think OpenEMR deserves a bigger footprint here. I will dig into the table.sql and learn some more.

The beuaty of the framework is the effort in customising it makes it fit the need rather than the clinic trying to fit into SalesForce.