Date calculations in the CD rules engine

k2c-supp wrote on Wednesday, November 04, 2015:

I am adapting the public version 4.2.0 to work in a therapy clinic. I understand db structure and the php files but I am not a programmer.

Medicare requires therapists to re-evaluate clients at least every 6 months from the date of the physician’s referral. I can create a new rule and get a clinical reminder that the re-eval is due but the therapist would like to see the date for the re-eval on the patient info screen. Can that date be calculated from the table.field Transaction.refer_date and posted in the clinical reminder box?

Also, Medicare authorizes 23, 46, or 52 units of language therapy within 6 months depending on severity of the pathology. The therapist would like a running countdown of units available for a client. Anyone have a suggestion how I would provide that information, preferably on the patient info screen?

fsgl wrote on Wednesday, November 04, 2015:

No coding method:

  1. It’s not that difficult to add 6 months to the date of last previous result.

  2. Enter the number of authorizations in User Defined & subtract as they’re used.

Coding will be required for automation, but it may be rather difficult due to the complexity of CDR engine.

k2c-supp wrote on Thursday, November 05, 2015:

Thank you fsgl.
I am assuming then that a clinical rule can not be set up based on a particular date. For example, a Physician provides an order for services to begin on 12-1-15 and that date is entered in refer_date in the transactions table. The order will be good for 6 months from that date. The clinician needs to reevalate the patient by that time. The clinical reminders widget seems like the logical place for a reminder to pop up 1 month before the due date.

fsgl wrote on Friday, November 06, 2015:

You’re welcome.

Active or Passive Reminder will appear at a regular interval, e.g., every month, every 6 months. I don’t remember being given a choice of a start date, so the reminders will pop up every month or 6 months from the rule setup date.

The transactions table is used for items in the Transactions tab in Demographics, such as a referral; therefore refer_date is reserved for referrals & cannot be used for a new clinical rule.

bradymiller wrote on Saturday, November 07, 2015:

Hi,

The feature of showing the last date (and the actual last data entry, if applicable) would be a nice feature. Getting the date likely would not take too much coding work to accomplish(it would take some work, though). Getting the last data entry would take more work:
http://www.open-emr.org/wiki/index.php/Active_Projects#Add_mechanism_to_display_the_database_values_used_in_the_rule

-brady
OpenEMR

fsgl wrote on Saturday, November 07, 2015:

Not likely we will have a developer code last result date in Clinical Reminder widget anytime soon (unless Brady is volunteering), given that 2014 CEHRT is still an elusive goal.

No coding method will have to suffice for now.

k2c-supp wrote on Monday, November 09, 2015:

The no coding method mentioned above would provide a passive (or active) reminder 6 months from whenever someone activates that form, almost a random date. The hard date required by Medicaid for the re-evaluation is exactly 6 months from the date of the Physicians authorization of services, the date we record in the referral form. Until we can figure out how to use the information stored in the database, we will continue to look up the specific date on a calendar and send a couple of tiered dated reminders to the clinician. She still wants the re-eval date staring at her on the patient info page though.

mdsupport wrote on Monday, November 09, 2015:

Medicare interval requirements need to be met by setting up a rule that considers billing records for selected CPT code AND interval from Date of Service. This is no different than medicare annual physical for primary care - do the physical a day less than mandatory minimum of 365 days interval and your claim will be denied.

A more flexible approach we have implemented involves adding a field (enc_freq) to patient data and then using following view to be used in the rules :

select `p`.`pid` AS `pid`,
max(`e`.`date`) AS `date`,
max(ifnull(`i`.`provider`,0)) AS `carrier`,
(max(`e`.`date`) > (now() - interval if((`p`.`enc_freq` > 0),`p`.`enc_freq`,156) week)) AS `lastenc`,
`p`.`enc_freq` AS `enc_freq` 
FROM ((`patient_data` `p` left join `form_encounter` `e` on((`p`.`pid` = `e`.`pid`))) 
LEFT JOIN `insurance_data` `i` on((`p`.`pid` = `i`.`pid`))) 
WHERE ((ifnull(`p`.`deceased_date`,0) = 0) and (`i`.`type` = 'primary') and isnull(`i`.`date`)) 
GROUP BY 1