1. Introduction
Medication wastage can be reduced, resulting in more cost-effective spending, which the Ministry of Health wants to achieve in line with Saudi Arabia’s 2030 economic reform program [
1]. The United States Food and Drug Administration (FDA) updated the medicines’ disposal instructions. The “misuse” of prescription drugs is one of the behaviors that are on the rise in the United States [
2]. Consequently, there is considerable pharmaceutical waste but there are no accurate and current statistics available. The waste of these drugs has caused biological and ethical problems that should be understood from different perspectives. Alnahas et al. [
3] demonstrated that the German Federal Ministry for the Environment has made it clear that pharmaceutical organizations in both the industrialized and developing world offer a variety of synthetic chemicals at a rate of 100,000 tons per year. From this, a small fraction is used while a larger fraction will be unused and/or expired resulting in a large value of pharmaceutical waste. The authors also reported a cross-sectional study in 2001 that estimated more than 1 billion unused drugs produced each year by the American population alone. Moreover, the presence of small amounts of active pharmaceutical ingredients in the soil and waterways could impact the environment. These small amounts of effective drugs enter the food chain, where they may develop again and thus unintentionally return to humans who recently discarded them.
Medication loss is important, as many developing countries have severe shortages of drugs such as antibiotics. In this way, it would be wise to divert expired and unused medicines to the developing world, consequently maintaining a strategic distance from waste on the one hand and shortages on the other. It has also become extremely important to raise awareness of how to correctly dispose of expired medicines and what can be done with unused medicines.
In this research, three areas have been reviewed: medical, technical, and related applications.
Firstly, several studies in medical reviews have discussed the issue of improper management of medication disposal. For example, Abuassonon et al. [
4] analyzed practices of residents of Jeddah concerning the disposal of unused or expired medications and their views on the take-back centers for drugs. The analysis of this study showed that a low percentage of residents of Jeddah know how to properly dispose of medications in the correct way. Wajid et al. [
5] also focused on determining the prevalence and practice of unused and expired drugs among Saudi adults. The study was conducted over a period of four months among residents of the Riyadh region in the Kingdom of Saudi Arabia. Through this study, it became clear that there was a large spread of unused medicines among the community and that the practice of disposing of them was moderate in Saudi society. Therefore, the Ministry of Health should collaborate in a national initiative to educate people about acceptable disposal methods, which can lead us to use technology to help in residents’ education and protect the environment.
Secondly, the technical review covered the expert system, chatbot, and classification and the benefits of using these technologies in pharmacies. Sagdoldanova and Atymtayeva [
6] discussed a system for storing and retrieving medication data using a website that allows searching for medicines by price or type. The idea of using the expert system is that the user (pharmacist) selects one disease from the list, then the system analyses all the drug recommendations and selects one suitable drug. The system shows other drugs that have the same number of symptoms and contraindications (sub drugs) as basic drugs. It has also a user interface for drug consumers, where they do not need to be pharmacists or have knowledge about medication. In addition, the expert system has an inference engine which is a mechanism that can manage the expert systems and decide if the problem has reached an acceptable solution or not. A knowledge base can also be used to obtain the guideline for proper management of disposing of medications. Researchers also found how useful chatbots are in the clinical and health field and there are several similar chatbot systems that served in the health field. Comendador et al. [
7] developed a pharmabot, which is a pediatric generic medicine consultant chatbot. It gives the appropriate medication to pediatric patients after a series of conversations with the system. The chatbot prescribes generic medicines including the proper intake, dosage, drug reaction, precaution, and an indication of medicines. Moreover, classification using artificial intelligence techniques has been used on drug recovery processes to see if harmful drugs can be distinguished from harmless drugs by visual features only. In the United States, there are several improper ways to dispose of excess medicines such as storing them in medicine cabinets, deposing them in the toilet, or putting them in the regular garbage. These methods can negatively affect the environment and public health [
8]. Therefore, a drug retrieval program has been established, which is sponsored by specific bodies such as the Narcotics Control Department. Almost every police station and pharmacy in the country has a drug recovery device that uses artificial intelligence techniques to classify medicines.
Finally, a number of software programs have been developed to manage medicine disposal; for example, the Preservation of Grace Association [
9]. One of the aims of the Grace Preservation Society is to collect and reuse medication. Although this project achieves great benefits and helps the community, it takes time and effort and requires a lot of volunteers to work faster. The technology was not used by the association to facilitate work and achieve its benefits. The other software is “Medicine Charity Association” [
10]. Many services are provided on the “Dwaa” website, including providing medication to the needy, by purchasing medicines from donated amounts and delivering them to the needy. The Saudi Food and Drugs Authority website has instructions for medicine disposal to reduce damage and environmental pollution [
11]. In addition, the “Tameeni” application can be used to search for registered drugs and their details such as the method of use and storage legal status (prescription medications or non-prescription medications). The Saudi Food and Drugs Authority also provides a chatbot with a WhatsApp application named “the smart help Sara”. This chatbot can help the patient to know the price of a medicine or give an alternative medicine. However, the applications do not connect with smart devices or automated classification.
Most households in all societies are overcrowded with medicines in cupboards and fridges; some are expired, and others are usable but not used or needed. Depending on this overcrowding, most people dispose of medication incorrectly. Some of them pour liquid medicines into bathtubs or toilets, causing pollution to the environment and the interaction of chemicals with the environment, this could result in new diseases that negatively affect society. In addition, most people dispose of medicines by throwing them in garbage containers, which increases the risk of chemicals when exposed to the sun or harming feeding animals. In economic terms, this waste of medicines results in a massive loss of financial resources that the state expends to provide treatment. In Saudi Arabia, there are no take-back medicine programs, and there is no published research on how medications are disposed of or wasted. On the other hand, some people need treatment and medicine but do not have enough money to buy them or cannot obtain them. For these reasons, a technical solution would help bridge all these problems and address them through the implementation of a website and device.
The aim of this research is to use the power of artificial intelligence to assist in the proper management and disposal of expired and unused medications and to develop a prototype device for collecting medications by automatically classifying medications for proper disposal and donation. To achieve this aim, there are four sub-objectives: (i) collect medication information to create a knowledge base, (ii) develop a web-based expert system to educate consumers about proper medication disposal practices, (iii) develop a chatbot to interact with consumers, and (iv) develop a prototype device for collecting medication by automatically classifying medications for proper disposal and donation.
2. Materials and Methods
There are two appropriate options for the safe disposal of medicines. The best way to dispose of old, unused, or unwanted medicines is through what is known as a take-back medicine program, which is a system developed by developed countries that allows disposing of medicines by taking them to points designated for drug retrieval, such as pharmacies or centers dedicated to this and destroying them [
12]. The second option is to dispose of medication at home. If you cannot reach one of these disposal points, you can follow some simple steps to dispose of most medicines at home. However, consumers should be aware of these steps. Therefore, this project proposes a solution to protect the environment and reduce this phenomenon, and the proposed solution system is divided into two parts (software and hardware). Firstly, the software includes a web-based expert system (knowledge base and inference engine), information management system (IMS) (database), chatbot, and classification model. Secondly, the hardware device is integrated with the first part. The classification model controls the hardware device to automatically open an accurate place for disposing of the medication based on the medication details.
2.1. Web-Based Expert System
In artificial intelligence, expert systems are computer systems developed to emulate the decision-making ability of a human expert and solve complex problems in a particular domain. An expert system with web development technology can generate web-based expert systems [
13]. An expert system that is web-based requires an awareness of the fundamental concepts of system development and web engineering principles. The following framework is the result of combining the expertise found in these two fields. Firstly, knowledge engineers begin collecting knowledge to fulfill the needs of the web-based expert system in terms of medication disposal and donation. A knowledge base is constructed after knowledge acquisition, representation, and verification. In this study, the knowledge is collected from documentation published by the Saudi Food and Drug Authority and World Health Organization.
Pharmacists are medication professionals responsible for the preparation of different forms of medication, such as tablets, pills, capsules, and sterile solutions for injection. They use their extensive knowledge of drugs to help patients in the healing process. Medicines refer to any product that contains one or more substances for use in the treatment and prevention of human diseases [
14]. Medications sold in pharmacies can be divided into two categories: prescription medications: that require a prescription to be sold; and nonprescription over-the-counter (OTC) medications: that do not require a prescription from a doctor. Whether the medicine is by prescription or non-prescription, the wrong method of disposal has significant side effects on the community and environment. Many medications come in several different forms. The most common forms of medications used are demonstrated in
Table 1.
There are two main documents that were used in this study. The Saudi Food and Drug Authority [
15] is a public document that discusses policy and instructions for donation. This document also contains important information about the donation process (see
Supplementary Section S1). The document demonstrates those who can donate medications such as a manufacturer or supplier of drugs, governmental entities, private pharmacies, private hospitals, individuals (the donor, by purchasing medicines from their main source and the patient or a member of their family), and charities by purchasing medicines from their main source.
The second main document is the Guidelines for Safe Disposal of Unwanted Pharmaceuticals in and after Emergencies, published by the World Health Organization (WHO) [
16]. This document contains the recommendations of disposal methods under sorted categories that require various disposal methods. The two categories are: (1) pharmaceuticals and other materials which can still be used and (2) expired or unwanted pharmaceuticals. Firstly, pharmaceuticals within their expiry date and that are deemed to be of use should be segregated and immediately used by the organization or reallocated according to the needs and instructions of the regional health authorities. Secondly, pharmaceuticals should never be used and should always be considered as pharmaceutical waste including all expired pharmaceuticals, all bulk or lost tablets, and capsules. If unexpired, these should only be used when the container is still sealed, properly labeled, or still within the original unbroken blister packs and all unsealed tubes of creams, ointments.
Knowledge representation is a method of storing and conveying information that a computer can use to solve issues, such as conversing with humans in natural language. What makes knowledge representation different from database storage is that it allows machines to learn from that knowledge and act intelligently, like a person.
Figure 1 shows the knowledge representation for the disposal and donation of medication.
Then, it is necessary to have expert field verification before bringing the knowledge collected during knowledge acquisition to the expert system design step, which uses flowcharts to model that information. Any disagreements in opinion were resolved by a majority vote among three experts from the College of Pharmacy, Umm al-Qura University.
Secondly, expert system development is included in the design phase (knowledge base, inference engine, and user interfaces). After presenting the knowledge in the flowchart, the flowchart is converted into if-then rules. Then, the inference engine, which is the main processing component of the expert system, gains knowledge from the knowledge base and engages with it to come up with a specific disposal recommendation. For example, the user enters the medication open date. The inference will fire the rules that match the medication types and calculate the expired date as suggested by the manufacturer. On the due date, the medication disposal recommendation appears on the website to notify the user about the medication and the proper methods for disposal.
Thirdly, adaptations made during the expert system prototype development process require corresponding alterations to the website design. Fourthly, the expert system interfaces, databases, and web pages are implemented. During the expert system’s validation and verification procedure, human experts and users who test the system may discover potential issues with the system.
2.2. Information Management System
The database was developed using the SQL server to store the medication information that is used by the inference engine. The database also stores medication data added by each user as shown in
Figure 2. The system design and database are described in
Supplementary Section S2. It includes the database and sequential design of the donation and disposal process.
2.3. Chatbot
A chatbot is a computer program that interacts with people and simulates and processes human conversation (whether written or spoken), allowing people to interact with digital devices as if they were talking to a real individual. Chatbots can be as simple as a project that answers a basic query with a one-line interaction, or as complex as digital assistants who learn and evolve to import higher levels of personalization as they collect and process data.
The chatbot gives the user choices to choose from. The main menu contains four choices which are: (i) important information, (ii) knowing the validity of the medication, (iii) medication disposal method, or (iv) rephrasing user questions. Firstly, the important information contains details about how to dispose of medications using the hardware device, how to donate through the device, and how to take medications from the donated list. If the user chooses one of them, the chatbot will give all the information that the user needs. Secondly, knowing the validity of the medication developed based on the knowledge collected from the documentation, the chatbot asks the user some questions about the medication, then based on the user’s answers the chatbot will tell the user the validity of his/her medication. The knowledge is used from the flowchart. For example, the chatbot would ask the user to select the type of his/her medicine and the four types of medications were listed: “pills, drops, syrup, or cream”. If the user selected pills, the catboat would ask whether the pills were stored in packed blisters. Based on the user’s answer, the recommendation should be displayed, such as “great, the medication is useable until the expiration date”. Thirdly, the medication disposal method contains important information about how to dispose of the expired medication correctly based on the type of medication. Finally, the last choice is rephrased as “user question”. If the user cannot find his/her question in the choice, he/she can repeat his question to the chatbot and receive an answer. All multiple choices, questions, and answers are contained in
Supplementary Section S3.
2.4. Classification Model
2.4.1. Dataset
The 239 samples were taken from the Registered Human Medicines List dataset, which can be accessed from the open data resource [
17] (see
Supplementary Section S4). The medication images from different sides were collected and added to the dataset. All medications are registered and contain the trade name, medicine type, package type, storage conditions, manufacturer name, and image of medicines. All images were classified into four categories: drop, pills, syrup, and cream.
2.4.2. Sequential Model Process for Image Classification
Keras is an open-source neural network library written in Python. Keras allows us to easily build, train, evaluate, and execute all sorts of neural networks. The core data structure of Keras is a model, which lets the user organize and design layers. Sequential and functional are two ways to build Keras models. The sequential model is the simplest type of model, a linear stack of layers. Firstly, download and explore the dataset that the model is used for training and testing and preprocess the dataset. Then, the data is divided into training 80% and 20% for testing. Secondly, configure the dataset for performance and make sure to use buffered prefetching that could yield data from disk without having I/O become blocking. Thirdly, standardize the data. The RGB channel values are in the (0, 255) range. This is not ideal for a neural network; to make the input values small, the standardized values should be in the (0, 1) range by using a rescaling layer, and resize images using the image size argument of image dataset from a directory or include the resizing logic in the model using the resizing layer. Fourthly, create the model, compile it, and train it using the dataset. If there are differences in accuracy between training and testing, the accuracy is noticeable, which is a sign of overfitting. When there are a small number of training examples, the model sometimes learns from noise or unwanted details from the training examples; to an extent that it negatively impacts the performance of the model on new examples. Data augmentation takes the approach of generating additional training data from our existing examples by augmenting them using random transformations that yield believable-looking images. This helps expose the model to more aspects of the data and generalize better.
2.5. Prototype
Software flowcharts (see
Supplementary Section S5) illustrate how the website works. It is divided into two types of users: The first type is the user who visits the site and has only some authority, including: viewing the list of donated medicines and knowing the places in which they are available through the map and writing inquiries in the chatbot. The visitor could learn how to properly dispose of the medicine depending on the type. The second type of user who has a membership on the site and has more authority, namely: viewing the list of donated medicines and displaying the places of available medication through the map. Modifying drug data and removing or adding a new drug to the medication list. Writing inquiries on the chatbot program. Learning how to properly dispose of the medicine depending on the type.
The hardware was designed with the Arduino Integrated Development Environment (IDE) (Arduino, Ivrea, Italy). This was used for creating the simulation and is a cross-platform application (for Windows, macOS, Linux). TinkerCad was also used, which is an online collection of software tools from Autodesk (San Rafael, CA, USA) that enables the creation of 3D models. The hardware screens were linked to the website; the user should be registered to log in to the device services.
4. Discussion
In recent years, the use of pharmaceutical products has increased significantly worldwide. The increasing use and improper disposal of pharmaceutical products around the world have drawn attention to the negative impacts on the environment. Firstly, the Kingdom of Saudi Arabia expends billions to provide treatment while the waste of medications results in a massive loss of financial resources. Secondly, some people need treatment and medication but cannot afford them. Many people may not know of the best ways to dispose of unused and expired drugs and there is a need to make the public aware of this and to assist in the proper gathering of unused pharmaceutical products [
5,
18,
19]. Bridging all these issues and addressing them through the deployment of the website and device was the focus of our research. This research considered the importance of awareness that includes an educational website regarding the methods of proper handling of medicines in relation to preservation and storage operations and safe ways to dispose of them and about the expiration date written on the medicine packages to encourage patients and their families once they stop using the medicines to bring them to the medication take-back point instead of disposing of them in unhealthy and unsafe ways for the environment and society.
The first strength is that the three types of users who followed the rules and information on the website were highly committed to organizing the medication life cycle. Starting to add the medication details and the status of the medication are changed once the medication had expired. The website educated the users about the proper disposal method based on the medication type. The other option was to denote the unused medication by linking the process of medication management. Using the website to store the medication details, and displaying the donated list on the website, putting the medication in the device after signing the agreement of the policies of donation. This regulates the process of collecting medications and giving them to the needy under healthcare control since the patient purchased the medication until he/she decided to dispose of or donate them.
The other advantage is preventing medicines from reaching streams and rivers or water sources when pouring them down the drain or toilet. When flushing medication down the bathroom sink, prescription and OTC medications can leak into the soil and groundwater. Although this research provided a safe and ecologically friendly method of disposing of unneeded pharmaceuticals, it is important to obtain the recommendation to use biodegradable chemicals and environmentally friendly packaging materials, which can be recycled or made from recycled materials, which could help in further reducing pharmaceutical pollution [
20].
The weakness in this study could be reflected in consumer behavior. For example, users may have difficulty following instructions and proper procedures for medication disposal or donation. In addition, users might not have time to bring the medications to take-back devices. Although the website included all the information about the proper disposal methods, users might lack concern about the risks resulting from improper disposal methods and their impact on the environment.
Data loss and the accumulation of medicines in the devices are possible problems in this research. Data can be rendered unreadable by humans and software alike if it is infected with a virus or suffers physical harm. A direct result of losing the database is the time and money it takes to repair or recover data; in our device, this is critical. All medications should be disposed of since this problem might affect humans. The second problem is the accumulation of medicines in the devices. Even though the purpose of this study was to minimize the harmful impact of environmental contaminants, the study did not consider the solution to this problem. Thus, the admin should manage this by contacting healthcare-related industries. The medication must be properly managed in line with all applicable government policies. Smale et al. [
20] suggested strategies to solve problems such as waste reduction, reuse, and recycling, which are all important components of a circular economy strategy, but they need not be the only ones employed.
5. Conclusions
This study proposed supporting the proper management and disposal of unused and expired medications by teaching people how to dispose of medicines and pharmacies by using a suitable machine for the proper disposal and donation of medications. The web-based expert system and chatbot provided education for consumers regarding correct medication disposal practices and contributed to increasing awareness of the possibility of donating usable medicines. The prototype device was designed for collecting medication to automatically classify medications for proper disposal and donation.
The study included two parts (software and hardware): (i) the web-based expert system containing a user medicines list, medication disposal/donation information, and a chatbot. The user could display information about the medicine validity, edit the medicine list, and dispose or donate of medicine. The user could also inquire about the appropriate way to dispose of the medication based on its type (drops, ointment, liquid, tablets) and validity (expired or usable). The user could display the list of donated drugs and saw the location of the devices (hardware); (ii) the prototype device was used to collect and dispose of medicines after verification. This device used a classification model and image for classification verification. The initial prototype design of the web-based expert system would reduce the risk of improper disposal by providing substantial guidance on the safe disposal of unused medicines. The donation was also supported by using an organized method of collecting unused medicines. A limitation of the web-based expert system is the manual entering of medication information which takes a long time, is tedious and repetitive, and increases errors; for example, failure to enter the correct information about medicines and their validity with credibility, such as the incorrect storage method. In the future, the system can be improved by detecting the name and date of the drug from the image and reducing the number of manual inputs by the user. The classification model can also be improved by evolving the model automatically to include more medicines in the dataset with all upcoming medications that can be added by the users. In addition, both the website and the device can be enhanced to support other languages.