Rules with targets using 'Custom Table' criteria

mdsupport wrote on Monday, February 10, 2014:

  1. When a rule uses ‘Custom Table’ that has no ‘date’ column, rules engine fails.
    One of the test cases : Users want active reminder if there are any past_due patient reminders.

query failed: SELECT due_status FROM patient_reminders WHERE due_status=? AND pid=? AND
(date BETWEEN DATE_SUB(‘2014-02-24 14:44:16’, INTERVAL 1 MONTH) AND ‘2014-02-24 14:44:16’)

  • Rules behave in arbitrary manner when the table does have a ‘date’ column but it has no relevance to the rule.
    One of the scenarios: Users want active reminder if the patient is deceased.

Both of these errors can be corrected if ‘interval’ can be made optional. When we add ‘not applicable’ entry to target_interval list, it shows up correctly. But saving the target replaces the display as ‘Months’ and results in rule_target record target_interval with no interval value.

Does anyone have a solution for either of the two problems? You can see the issue #1 in demo (2102) by turning on the alert “z01 - Check Alerts”. Also Hoping to drop “Due *” suffix to the alert message if alert is not based on intervals. That will allow display of a plethora of active alerts in one box such as Duplicate Names, Patient Balance > xxxx etc…

bradymiller wrote on Tuesday, February 11, 2014:

Wow,
Never thought users would set up an active reminder based on a patient reminder. Are you able to get what you want if you directly modify the rules in the database (ie. not using the gui); lot more flexibility if do it that way.
-brady
OpenEMR

mdsupport wrote on Tuesday, February 11, 2014:

Database changes alone don’t work since the code has several hard defaults - sadly not for new entries in “Clinical Rule *” lists. So if interval entry is not found, code adds date<today as datesql string. Developers have identified sections that need tweaks but since this is tied to MU we want to see if anyone has already done similar enhancements.

With direct database updates we are always at risk of a change transaction using GUI will wipe out our manual changes.