Digital Assistant for Pharmacists Using Indonesian Language Based on Rules and Artificial Intelligence

Document Type : Original Article


1 Department of Electrical Engineering, Universitas Islam Indonesia, Yogyakarta, Indonesia

2 Department of Informatics, Universitas Islam Indonesia, Yogyakarta, Indonesia

3 Faculty of Pharmacy, Universitas Ahmad Dahlan, Yogyakarta, Indonesia

4 Faculty of Pharmacy, Universitas Islam Indonesia, Yogyakarta, Indonesia


The widespread availability of large language models (LLMs) has encouraged many individuals to explore chatbot development for their business needs. However, creating chatbots for handling sensitive information, like in healthcare, can be challenging. Mistakes made by these bots when extracting information or providing health recommendations can have serious consequences. When developing a chatbot for pharmacy recommendations, it is essential for the bot to effectively extract symptom-related information and other relevant patient data and then offer recommendations for actions or medications based on that information. In this study, we proposed a straightforward and effective approach that combines regular expression templates for information extraction with forward chaining for inference to create a pharmacy recommendation chatbot called SmartFarma. In scenarios like pharmacy recommendations, we will demonstrate that the use of regular expression templates is sufficient and produces better results than some machine learning methods. Additionally, by using regular expressions, SmartFarma can be developed with transparent data handling, allowing experts to trace, monitor, and evaluate its recommendations. This research primarily focuses on the extraction of patient information. Our model, as proposed, achieved an impressive score of 81.54%, outperforming both the Biomedical Bidirectional Encoder Representations from Transformers (BERT) and Generative Pre-Trained Transformer (GPT) models.

Graphical Abstract

Digital Assistant for Pharmacists Using Indonesian Language Based on Rules and Artificial Intelligence


Main Subjects

  1. Følstad A, Brandtzaeg PB, Feltwell T, Law EL, Tscheligi M, Luger EA, editors. SIG: chatbots for social good. Extended Abstracts of the 2018 CHI Conference on Human Factors in Computing Systems; 2018.
  2. Shedthi B S, Shetty V, Chadaga R, Bhat R, Preethi B, Kini K P. Implementation of Chatbot that Predicts an Illness Dynamically using Machine Learning Techniques. International Journal of Engineering, Transactions B: Applications. 2024;37(2):312-22.
  3. Mulyana S, Hartati, S., Wardoyo, R., Subandi. Utilizing natural language processing in case-based reasoning for diagnosing and managing schizophrenia disorder. ICIC Express Letters. 2021;15(10):1083-91.
  4. Dietrich G, Krebs J, Fette G, Ertl M, Kaspar M, Störk S, et al. Ad hoc information extraction for clinical data warehouses. Methods of information in medicine. 2018;57(S 01):e22-e9.
  5. Liang B, Li H, Su M, Bian P, Li X, Shi W. Deep text classification can be fooled. arXiv preprint arXiv:170408006. 2017.
  6. Nguyen A, Yosinski J, Clune J, editors. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. Proceedings of the IEEE conference on computer vision and pattern recognition; 2015.
  7. Devlin J, Chang M-W, Lee K, Toutanova K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:181004805. 2018.
  8. Cui M, Bai R, Lu Z, Li X, Aickelin U, Ge P. Regular expression based medical text classification using constructive heuristic approach. IEEE Access. 2019;7:147892-904.
  9. Farhoodi M, Toloie Eshlaghy A, Motadel M. A Proposed Model for Persian Stance Detection on Social Media. International Journal of Engineering, Transactions C: Aspects. 2023;36(6):1048-59.
  10. Berardi RR, Ferreri SP, Hume AL, Kroon LA, Newton GD, Popovich NG, et al. Handbook of nonprescription drugs: an interactive approach to self-care: American Pharmaceutical Association; 2004.
  11. Vaswani A, Shazeer N, Parmar N, Uszkoreit J, Jones L, Gomez AN, et al. Attention is all you need. Advances in neural information processing systems. 2017;30.
  12. Farhoodi M, Toloie Eshlaghy A, Motadel M. A Proposed Model for Persian Stance Detection on Social Media. International Journal of Engineering, Transactions C: Aspects 2023;36(6):1048-59.
  13. Minaee S, Kalchbrenner N, Cambria E, Nikzad N, Chenaghlu M, Gao J. Deep learning--based text classification: a comprehensive review. ACM computing surveys (CSUR). 2021;54(3):1-40.
  14. Hakala K, Pyysalo S, editors. Biomedical named entity recognition with multilingual BERT. Proceedings of the 5th workshop on BioNLP open shared tasks; 2019.
  15. Liu Y, Ott M, Goyal N, Du J, Joshi M, Chen D, et al. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:190711692. 2019.
  16. Sanh V, Debut L, Chaumond J, Wolf T. DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter. arXiv preprint arXiv:191001108. 2019.
  17. Lee J, Yoon W, Kim S, Kim D, Kim S, So CH, et al. BioBERT: a pre-trained biomedical language representation model for biomedical text mining. Bioinformatics. 2020;36(4):1234-40.
  18. Huang K, Altosaar J, Ranganath R. Clinicalbert: Modeling clinical notes and predicting hospital readmission. arXiv preprint arXiv:190405342. 2019.
  19. Raza S, Reji DJ, Shajan F, Bashir SR. Large-scale application of named entity recognition to biomedicine and epidemiology. PLOS Digital Health. 2022;1(12):e0000152.
  20. Ma MD, Taylor AK, Wang W, Peng N. DICE: Data-efficient clinical event extraction with generative models. arXiv preprint arXiv:220807989. 2022.
  21. Saghehei E, Memariani A, Bozorgi-Amiri A. A Bi-level programming approach for pre-positioning emergency warehouses. International Journal of Engineering, Transactions A: Basics. 2021;34(1):128-39.
  22. Brown T, Mann B, Ryder N, Subbiah M, Kaplan JD, Dhariwal P, et al. Language models are few-shot learners. Advances in neural information processing systems. 2020;33:1877-901.
  23. Gusman A, Hendri H, editors. Expert system to diagnose child development growth disorders with forward chaining method. Journal of Physics: Conference Series; 2019: IOP Publishing.
  24. Munaiseche C, Kaparang D, Rompas PTD, editors. An Expert system for diagnosing eye diseases using forward chaining method. IOP Conference Series: Materials Science and Engineering; 2018: IOP Publishing.