Abstract
Background
Studies are exploring ways to improve medication adherence, with sentiment analysis (SA) being an underutilized innovation in pharmacy. This technique uses artificial intelligence (AI) and natural language processing to assess text for underlying feelings and emotions.
Aim
This study aimed to evaluate the use of two SA models, Valence Aware Dictionary for Sentiment Reasoning (VADER) and Emotion English DistilRoBERTa-base (DistilRoBERTa), for the identification of patients’ sentiments and emotions towards their pharmacotherapy.
Method
A dataset containing 320,095 anonymized patients’ reports of experiences with their medication was used. VADER assessed sentiment polarity on a scale from − 1 (negative) to + 1 (positive). DistilRoBERTa classified emotions into seven categories: anger, disgust, fear, joy, neutral, sadness, and surprise. Performance metrics for the models were obtained using the sklearn.metrics module of scikit-learn in Python.
Results
VADER demonstrated an overall accuracy of 0.70. For negative sentiments, it achieved a precision of 0.68, recall of 0.80, and an F1-score of 0.73, while for positive sentiments, it had a precision of 0.73, recall of 0.59, and an F1-score of 0.65. The AUC for the ROC curve was 0.90. DistilRoBERTa analysis showed that higher ratings for medication effectiveness, ease of use, and satisfaction corresponded with more positive emotional responses. These results were consistent with VADER’s sentiment analysis, confirming the reliability of both models.
Conclusion
VADER and DistilRoBERTa effectively analyzed patients’ sentiments towards pharmacotherapy, providing valuable information. These findings encourage studies of SA in clinical pharmacy practice, paving the way for more personalized and effective patient care strategies.






Similar content being viewed by others
References
Kengne AP, Brière JB, Zhu L, et al. Impact of poor medication adherence on clinical outcomes and health resource utilization in patients with hypertension and/or dyslipidemia: systematic review. Expert Rev Pharmacoecon Outcomes Res. 2024;24(1):143–54. https://doi.org/10.1080/14737167.2023.2266135.
Cutler RL, Fernandez-Llimos F, Frommer M, et al. Economic impact of medication non-adherence by disease groups: a systematic review. BMJ Open. 2018;8(1):e016982. https://doi.org/10.1136/bmjopen-2017-016982.
Simpson SH, Eurich DT, Majumdar SR, et al. A meta-analysis of the association between adherence to drug therapy and mortality. BMJ. 2006;333(7557):15. https://doi.org/10.1136/bmj.38875.675486.55.
McQuaid EL, Landier W. Cultural issues in medication adherence: disparities and directions. J Gen Intern Med. 2018;33(2):200–6. https://doi.org/10.1007/s11606-017-4199-3.
Brown MT, Bussell J, Dutta S, et al. Medication adherence: truth and consequences. Am J Med Sci. 2016;351(4):387–99. https://doi.org/10.1016/j.amjms.2016.01.010.
Studer CM, Linder M, Pazzagli L. A global systematic overview of socioeconomic factors associated with antidiabetic medication adherence in individuals with type 2 diabetes. J Health Popul Nutr. 2023;42(1):122. https://doi.org/10.1186/s41043-023-00459-2.
Hamama-Raz Y, Frishberg Y, Ben-Ezra M, et al. The interrelations of family relationship, illness cognition of helplessness and perceived barriers to medication adherence: a study of adolescent and emerging adult kidney recipients and their parents. Adolesc Health Med Ther. 2023;14:205–15. https://doi.org/10.2147/AHMT.S423355.
Wilder ME, Kulie P, Jensen C, et al. The impact of social determinants of health on medication adherence: a systematic review and meta-analysis. J Gen Intern Med. 2021;36(5):1359–70. https://doi.org/10.1007/s11606-020-06447-0.
Gellad WF, Grenard JL, Marcum ZA. A systematic review of barriers to medication adherence in the elderly: looking beyond cost and regimen complexity. Am J Geriatric Pharmacotherapy. 2011;9(1):11–23. https://doi.org/10.1016/j.amjopharm.2011.02.004.
Lee SQ, Raamkumar AS, Li J, et al. Reasons for primary medication nonadherence: a systematic review and metric analysis. J Manag Care Spec Pharm. 2018;24(8):778–94. https://doi.org/10.18553/jmcp.2018.24.8.778.
Khoiry QA, Alfian SD, van Boven JFM, et al. Self-reported medication adherence instruments and their applicability in low-middle income countries: a scoping review. Front Public Health. 2023;11:1–13. https://doi.org/10.3389/fpubh.2023.1104510.
Conn VS, Ruppar TM. Medication adherence outcomes of 771 intervention trials: systematic review and meta-analysis. Prev Med (Baltim). 2017;99:269–76. https://doi.org/10.1016/j.ypmed.2017.03.008.
Cabral AC, Lavrador M, Castel-Branco M, et al. Development and validation of a medication adherence universal questionnaire: the MAUQ. Int J Clin Pharm. 2023;45(4):999–1006. https://doi.org/10.1007/s11096-023-01612-x.
Horne R, Weinman J, Hankins M. The beliefs about medicines questionnaire: the development and evaluation of a new method for assessing the cognitive representation of medication. Psychol Health. 1999;14(1):1–24. https://doi.org/10.1080/08870449908407311.
Rafhi E, Al-Juhaishi M, Stupans I, et al. The influence of patients’ beliefs about medicines and the relationship with suboptimal medicine use in community-dwelling older adults: a systematic review of quantitative studies. Int J Clin Pharm. 2024;46(4):811–30. https://doi.org/10.1007/s11096-024-01727-9.
Niriayo YL, Mamo A, Gidey K, et al. Medication belief and adherence among patients with Epilepsy. Behav Neurol. 2019;2019:1–7. https://doi.org/10.1155/2019/2806341.
Yildirim D, Çiriş Yildiz C, Ergin E, et al. Hypoglycaemia fear, treatment adherence, and the quality of life in patients with type 2 diabetes and its determinants. Int J Nurs Pract. 2024;30:e13248. https://doi.org/10.1111/ijn.13248.
Seah THS, Almahmoud S, Coifman KG. Feel to heal: negative emotion differentiation promotes medication adherence in multiple sclerosis. Front Psychol. 2022;12:1–8. https://doi.org/10.3389/fpsyg.2021.687497.
Kretchy IA, Appiah B, Agyabeng K, et al. Psychotropic medicine beliefs, side effects and adherence in schizophrenia: a patient–caregiver dyad perspective. Int J Clin Pharm. 2021;43(5):1370–80. https://doi.org/10.1007/s11096-021-01264-9.
Intilangelo A, Majic S, Palchik V, et al. Validated questionnaires on medication adherence and associated factors in chronic patients: a systematic review. Farm Hosp. 2024;48(4):T185–92. https://doi.org/10.1016/j.farma.2024.04.019.
Colón-Ruiz C, Segura-Bedmar I. Comparing deep learning architectures for sentiment analysis on drug reviews. J Biomed Inf. 2020;110:103539. https://doi.org/10.1016/j.jbi.2020.103539.
Devika MD, Sunitha C, Ganesh A. Sentiment analysis: a comparative study on different approaches. Procedia Comput Sci. 2016;87:44–9. https://doi.org/10.1016/j.procs.2016.05.124.
Nadkarni PM, Ohno-Machado L, Chapman WW. Natural language processing: an introduction. J Am Med Inform Assoc. 2011;18(5):544–51. https://doi.org/10.1136/amiajnl-2011-000464.
Cambria E, Das D, Bandyopadhyay S, et al., editors. A practical guide to sentiment analysis, vol. 5. Cham: Springer International Publishing; 2017. ISBN 978-3319553924. https://doi.org/10.1007/978-3-319-55394-8.
Kumar A, Sebastian TM. Sentiment analysis: a perspective on its past, present and future. Int J Intell Syst Appl. 2012;4(10):1–14. https://doi.org/10.5815/ijisa.2012.10.01.
Liddy ED. Natural language processing. In: Encyclopedia of library and information science. 2nd ed. New York: Marcel Decker, Inc; 2001. https://surface.syr.edu/istpub/63/.
Medhat W, Hassan A, Korashy H. Sentiment analysis algorithms and applications: a survey. Ain Shams Eng J. 2014;5(4):1093–113. https://doi.org/10.1016/j.asej.2014.04.011.
Ali LR, Shaker BN, Jebur SA. An extensive study of sentiment analysis techniques: a survey. AIP Conf. Proc. 2023;2591(1):030022. https://doi.org/10.1063/5.0119604
Alamoodi AH, Zaidan BB, Al-Masawa M, et al. Multi-perspectives systematic review on the applications of sentiment analysis for vaccine hesitancy. Comput Biol Med. 2021;139:104957. https://doi.org/10.1016/j.compbiomed.2021.104957.
Alamoodi AH, Zaidan BB, Zaidan AA, et al. Sentiment analysis and its applications in fighting COVID-19 and infectious diseases: a systematic review. Expert Syst Appl. 2021;167:114155. https://doi.org/10.1016/j.eswa.2020.114155.
Rani S, Jain A. Optimizing healthcare system by amalgamation of text processing and deep learning: a systematic review. Multimed Tools Appl. 2024;83(1):279–303. https://doi.org/10.1007/s11042-023-15539-y.
Zunic A, Corcoran P, Spasic I. Sentiment analysis in health and well-being: systematic review. JMIR Med Inf. 2020;8(1):e16023. https://doi.org/10.2196/16023.
Hoti K, Weidmann AE. Encouraging dissemination of research on the use of artificial intelligence and related innovative technologies in clinical pharmacy practice and education: call for papers. Int J Clin Pharm. 2024;46(4):777–9. https://doi.org/10.1007/s11096-024-01777-z.
Harode R. WebMD drug reviews dataset. Kaggle. March 2020. 7 Nov 2023. https://www.kaggle.com/datasets/rohanharode07/webmd-drug-reviews-dataset
WebMD, Drugs, Medications A-Z. Your trusted source of information for prescription drugs and medications. 2024. 4 Aug 2024. https://www.webmd.com/drugs/2/index
Bottacin WE, Luquetta A, Gomes Júnior LC, et al. Sentiment analysis in medication adherence: validation code. Zenodo. https://doi.org/10.5281/zenodo.11211419
The pandas development team. pandas-dev/pandas: Pandas. Published online 2023. https://doi.org/10.5281/zenodo.10426137
McKinney W. Data structures for statistical computing in Python. In: Proc. of the 9th Python in Science Conf. (SciPy 2010). 2010;56–61.
Hutto C, Gilbert E. VADER: a parsimonious rule-based model for sentiment analysis of social media text. Proc Int AAAI Conf Web Social Media. 2014;8(1):216–25. https://doi.org/10.1609/icwsm.v8i1.14550.
Hutto CJ, Gilbert E. VADER: a parsimonious rule-based model for sentiment analysis of social media Text.; 2014. http://sentic.net/. Accessed 15 Feb 2024.
Hartmann J. Emotion english DistilRoBERTa-base. 2022. https://huggingface.co/j-hartmann/emotion-english-distilroberta-base/. . Accessed 10 Dec 2023.
Hutto CJ. Valence aware dictionary and sentiment reasoner (VADER) github repository. GitHub. November 17, 2014. https://github.com/cjhutto/vaderSentiment. Accessed 7 Nov 2023.
Samaras L, García-Barriocanal E, Sicilia MA. Sentiment analysis of COVID-19 cases in Greece using Twitter data. Expert Syst Appl. 2023;230:120577. https://doi.org/10.1016/j.eswa.2023.120577.
Roe C, Lowe M, Williams B, et al. Public perception of SARS-CoV-2 vaccinations on social media: questionnaire and sentiment analysis. Int J Environ Res Public Health. 2021;18(24):13028. https://doi.org/10.3390/ijerph182413028.
Rajkhowa P, Dsouza VS, Kharel R, et al. Factors influencing Monkeypox vaccination: a cue to policy implementation. J Epidemiol Glob Health. 2023;13(2):226–38. https://doi.org/10.1007/s44197-023-00100-9.
Marques T, Cezário S, Lacerda J, et al. Sentiment analysis in understanding the potential of online news in the public health crisis response. Int J Environ Res Public Health. 2022;19(24):16801. https://doi.org/10.3390/ijerph192416801.
Dsouza VS, Rajkhowa P, Mallya BR, et al. A sentiment and content analysis of tweets on monkeypox stigma among the LGBTQ + community: a cue to risk communication plan. Dialog Health. 2023;2:1–8. https://doi.org/10.1016/j.dialog.2022.100095.
Devgan LL, Klein EJ, Fox S, et al. Bifurcation of Patient Reviews: An analysis of trends in online ratings. Plast Reconstr Surg Glob Open. 2020;8:e2781. https://doi.org/10.1097/GOX.0000000000002781.
Liu Y, Ott M, Goyal N et al. RoBERTa: a robustly optimized BERT pretraining approach. Published Online 26 Jul 2019. http://arxiv.org/abs/1907.11692
White BM, Melton C, Zareie P, et al. Exploring celebrity influence on public attitude towards the COVID-19 pandemic: social media shared sentiment analysis. BMJ Health Care Inf. 2023;30:e100665. https://doi.org/10.1136/bmjhci-2022-100665.
Melton CA, White BM, Davis RL, et al. Fine-tuned sentiment analysis of COVID-19 vaccine-related social media data: comparative study. J Med Internet Res. 2022;24(10):e40408. https://doi.org/10.2196/40408.
scikit-learn machine learning in Python. sklearn.metrics. 2024. https://scikit-learn.org/stable/index.html. Accessed 6 Aug 2024.
Pedregosa F, Varoquaux Gaël, Gramfort A, et al. Scikit-learn: machine learning in Python. J Mach Learn Res. 2011;12:2825–30.
Likert R. A technique for the measurement of attitudes. Archives Psychol. 1932;22(140):5–55.
Hart KL, Perlis RH, McCoy TH. What do patients learn about psychotropic medications on the web? A natural language processing study. J Affect Disord. 2020;260:366–71. https://doi.org/10.1016/j.jad.2019.09.043.
Noh Y, Kim M, Hong SH. Identification of emotional spectrums of patients taking an erectile dysfunction medication: ontology-based emotion analysis of patient medication reviews on social media. J Med Internet Res. 2023;25:e50152. https://doi.org/10.2196/50152.
Sharma S, Sharma CR, Sharma S, et al. Adherence to antihypertensive medication and its associated factors among patients with hypertension attending a tertiary hospital in Kathmandu, Nepal. PLoS ONE. 2024;19(7):e0305941. https://doi.org/10.1371/journal.pone.0305941.
Ni YX, Liu LL, Feng H, et al. Adherence, belief, and knowledge about oral anticoagulants in patients with bioprosthetic heart valve replacement: a cross-sectional study. Front Pharmacol. 2023;14:1–9. https://doi.org/10.3389/fphar.2023.1191006.
Hall SF, Edmonds SW, Lou Y, et al. Patient-reported reasons for nonadherence to recommended osteoporosis pharmacotherapy. J Am Pharmacists Association. 2017;57(4):503–9. https://doi.org/10.1016/j.japh.2017.05.003.
Alfadda AA, Youssef AM, Al-Sofiani ME, et al. Medication adherence and treatment satisfaction with lipid-lowering drugs among patients with diabetes and dyslipidemia. Ann Pharmacother. 2024;25. https://doi.org/10.1177/10600280241262513.
Al Haqimy Mohammad Yunus MA, Akkawi ME, Fata Nahas AR. Investigating the association between medication regimen complexity, medication adherence and treatment satisfaction among Malaysian older adult patients: a cross-sectional study. BMC Geriatr. 2024;24(1):447. https://doi.org/10.1186/s12877-024-05016-y.
Temeloglu Sen E, Sertel Berk HO, Rezvani A. Serial mediation of illness perception and beliefs about medicines in the relationship between patient satisfaction and medication adherence: an evaluation of self-regulatory model in rheumatoid arthritis and ankylosing spondylitis patients. J Health Psychol. 2024;29(8):836–47. https://doi.org/10.1177/13591053231213306.
AlOmari F, Hamid A. Strategies to improve patient loyalty and medication adherence in Syrian healthcare setting: the mediating role of patient satisfaction. PLoS ONE. 2022;17(11):e0272057. https://doi.org/10.1371/journal.pone.0272057.
Matrisch L, Graßhoff H, Müller A, et al. Therapy satisfaction and health literacy are key factors to improve medication adherence in systemic sclerosis. Scand J Rheumatol. 2023;52(4):395–402. https://doi.org/10.1080/03009742.2022.2111771.
Kassaw AT, Sendekie AK, Minyihun A, et al. Medication regimen complexity and its impact on medication adherence in patients with multimorbidity at a comprehensive specialized hospital in Ethiopia. Front Med (Lausanne). 2024;11:1–11. https://doi.org/10.3389/fmed.2024.1369569.
Belachew EA, Netere AK, Sendekie AK. Medication regimen complexity and its impact on medication adherence and asthma control among patients with asthma in Ethiopian referral hospitals. Asthma Res Pract. 2022;8(1):7. https://doi.org/10.1186/s40733-022-00089-1.
Wakai E, Ikemura K, Kato C, et al. Effect of number of medications and complexity of regimens on medication adherence and blood pressure management in hospitalized patients with hypertension. PLoS ONE. 2021;16(6):e0252944. https://doi.org/10.1371/journal.pone.0252944.
Ayele AA, Tegegn HG, Ayele TA, et al. Medication regimen complexity and its impact on medication adherence and glycemic control among patients with type 2 diabetes mellitus in an Ethiopian general hospital. BMJ Open Diabetes Res Care. 2019;7(1):e000685. https://doi.org/10.1136/bmjdrc-2019-000685.
Jørgensen BB, Gregersen M, Pallesen SH, et al. Computer habits and digital literacy in geriatric patients: a survey. Digit Health. 2023;9:1–12. https://doi.org/10.1177/20552076231191004.
Boriani G, Maisano A, Bonini N, et al. Digital literacy as a potential barrier to implementation of cardiology tele-visits after COVID-19 pandemic: the INFO-COVID survey. J Geriatr Cardiol. 2021;18(9):739–47. https://doi.org/10.11909/j.issn.1671-5411.2021.09.003.
Acknowledgements
Throughout the development of this manuscript, the authors exclusively utilized ChatGPT (OpenAI) for the purpose of enhancing the quality of translations from Brazilian Portuguese to English. After using this tool/service, the authors reviewed and edited the content as needed and take full responsibility for the content of the publication.
Funding
This research received no funding.
Author information
Authors and Affiliations
Corresponding author
Ethics declarations
Conflicts of interest
The authors report no conflicts of interest in this work.
Additional information
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Bottacin, W.E., Luquetta, A., Gomes-Jr, L. et al. Sentiment analysis in medication adherence: using ruled-based and artificial intelligence-driven algorithms to understand patient medication experiences. Int J Clin Pharm (2024). https://doi.org/10.1007/s11096-024-01803-0
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s11096-024-01803-0