From 967af3f100af84f2edd5670faa2bbb88a71fc4b3 Mon Sep 17 00:00:00 2001 From: bradymiller Date: Tue, 25 Sep 2012 12:39:37 -0700 Subject: [PATCH] Improved/optimized CDR engine reports (and patient reminders) and added a generic report result tracking/storing/viewing feature (final revision). --Added option to set processing priorities at Administration->Globals->CDR: CDR Reports Processing Priority Patient Reminder Creation Processing Priority This is only functional in linux (and other OS's that support NICE priority setting; note Windows does not support this). This is a nice way to allow running these reports without hogging up computational processing. --Added features to store/track/view reports (and patient reminders). This feature is actually rather generic and could support other reports, if desired. The following reports are supported: -Reports->Clinic->Standard Measures -Reports->Clinic->Quality Measures(CQM) -Reports->Clinic->Automated Measures(AMC) -Administration->Patient Reminders (Both 'Process Reminders' and 'Process and Send Reminders') To view previous report results and follow status of pending reports, go to: -Reports->Clinic->Report Results This screen lists previous and pending reports: -Can see results by clicking on Title -Date of reports are listed -If report was completed, then time to completion is listed -If report is pending, then a status (ie. how many patients are left) is listed To support this, a database table report_results was added (in vertical style to allow flexibility in supporting reports) with a library of function at library/library/report_database.inc and a relatively generic report result listing script at interface/reports/report_results.php. --Some real examples on using the store/track/view report features include (in order of intensity): 1. Go to Reports->Clinic->Standard Measures and click Submit. Every ten seconds you will be updated with the status and when it's done, you'll be shown the results and can always go back and view them at Reports->Clinic->Report Results. 2. Go to Reports->Clinic->Standard Measures and click Submit. Leave the screen to do other things or can even log off. Can then see the results (or status if still pending) at Reports->Clinic->Report Results. 3. Go to Administration->Globals->CDR and set both 'CDR Reports Processing Priority' and 'Patient Reminder Creation Processing Priority' to 'Lowest Priority'. Now go to the following screens, click Submit and then go to the next screen etc.: Reports->Clinic->Standard Measures (click Submit) Reports->Clinic->Quality Measures(CQM) (click Submit) Reports->Clinic->Automated Measures(AMC) (click Submit) Administration->Patient Reminders (click Process Reminders) Now can work on other stuff or logout and can see results (or status if still pending) at Reports->Clinic->Report Results. --A json library was added to support php versions < 5.2, since the report results are saved in json format in the database. --- custom/export_registry_xml.php | 8 + interface/batchcom/batch_reminders.php | 46 +- interface/main/left_nav.php | 1 + .../patient_file/reminder/patient_reminders.php | 93 ++- interface/reports/cqm.php | 228 ++++-- interface/reports/report_results.php | 267 +++++++ library/ajax/collect_new_report_id.php | 36 + library/ajax/execute_cdr_report.php | 84 +++ library/ajax/execute_pat_reminder.php | 64 ++ library/ajax/status_report.php | 41 ++ library/clinical_rules.php | 56 +- library/globals.inc.php | 26 + library/jsonwrapper/JSON/JSON.php | 806 +++++++++++++++++++++ library/jsonwrapper/JSON/LICENSE | 21 + library/jsonwrapper/jsonwrapper.php | 25 + library/jsonwrapper/jsonwrapper_inner.php | 41 ++ library/reminders.php | 52 +- library/report_database.inc | 262 +++++++ sql/4_1_1-to-4_1_2_upgrade.sql | 9 + sql/database.sql | 14 + version.php | 2 +- 21 files changed, 2074 insertions(+), 108 deletions(-) create mode 100644 interface/reports/report_results.php create mode 100644 library/ajax/collect_new_report_id.php create mode 100644 library/ajax/execute_cdr_report.php create mode 100644 library/ajax/execute_pat_reminder.php create mode 100644 library/ajax/status_report.php create mode 100644 library/jsonwrapper/JSON/JSON.php create mode 100644 library/jsonwrapper/JSON/LICENSE create mode 100644 library/jsonwrapper/jsonwrapper.php create mode 100644 library/jsonwrapper/jsonwrapper_inner.php create mode 100644 library/report_database.inc diff --git a/custom/export_registry_xml.php b/custom/export_registry_xml.php index 215f9f759..39dab49f3 100644 --- a/custom/export_registry_xml.php +++ b/custom/export_registry_xml.php @@ -32,6 +32,14 @@ session_write_close(); //Remove time limit, since script can take many minutes set_time_limit(0); +// Set the "nice" level of the process for these reports. When the "nice" level +// is increased, these cpu intensive reports will have less affect on the performance +// of other server activities, albeit it may negatively impact the performance +// of this report (note this is only applicable for linux). +if (!empty($GLOBALS['cdr_report_nice'])) { + proc_nice($GLOBALS['cdr_report_nice']); +} + function getLabelNumber($label) { if ( strlen($label) == 0) { diff --git a/interface/batchcom/batch_reminders.php b/interface/batchcom/batch_reminders.php index 4a0687578..3ac94a135 100644 --- a/interface/batchcom/batch_reminders.php +++ b/interface/batchcom/batch_reminders.php @@ -15,6 +15,12 @@ require_once(dirname(__FILE__)."/../../interface/globals.php"); require_once ($GLOBALS['srcdir'] . "/classes/postmaster.php"); require_once ($GLOBALS['srcdir'] . "/maviq_phone_api.php"); require_once($GLOBALS['srcdir'] . "/reminders.php"); +require_once($GLOBALS['srcdir'] . "/report_database.inc"); + +// This is only pertinent for users of php versions less than 5.2 +// (ie. this wrapper is only loaded when php version is less than +// 5.2; otherwise the native php json functions are used) +require_once "$srcdir/jsonwrapper/jsonwrapper.php"; //To improve performance and not freeze the session when running this // report, turn off session writing. Note that php session variables @@ -24,6 +30,17 @@ session_write_close(); //Remove time limit, since script can take many minutes set_time_limit(0); + +// If report_id, then just going to show the report log +$report_id = ($_GET['report_id']) ? $_GET['report_id'] : ""; + +// Set the "nice" level of the process for this script when. When the "nice" level +// is increased, this cpu intensive script will have less affect on the performance +// of other server activities, albeit it may negatively impact the performance +// of this script (note this is only applicable for linux). +if (empty($report_id) && !empty($GLOBALS['pat_rem_clin_nice'])) { + proc_nice($GLOBALS['pat_rem_clin_nice']); +} ?> @@ -46,8 +63,22 @@ set_time_limit(0);

- - + + " . xlt("Date of Report") . ": " . text($results_log['date_report']) . "

"; + } + else { + $update_rem_log = update_reminders_batch_method(); + $send_rem_log = send_reminders(); + } + ?>

@@ -60,8 +91,7 @@ set_time_limit(0);

- - +



@@ -71,8 +101,14 @@ set_time_limit(0);


+ + + +



+ +



+ -



diff --git a/interface/main/left_nav.php b/interface/main/left_nav.php index 24c0997f4..54727b7a0 100644 --- a/interface/main/left_nav.php +++ b/interface/main/left_nav.php @@ -1266,6 +1266,7 @@ if (!empty($reg)) {