Published on 22.07.13 in Vol 2, No 2 (2013): Jul-Dec
Scalable Decision Support at the Point of Care: A Substitutable Electronic Health Record App for Monitoring Medication Adherence
Background: Non-adherence to prescribed medications is a serious health problem in the United States, costing an estimated $100 billion per year. While poor adherence should be addressable with point of care health information technology, integrating new solutions with existing electronic health records (EHR) systems require customization within each organization, which is difficult because of the monolithic software design of most EHR products.
Objective: The objective of this study was to create a published algorithm for predicting medication adherence problems easily accessible at the point of care through a Web application that runs on the Substitutable Medical Apps, Reusuable Technologies (SMART) platform. The SMART platform is an emerging framework that enables EHR systems to behave as “iPhone like platforms” by exhibiting an application programming interface for easy addition and deletion of third party apps. The app is presented as a point of care solution to monitoring medication adherence as well as a sufficiently general, modular application that may serve as an example and template for other SMART apps.
Methods: The widely used, open source Django framework was used together with the SMART platform to create the interoperable components of this app. Django uses Python as its core programming language. This allows statistical and mathematical modules to be created from a large array of Python numerical libraries and assembled together with the core app to create flexible and sophisticated EHR functionality. Algorithms that predict individual adherence are derived from a retrospective study of dispensed medication claims from a large private insurance plan. Patients’ prescription fill information is accessed through the SMART framework and the embedded algorithms compute adherence information, including predicted adherence one year after the first prescription fill. Open source graphing software is used to display patient medication information and the results of statistical prediction of future adherence on a clinician-facing Web interface.
Results: The user interface allows the physician to quickly review all medications in a patient record for potential non-adherence problems. A gap-check and current medication possession ratio (MPR) threshold test are applied to all medications in the record to test for current non-adherence. Predictions of 1-year non-adherence are made for certain drug classes for which external data was available. Information is presented graphically to indicate present non-adherence, or predicted non-adherence at one year, based on early prescription fulfillment patterns. The MPR Monitor app is installed in the SMART reference container as the “MPR Monitor”, where it is publically available for use and testing. MPR is an acronym for Medication Possession Ratio, a commonly used measure of adherence to a prescribed medication regime. This app may be used as an example for creating additional functionality by replacing statistical and display algorithms with new code in a cycle of rapid prototyping and implementation or as a framework for a new SMART app.
Conclusions: The MPR Monitor app is a useful pilot project for monitoring medication adherence. It also provides an example that integrates several open source software components, including the Python-based Django Web framework and python-based graphics, to build a SMART app that allows complex decision support methods to be encapsulated to enhance EHR functionality.
Interact J Med Res 2013;2(2):e13
- electronic health record;
- personal electronic health record;
- hospital information systems;
- medical informatics applications;
- accountable care organizations;
- medication adherence
Non-adherence to prescribed medications is a serious health problem costing an estimated $100 billion per year in the United States . Despite considerable research on poor medication adherence based on retrospective electronic health records (EHR) data analyses, there are few real-world implementations of systems that provide adherence related feedback to clinicians at the point of care [ ]. While poor adherence should be addressable with point of care health information technology (IT), integrating new solutions with existing EHR systems require buy-in and customization within each organization. Such integration is made more difficult by the monolithic software design of the majority of EHR products [ ].
The software application described in this paper was designed to operate within the Substitutable Medical Apps, Reusable Technology (SMART) framework. SMART  is funded by The Office of the National Coordinator for Health Information Technology through the Strategic Health IT Advanced Research Projects (SHARP) program. The goal of the SMART project is to specify an application programming interface to enable use of substitutable applications on EHRs—essentially reimagining EHRs as smartphone-like platforms that run apps [ - ].
The goal of the MPR Monitor app is to present information to an authorized clinician in a graphical form that can be quickly reviewed to determine if additional action is required. The modular design of this app will allow alternate or additional computations with the prescription data that is obtained by the core app from the EHR, incorporation of new coefficients into the app when external data allows, or addition of new visual components to the physician view. In this way, the MPR Monitor can evolve in functionality with no changes to the EHR programming interface. Our implementation demonstrates an approach to building an application that delivers clinical decision support at the point of care using EHR data. The software design decisions discussed herein are intended to serve as an example and template for other applications that run on top of a SMART-enabled EHR.
Software Application Development
Several design decisions were made. Some are common to all Web application design, others specific to the SMART Application Program Interface (API). SMART Apps using the SMART API can be embedded within any SMART-enabled system, which is often an EHR system used by physicians, but might also be a personal health record used by patients, or a data-analytics platform such as  used by researchers. Patient data used for adherence monitoring must be marshaled by the SMART container, often an EHR, and exposed by a SMART API.
A SMART REST app may be written in any language with existing OAuth libraries. One such widely used language is Python. Since Python is a general purpose programming language with well-developed libraries for many data analysis tasks, including statistics, analytics, and graphical display, it was a versatile choice for building the MPR Monitor app. A commonly used Python framework for Web application development is Django. Although the server-side processing performed by the MPR Monitor app is relatively simple, we wanted to develop the application within a general framework like Django so that it may serve as an example for more complex app development.
The Django Web framework  uses Python as its core programming language. Other python-based Web frameworks exist, but Django is one of the most widely used in commercial applications and is capable of handling complex Web interface demands. We chose Django for the MPR Monitor because it will enable great flexibility for adding future functionality. It also enables the MPR Monitor app to be used by others as a general-purpose template for creating a wide range of new SMART apps.
Because the Django is written in Python, mathematical and statistical modules written with powerful Python libraries, as illustrated by the “embedded MPR calculation” box in, are easily integrated into the framework. Statistical algorithms can be written entirely in Python code, which can also easily wrap code written in other languages such as R and C++. In this way, analytics can be embedded directly into the app to create flexible and sophisticated EHR functionality.
We emphasize that this medication adherence app is intended to be a useful tool monitoring medication adherence that can evolve over time, while providing a general example for app developers, particularly clinical researchers who confront real-world health IT challenges and may wish to quickly assemble apps for testing new ideas. The components made for monitoring non-adherence risk discussed below can easily be modified and assembled into new apps.
The MPR Monitor implements three different non-adherence checks. Two of these, the 30-day gap check and the actual MPR < 0.8 check, are indications of a current adherence problem. These two algorithms run on all prescription drugs in the medical record, regardless of drug class. Any medication found to be currently non-adherent is flagged using a bright red warning triangle. A third check uses a logistic regression model to predict non-adherence at one year, based on prescription fill information at 60, 90, or 120 days following the first fill. The goal of the prediction is to detect a potential non-adherence problem and alert the clinician before non-adherence becomes an actuality. The logistic regression is run on all medications that pass the 30-day gap detection test, but only for medications in the three drug classes for which regression models are currently available, which include antihyperlipidemics, antihypertensives, and oral hypoglycemics. A medication for which the patient is non-adherent is flagged with a yellow warning triangle.
The origins of the MPR Monitor began with an approach to medication adherence that was based on monitoring prescription-filling behavior [, ]. Although this approach was an indirect measure of adherence to a prescribed medication regime, patients who do not fill a prescription are unlikely to be taking the medication as prescribed. Thus, fulfillment histories provide a practical approach to detecting non-adherence. In a retrospective study of dispensed medications from a large private insurance plan, Jonikas and Mandl, analyzed over 8.5 million prescriptions and described an approach that predicted adherence problems one year from the first fulfillment by analyzing the initial 2 to 4 months of fulfillment data [ ]. The primary variable predicted was the medication possession ratio (MPR), a measure of the number of days a patient possessed a prescribed medication (based on prescription fulfillment history) divided by the number of days since the first prescription fill:
MPR = (Number of fills * daily doses per fill) / (total days since first fill)
Two tests were implemented for early identification of patients at risk for non-adherence. The first was a straightforward 30-day gap check used on every medication in the patient’s record. The gap check subtracts the number of daily medication doses from the elapsed time since the first fulfillment. If the gap is greater than 30 days, an alert is triggered. We consider this a more serious issue, since non-adherence is already detected and use a red warning symbol to visually alert the clinician. An example of the red warning triangle can be seen inand .
A second test for non-adherence uses a logistic regression model with two independent input variables, the patient’s age and the MPR value at the time of the prediction, to predict a binary outcome, acceptable or poor adherence, one year after the first fulfillment. The logistic regression parameters were determined separately for three classes of drugs: antihyperlipidemics, antihypertensives, and oral hypoglycemics. These drug classes were selected because improved health outcomes for these chronic medications require consistent adherence over time [- ]. Models to predict MPR value at one year from the first prescription fill were computed at 60, 90, and 120 days from the first fill for each of the three different drug classes. The model description and coefficients were published in the free-access paper [ ], yielding publicly accessible, quantitative research results. The MPR app demonstrates a way to embed these results in a clinical decision support tool that may be interoperable with existing EHR systems. Since future predicted non-adherence might be considered less serious than actual non-adherence, a yellow warning triangle is used to visually signal this adherence problem, as illustrated in .
The second drug in, cyclobenzaprine hydrochloride, is typically used as a muscle relaxant to relieve acute skeletal muscle pain or injury. No predictive modeling was done for this class of medications, thus predicted non-adherence is not possible. Importantly, however, if the type of logistic regression coefficients derived for the three drug classes previously described [ ] becomes available for this or any other drug classes, the coefficients can easily be added to an external text file that contains this information for the app, thus extending its capability. Because the SMART app was designed to be interoperable with any SMART-enabled EHR, such an extension will not affect or require any changes to the way the app operates with these databases.
The MPR can easily be computed at every time for which medication data for a patient is available and may be used in an additional test for non-adherence. A common indication of non-adherence is when the MPR is below 0.8. Thus for any prescription medication in the EHR, if the MPR is less than 0.8 at the latest time in the record, it is considered a non-adherence indication and is flagged with a red triangle. It is no longer a predicted, future non-adherence issue, but a present condition. A graphical display of the MPR values may be selected so that a clinician can visually see when low MPR values or gaps occur throughout the prescription history. This is illustrated inand .
The MPR Monitor App
Currently, the MPR Monitor app is designed for use by a physician or health care provider to quickly review all medications in a patient record for potential non-adherence. The initial app screen shown once a patient has been chosen is presented in. All medications are listed, along with the date of first prescription fill, last fill, and a color-coded symbol that visually indicates adherence level: a green check for adherence, a red warning symbol for current non-adherence (current MPR < 0.8 or a 30-day gap), and a yellow warning symbol for predicted non-adherence if the regression model has determined that non-adherence is likely at 1 year, based on model predictions from the latest MPR available from 60, 90, or 120 days after the first fill.
If more information about the fulfillment history for a particular medication is desired, the user may click on any medication listed and a plot like that shown inwill appear. This page shows visually if a patient possesses medication based on the last fill and current date and assumes that the patient is taking the medication. After all doses have run out, if there has been no succeeding fulfillment, a gap is indicated by a break in the MPR line. The actual value of the MPR is calculated and shown for every data point. In this way, the health care provider can visualize an entire year of fulfillment history for the medication. It may also be useful to see all medication fulfillment graphs of a patient at one time. This can be requested by clicking the “All Med” button at the top of any page. Plots such as those in appear for all medications. The plots and simple adherence indicators enable health care providers to quickly see medication adherence problems for any patient. Colors, symbols, and shading were used to make visual interpretation of the plot immediate, once the caregiver becomes familiar with the app. Additional detailed information is included in text or numerical form, such as exact MPR values, fulfillment dates, and dosage.
Gaps are easily visualized as gray dropout regions. The running MPR value is shown as a bright blue line. Prescription fill events are shown as circles on the graph. Mouse-over the graph lines will reveal a pop-up display with precise day and MPR values at any point on the graph. Non-adherence predictions are not made for medications that do not belong to one of the drug classes for which the regression model was designed. However, the current adherence in the case illustrated here is poor, based on a 196-day gap. The gap check is done for all prescription medications in the medical record. The required model inputs that are automatically accessed by the app are patient age at time of first fulfillment, the MPR on the prediction day, and the prediction day, either 60, 90, or 120 days since the first fill. This information is either read directly from the EHR (patient age) or derived from information contained in the record (prescription fulfillment history).
The analytics implemented in this app are relatively simple, but illustrate an important principle of reusable technologies: new apps directed at different clinical settings and diseases can be assembled quickly by adopting components from other apps. The core SMART app, the “embedded” calculations component, and the clinician-facing displays are all designed to be reusable components.
Users may run the application remotely using the SMART development sandbox, which can be accessed at . Links to the source code repository may be found on GitHub [ ]. The software is listed as the MPR Monitor and can be found either directly on GitHub or through the SMART website listed above.
Interface Functionality and Design
Designing a Web interface requires considerable attention to the needs of the client–in this case a busy clinician who will review the medication fulfillment information for each patient. In a clinical setting, we felt that the most important information needed was a complete listing of all the medications that a patient was prescribed, together with a clear and obvious adherence status symbol for each medication. A green check mark indicated adequate adherence, while a yellow or red triangle, a universal warning symbol, signaled an adherence problem requiring attention. We chose to differentiate actual adherence problems (signified by a 30-day gap in medication or an MPR value below 0.8) and predicted adherence problems (where the MPR is greater than 0.8 but is predicted by the app to fall below 0.8 at the 1-year mark). Although the internal criteria for determining adherence or non-adherence might change in future implementations of the app as more data is incorporated into the predictive model, the meaning and use of the bright colored symbols should remain the same.
In the design of the MPR Monitor app, drug class information was read from an external file, packaged locally with the application in a simple text file. A separate text file contains the regression model coefficients together with the applicable drug class and patient age. This enables the app to be updated with new information in the future if further regression models are tested and become available. The app can thus evolve without new programming or app installation by supplying a configuration file with updated model data.
The SMART MPR Monitor app is currently installed in the SMART reference container (a skeletal EHR with the SMART application programming interface) where it can be used and tested. General information about SMART apps is available on the SMART project home page , where which users can create an account and run installed apps on the SMART reference container. Once a new account is created, users can go to the sandbox [ ], load the MPR Monitor, and run the app on sample patients provided in the sandbox.
We have developed a modular application that detects medication non-adherence, is easily maintained and upgraded as new research or data becomes available, and has sufficient generality to be used as an example for other SMART apps. The design choices were made to enable open source statistical, graphical, and decision support Python packages to be assembled in a SMART-enabled app. Software can be downloaded and modified.
The need for informatics tools that monitor non-adherence to prescriptions is representative of a more general emerging need for more sophisticated data analysis tools that can access, integrate, and find diagnostic information in a wide variety of patient data types. Physicians have always needed to be skilled at gathering diverse sources of data from examinations and tests, synthesizing the data into a diagnosis, and determining a therapeutic strategy based on current medical knowledge and the patient’s particular circumstances. However, advances in medical technology are producing enormous quantities of data that introduce new challenges to the physician for integrating all the information into clinical decision making. As EHRs are deployed widely to collect and manage medical data, and thus help to control costs, improve coordination of care, and eliminate errors, flexible integration of software applications with the EHR would extend their capabilities, and also create a broad market for apps.
In its current form, the MPR Monitor has a modular architecture that includes a clinician-facing interface, statistical routines that compute medication adherence information such as the MPR, and graphical display webpages that report information to the clinician. These can be easily modified or new modules appended to quickly assemble new apps that utilize information from any SMART-enabled EHR system with custom or reusable analytics.
Non-adherence to prescribed medications has many potential causes. Patients may not be able to afford the medications, while some may simply forget or confuse multiple drugs. Others may not understand the importance of continuing a regiment even if they feel better before the regiment ends. Regardless of the cause, the first step in solving the problem is to identify patients who are non-adherent, or those who are likely to be non-adherent before the problem arises.
The SMART API enables ready diffusion of software code and algorithms in the form of apps that can interact with any EHR that has been modified to support the SMART interoperability standard. The MPR Monitor presented illustrates how a SMART application can be implemented in practice. Because SMART apps are readily substituted, future similar apps with improved features, or better evidence-based methods can readily replace the existing versions. The community of users can then determine which apps will be adopted and which will fade away from disuse, just as the value of commercial apps is decided.
This research was supported by grants 90TR0001/01 from the Office of the National Coordinator of Health Information Technology, 5R01LM007677 from the National Library of Medicine, and William J Bosl will be affiliated with the Department of Healthcare Informatics at the University of San Francisco starting August 2013.
Conflicts of Interest
- Bosworth HB, Granger BB, Mendys P, Brindis R, Burkholder R, Czajkowski SM, et al. Medication adherence: a call for action. Am Heart J 2011 Sep;162(3):412-424. [CrossRef] [Medline]
- Middleton B. The clinical decision support consortium. Stud Health Technol Inform 2009;150:26-30. [Medline]
- Mandl KD, Kohane IS. Escaping the EHR trap--the future of health IT. N Engl J Med 2012 Jun 14;366(24):2240-2242. [CrossRef] [Medline]
- Mandl KD. SMART. URL: http://smartplatforms.org/ [accessed 2012-12-06] [WebCite Cache]
- Mandl KD, Kohane IS. No small change for the health information economy. N Engl J Med 2009 Mar 26;360(13):1278-1281. [CrossRef] [Medline]
- Mandl KD, Mandel JC, Murphy SN, Bernstam EV, Ramoni RL, Kreda DA, et al. The SMART Platform: early experience enabling substitutable applications for electronic health records. J Am Med Inform Assoc 2012;19(4):597-603 [FREE Full text] [CrossRef] [Medline]
- Jonikas MA, Mandl KD. Surveillance of medication use: early identification of poor adherence. J Am Med Inform Assoc 2012;19(4):649-654 [FREE Full text] [CrossRef] [Medline]
- Mandl, DK. SMART. URL: http://sandbox.smartplatforms.org/login [accessed 2012-12-06] [WebCite Cache]
- Murphy SN, Weber G, Mendis M, Gainer V, Chueh HC, Churchill S, et al. Serving the enterprise and beyond with informatics for integrating biology and the bedside (i2b2). J Am Med Inform Assoc 2010;17(2):124-130 [FREE Full text] [CrossRef] [Medline]
- Alchin M. Pro Django. In: Pro Django (Pro). New York City, NY, USA: Apress; Dec 17, 2009.
- Balkrishnan R. The importance of medication adherence in improving chronic-disease related outcomes: what we know and what we need to further know. Med Care 2005 Jun;43(6):517-520. [Medline]
- Siegel D, Lopez J, Meier J. Antihypertensive medication adherence in the Department of Veterans Affairs. Am J Med 2007 Jan;120(1):26-32. [CrossRef] [Medline]
- Choudhry NK, Fischer MA, Avorn J, Liberman JN, Schneeweiss S, Pakes J, et al. The implications of therapeutic complexity on adherence to cardiovascular medications. Arch Intern Med 2011 May 9;171(9):814-822. [Medline]
- Krousel-Wood M, Thomas S, Muntner P, Morisky D. Medication adherence: a key factor in achieving blood pressure control and good clinical outcomes in hypertensive patients. Curr Opin Cardiol 2004 Jul;19(4):357-362. [Medline]
- Ho PM, Spertus JA, Masoudi FA, Reid KJ, Peterson ED, Magid DJ, et al. Impact of medication therapy discontinuation on mortality after myocardial infarction. Arch Intern Med 2006 Sep 25;166(17):1842-1847. [CrossRef] [Medline]
- Ho PM, Rumsfeld JS, Masoudi FA, McClure DL, Plomondon ME, Steiner JF, et al. Effect of medication nonadherence on hospitalization and mortality among patients with diabetes mellitus. Arch Intern Med 2006 Sep 25;166(17):1836-1841. [CrossRef] [Medline]
- Mandl, DK. SMART sample apps. URL: https://github.com/chb/smart_sample_apps [accessed 2012-12-06] [WebCite Cache]
|API: application program interface|
|EHR: electronic health record.|
|IT: information technology|
|MPR: Medication Possession Ratio|
|SHARP: Strategic Health IT Advanced Research Projects|
|SMART: Substitutable Medical Apps, Reusable Technology|
Edited by G Eysenbach; submitted 13.12.12; peer-reviewed by J Klann, J Herskovic; comments to author 08.03.13; revised version received 03.06.13; accepted 18.06.13; published 22.07.13
©William Bosl, Joshua Mandel, Magdalena Jonikas, Rachel Badovinac Ramoni, Isaac S Kohane, Kenneth D Mandl. Originally published in the Interactive Journal of Medical Research (http://www.i-jmr.org/), 22.07.2013.
This is an open-access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work, first published in the Interactive Journal of Medical Research, is properly cited. The complete bibliographic information, a link to the original publication on http://www.i-jmr.org/, as well as this copyright and license information must be included.