Where are calendar events stored?

I’m trying to automate certain documentation functions in our clinic. In order to do this, I need to know who is scheduled for a particular day. While looking at the Calendar or generating a report of the calendar is pretty easy, I would like to query the database for this information. When I look at the database and PHP code, I see queries selecting from a ‘calendar’ object, but cannot find a calendar table or view. How can I query the OpenEMR database for a list of patient appointments for a particular day?
Thank you,
–RBL

Ok, I figured out that the calendar events are stored in openemr.openemr_postcalendar_events. Is ‘calendar’ some kind of global or alias?

SELECT * FROM openemr.openemr_postcalendar_events where pc_eventDate=‘2019-06-24’;

Here is a little bit neater query for a particular day’s patients:

use openemr;
SELECT
patient_data.fname,
patient_data.lname,
openemr_postcalendar_events.pc_pid,
patient_data.DOB,
openemr_postcalendar_events.pc_eventDate,
openemr_postcalendar_events.pc_startTime,
openemr_postcalendar_events.pc_title,
openemr_postcalendar_events.pc_hometext
FROM
patient_data
left join
openemr_postcalendar_events on patient_data.pid = openemr_postcalendar_events.pc_pid
WHERE openemr_postcalendar_events.pc_eventDate=‘2019-06-24’
order by openemr_postcalendar_events.pc_startTime asc;

Except recurring appointments which need PHP code.

1 Like