Intelligent Expert System for Detection of Healthcare- Associated Infections Andrii Hrimov1, Yurii Parfeniuk2, Maryna Railian3, Oleksandr Popov3 and Tetyana Chumachenko3 1 National Aerospace University “Kharkiv Aviation Institute”, 17 Chkalow str., Kharkiv, 61070, Ukraine 2 V.N. Karazin Kharkiv National University, 4 Svobody Sq., Kharkiv, 61022, Ukraine 3 Kharkiv National Medical University, 4 Nauky ave., Kharkiv, 61000, Ukraine Abstract Healthcare-Associated Infections (HAIs) pose a significant threat to patient safety and healthcare efficiency. Developing intelligent systems for HAI detection is crucial for enhancing patient care and managing healthcare resources effectively. Traditional methods for HAI detection rely heavily on manual processes, which are time-consuming and prone to errors. Integrating technology in healthcare offers an opportunity to improve these processes through automation and advanced data analysis. This study developed an intelligent expert system using a Telegram bot interface for patient interaction and a Django backend for data management. The system employed machine learning algorithms for analyzing patient responses and identifying potential HAIs. Data storage was managed using Minio and PostgreSQL, ensuring efficient and secure handling of patient information. The system demonstrated high efficiency and accuracy in HAI detection, surpassing traditional manual methods. User-friendly interfaces for both patients and medical staff facilitated easy adoption and interaction. The system efficiently managed data storage and retrieval, ensuring robust security measures. The research highlighted the system's potential to transform HAI detection through enhanced speed, accuracy, and user engagement. Future improvements could include advanced predictive analytics and broader scalability across healthcare settings. The developed intelligent expert system represents a significant advancement in HAI detection, offering a practical, efficient, and user-friendly solution. Its integration into healthcare systems can significantly reduce the incidence of HAIs, improve patient outcomes, and optimize healthcare resources. Continuous development and adaptation to emerging healthcare challenges remain essential for maintaining the system's effectiveness. This study provides a blueprint for the future of intelligent healthcare systems, emphasizing the importance of technology in advancing patient care and safety. Keywords Healthcare-associated infections, machine learning, expert system, data-driven medicine 1 1. Introduction Healthcare-Associated Infections (HAIs) represent a significant challenge in modern medical practice, affecting patient outcomes and straining healthcare systems globally [1]. The rise in the incidence of HAIs, particularly in post-surgical scenarios, underscores the need for enhanced surveillance and intervention strategies [2]. Traditional methods of HAI detection often rely on manual reporting and analysis, processes that are time-consuming and prone to human error. This scenario necessitates the development of intelligent systems capable of augmenting the existing frameworks for more effective HAI detection and management. The evolution of data-driven medicine marks a transformative shift in healthcare, offering unprecedented opportunities for improving patient outcomes [3]. In this era of big data, harnessing the vast amounts of information generated by healthcare systems has become crucial ProfIT AI 2023: 3rd International Workshop of IT-professionals on Artificial Intelligence (ProfIT AI 2023), November 20–22, 2023, Waterloo, Canada andrew.hrimov@gmail.com (A. Hrimov); parfuriy.l@gmail.com (Yu. Parfeniuk); railyan77@gmail.com (M. Railian); oo.popov@knmu.edu.ua (O. Popov); tatlchum@gmail.com (T. Chumachenko) 0000-0001-5696-3779 (A. Hrimov); 0000-0001-5357-1868 (Yu. Parfeniuk); 0000-0002-1587-4435 (M. Railian); 0009-0008-7178-1074 (O. Popov); 0000-0002-4175-2941 (T. Chumachenko) © 2023 Copyright for this paper by its authors. Use permitted under Creative Commons License Attribution 4.0 International (CC BY 4.0). CEUR Workshop Proceedings (CEUR-WS.org) CEUR ceur-ws.org Workshop ISSN 1613-0073 Proceedings [4]. Integrating data analytics into medical practice enables more precise and personalized patient care [5]. It facilitates the identification of patterns and trends that would be imperceptible through traditional analytical methods [6]. This approach is particularly pertinent in HAIs, where early detection and intervention can drastically alter patient trajectories. By leveraging data- driven methodologies, healthcare providers can optimize treatment strategies, enhance patient monitoring, and elevate the standard of care [7]. The ongoing full-scale military invasion of Ukraine by Russia presents unique and pressing challenges to healthcare systems, particularly in the detection and management of HAIs [8]. In conflict zones, healthcare facilities often face overwhelming patient loads, resource constraints, and disrupted supply chains, exacerbating the risk of HAIs [9]. The chaotic and resource-strained environments make implementing proposed system for HAI detection relevant and essential. Such a system can play a critical role in these high-pressure settings, offering rapid and accurate infection detection, which is vital for timely treatment in a landscape where healthcare resources are severely strained. This context highlights the urgent need for scalable, efficient, and resilient healthcare solutions, underscoring the significance of the research undertaken in this paper. This research introduces an Intelligent Expert System explicitly designed to detect HAIs in post-surgical patients. The primary objective is to establish a decision support mechanism that seamlessly integrates with existing healthcare infrastructure, ensuring efficient patient data collection, analysis, and interpretation. By leveraging advanced computational techniques, the system aims to provide timely and accurate identification of infection risks, facilitating early intervention and reducing the incidence of HAIs. The proposed system employs a multi-faceted approach, combining data mining, machine learning algorithms, and expert domain knowledge to create a robust detection framework. Developing an Intelligent Expert System for HAI detection represents a significant step forward in patient care and healthcare management. By automating the detection process, the system offers the potential to reduce the workload of healthcare professionals, allowing them to focus on patient care rather than data analysis. Furthermore, early detection and intervention in HAIs can lead to better patient outcomes, reduced hospital stays, and lower healthcare costs. This paper explores the potential of such a system to transform post-surgical care and presents a blueprint for its implementation in healthcare settings. Research is part of a complex intelligent information system for epidemiological diagnostics, the concept of which is discussed in [10]. 2. Materials and methods To implement a system that can meet the requirements, namely interrogate the patient, analyze responses and provide immediate recommendations; store patient responses; provide a convenient interface for medical staff to view patient responses The following services necessary to be present in the system can be distinguished: • A user interface for surveying (in this case, a Telegram bot) • A service that can store survey data in a convenient format • A user interface for medical staff Having analyzed all available tools, the following services can be distinguished: • a Telegram bot, realized using the AIOGram framework, working together with Redis, for storing the state of the dialogue; • Django backend for storing results from the bot, forming a file, and providing an admin panel for medical staff; • Minio for file storage; • PostgreSQL for creating survey records for convenient filters in the admin panel. The architecture of the proposed intelligent system is presented in Figure 1. AIOGram, compared to other tools for developing Telegram bots, supports asynchronous application architecture (which can be helpful in the future when scaling the application to handle large traffic). Another advantage of AIOGram is the presence of a convenient mechanism for remembering the state of the dialogue thanks to the Final State Machine and its easy integration with the storage of this state either in the memory of the application process or in some separate storage, such as Redis or MongoDB. Django was chosen because of the availability of an admin panel 'out of the box,' which sped up the development process – a user interface for medical staff does not need to be developed from scratch; it is sufficient to configure the existing one. Redis was chosen as one of the most straightforward data storage systems to configure for storing the state of the dialogue. PostgreSQL is one of the most popular and, at the same time, one of the most productive relational databases, which can be replaced by another, for example, SQLite or MySQL, but in most cases, PostgreSQL has the advantage. Minio is a perfect option for development – it allows the simulation of the entire system infrastructure locally. Amazon S3 (Simple Storage Service) can be taken as a better alternative, but it will not be free, so in the case of development, it is better to prefer Minio. The most significant advantage of Minio is also that Minio is S3-compatible; it is just necessary to replace the link from the local Minio to the storage in S3. Considering the need to support several services, the system infrastructure was deployed using Docker virtual machines and defined using the docker-compose utility in YAML format. Also, during development, it was discovered that keeping one of the services in a container is impossible due to the peculiarity of the pre-signed URL in object storage: a link to a file can be made and signed only from the client side. However, managing the infrastructure in Docker containers and raising it locally simultaneously would be inconvenient. Therefore, a Makefile was written to automate the commands, which helped to create convenient shortcuts to a whole list of commands. For data collection, a tree-like questionnaire for the patient was used. During the survey, some positive responses will immediately indicate a suspicion of infection in the area of surgical intervention. One of the responses, on the contrary, may indicate the presence of an infection unrelated to the surgical intervention. Suppose no suspicious cases of infection in the area of surgical intervention or infection unrelated to the surgical intervention are detected during the survey. In that case, the patient will be told that any infection related to the provision of medical care will be excluded. Therefore, we have identified the necessary functionality of the Telegram bot; let us take it as a separate abstract service that will collect information, store the user's intermediate result, and at the end, provide the result to the user and also send this information to the service where the final result for medical staff will be stored. However, a convenient user interface for medical staff is still needed. Django, which was primarily chosen for this project precisely because of this feature, namely the availability of a built-in admin panel, can quickly help. Django supports the display of 'models' in the admin panel, which were previously registered. Therefore, first, making models and registering them in the admin panel is necessary. A model is a class representing a separate record in the database as an object of this class. That is, there is a need to make some database structure and migrate. Django also has its migration management mechanism, which we will use. First, we need to make functionality convenient for medical staff, so we need to think immediately about which filters might be useful when searching for a particular record in the admin panel. Since the characteristics by which we can search and the columns inside the table are directly related, it is necessary to identify valuable characteristics of our survey as separate columns in the model. Figure 1: System architecture Taking into account the most useful characteristics from the point of view of medical staff, as well as the need to store patient data securely and conveniently for medical staff, such a database structure can be made (Figure 2). Next, following this ER diagram, we will make Django models and register them in the admin panel. An essential aspect of the service, which will store data for medical staff, is also the convenience of the format in which to store them and how to have the ability to obtain them thanks to a link or otherwise. The most widely used data format chosen was Excel because most medical staff, in one way or another, work with this software. Figure 2: ER diagram of the database structure Therefore, when receiving data from the bot service, the following sequence of actions must be performed: 1. Convert the data into a format that is easy to read for the staff. 2. Create a record in the database regarding the completion of the survey, identifying some of its characteristics as attributes of the model. 3. Create an Excel file, fill it with information, upload it to the storage, obtain some identifier of this file from the storage, and also store it in the model. 4. Properly handle any data transformation errors if they occur during the first stages. In this way, we can view brief information about a particular survey, filter these records by some characteristics, and access the file with complete information about the survey. 3. Results The graphical user interface for the patient will look like a Telegram chat, only with an intelligent bot. Also, for the convenience of using the bot, functionality with buttons and hints was added in case a question can be understood ambiguously. After the last question, the user will be given a result in which it will be indicated whether there is a suspicion of infection or not. If necessary, a medical worker can find this particular patient because, with each survey, a link to the patient's contact in Telegram is also taken. The Django admin panel provides a graphical user interface for medical staff. Thus, by going to the address of the admin panel, one can enter it with the provided login password. The medical staff will see the following interface upon entering the admin panel. To view survey records, one must select the Surveys item in the Core section (Figure 3). As mentioned above, filters and search capabilities have been added – for now, only search by patient name and filter by full age. The medical staff can also view each record separately to learn more about the patient and their completed survey. Each record also includes contact with the patient via a link to a Telegram chat with them and a file with all the patient's responses. By copying and following the file link, an Excel file with all the patient's responses will be downloaded, as well as additional information – contact details and survey results. Thus, medical staff can conveniently work with the information provided by the patient and have the ability to effectively and quickly contact them for clarification of any additional details or to prescribe additional treatment. Figure 3: The interface of the admin-panel 4. Discussion The escalating prevalence of HAIs in the contemporary medical landscape underscores the critical need for innovative solutions. HAIs pose significant health risks, prolonging hospital stays, increasing the likelihood of readmission, and elevating overall healthcare costs. In this context, developing an intelligent expert system for HAI detection is timely and essential. The dynamic nature of healthcare challenges, including the emergence of antibiotic-resistant strains and the varying standards of infection control across different healthcare settings, heightens the actuality of this topic. The proposed solution, centered around an intelligent Telegram-bot-based expert system, addresses critical limitations of traditional HAI detection methods. Conventional approaches often rely heavily on manual surveillance and subjective interpretation, leading to potential delays in diagnosis and inconsistent data collection. In contrast, the automated and data-driven nature of the proposed system allows for more efficient, accurate, and timely identification of potential HAIs. This is particularly crucial in the fast-paced environment of healthcare facilities where rapid response can significantly impact patient outcomes. Integrating this technology into existing healthcare frameworks demonstrates a forward-thinking approach to medical informatics, emphasizing the growing importance of digital tools in enhancing patient care quality and safety. The system's design, which includes an intuitive user interface for patients and medical staff, ensures ease of use, facilitating wider adoption and implementation. Its ability to store, analyze, and retrieve patient data efficiently positions it as a valuable tool for detecting HAIs and contributing to broader epidemiological studies and infection control strategies. By leveraging state-of-the-art technologies like AI and machine learning, the system embodies a contemporary approach to healthcare challenges, aligning with the global trend towards more connected, intelligent, and patient-centric healthcare solutions. During the design and development of the system, some compromises were made regarding the technologies or approaches used. For example, as an object storage, Amazon S3 (Simple Storage Service) could have been chosen. This option would have been easier to use and scalable because the storage service would be entirely Amazon's responsibility in that case. However, this would not have been free, so Minio, which is also S3-compatible and can act as an intermediary between application and S3, was chosen during development. Therefore, as one of the possible improvements to the system, replacing the storage cluster with an S3 bucket can be considered. Another example of a compromise is the choice of Excel format for storing complete information about the survey. A better alternative to this format is the CSV format, which would take up significantly less storage space and, in the case of using Amazon S3, could save money. However, the CSV format is less convenient for the ordinary person not deeply immersed in information technology. Therefore, Excel remains the more user-friendly and readable option. Of course, as a possible improvement to the system in the future, the development of some intermediate layer or service that would provide the option of transforming CSV format to Excel and vice versa can be considered. Regarding the choice of technologies in general, taking an already ready-made solution is only sometimes the best. This thesis can also be applied to Django and the built-in admin panel. Django was chosen because the built-in admin panel greatly accelerates the development process of other components, and the panel only needs to be properly configured. However, there are better solutions than this option. The best option is to separate the service that will only handle data storage and uploading to or from the storage and a separate service that will provide a management panel and record viewing, that is, a separate frontend service. Looking ahead, the field of intelligent healthcare systems, particularly for HAI detection, presents numerous avenues for further research. One promising direction is the integration of more advanced machine learning algorithms and predictive analytics, enhancing the system's ability to detect and predict the likelihood of HAIs based on a broader range of variables. This could include patient-specific factors, environmental conditions, and genetic data, offering a more holistic and personalized approach to infection risk assessment. Additionally, exploring real-time data analysis capabilities would significantly improve the system's responsiveness and accuracy in dynamic clinical settings. Another key area for future research lies in the scalability and adaptability of the system across different healthcare infrastructures, including under-resourced settings. Ensuring that the system can function effectively in diverse environments with varying levels of technological advancement is crucial for its widespread applicability and impact. Moreover, future studies could focus on integrating this system with other healthcare technologies, such as EHRs and telemedicine platforms, to create a more interconnected and seamless healthcare IT ecosystem. Lastly, as with any healthcare technology, continuous evaluation and improvement of privacy, security, and ethical considerations are paramount. Future research should develop robust security protocols to protect sensitive patient data and ensure the ethical use of AI and machine learning in healthcare. This involves addressing potential biases in data and algorithms to ensure equitable and fair treatment outcomes for all patients. By addressing these challenges, future research can pave the way for more advanced, secure, and ethical intelligent systems in healthcare, ultimately contributing to better patient outcomes and more efficient healthcare delivery. 5. Conclusions Developing and implementing an intelligent expert system for HAI detection marks a pivotal advancement in healthcare informatics. This research has successfully demonstrated that integrating a Telegram-bot interface with a Django backend, supplemented by efficient data storage and retrieval mechanisms, can significantly enhance identifying HAIs. One of the primary conclusions of this study is the system's superior efficiency and accuracy in HAI detection compared to traditional manual methods. By employing advanced computational techniques, the system streamlines the detection process and increases the accuracy and timeliness of infection risk identification. This is a critical advancement, considering the urgent need for prompt and precise HAI detection in healthcare settings. Furthermore, the user-friendly design of the system's interfaces for patients and medical staff is noteworthy. The Telegram-bot interface simplifies the patient process, while the Django-admin panel provides a comprehensive and accessible platform for medical practitioners to interact with and manage patient data. This dual approach in interface design ensures that the system is easily adaptable and user-friendly, an essential factor for its effective implementation in real- world scenarios. Data management and security are also key aspects highlighted in this study. With robust technologies like Minio and PostgreSQL, the system ensures efficient and secure data management. However, the research underscores the ongoing importance of data security and privacy, especially considering the sensitive nature of patient information in the digital healthcare context. While the current iteration of the system represents a significant advancement, its scalability and adaptability to various healthcare environments remain areas for further development. Enhancing these aspects will be crucial for expanding the system's impact and utility across diverse healthcare infrastructures. The proposed approach established a vital tool in combating HAIs, blending technological innovation with practical healthcare applications. Its potential in reducing HAI incidence, improving patient outcomes, and optimizing resource utilization in healthcare is profound. However, the evolution of this system must continue, with ongoing refinements and adaptations driven by future research and technological advancements, to ensure its sustained efficacy and relevance in the ever-changing healthcare landscape. Acknowledgements The study was funded by the National Research Foundation of Ukraine in the framework of the research project 2020.02/0404 on the topic “Development of intelligent technologies for assessing the epidemic situation to support decision-making within the population biosafety management”. References [1] A. Facciolà et al., “The role of the hospital environment in the healthcare-associated infections: a general review of the literature,” European Review for Medical and Pharmacological Sciences, vol. 23, no. 3, pp. 1266–1278, Feb. 2019, doi: 10.26355/eurrev_201902_17020. [2] G. Gauron and T. Bigand, “Implementation of Evidence-based Strategies to Reduce Catheter-Associated Urinary Tract Infections among Hospitalized, Post-surgical Adults,” American Journal of Infection Control, vol. 49, no. 6, Nov. 2020, doi: 10.1016/j.ajic.2020.11.016. [3] D. Cirillo and A. Valencia, “Big data analytics for personalized medicine,” Current Opinion in Biotechnology, vol. 58, pp. 161–167, Aug. 2019, doi: 10.1016/j.copbio.2019.03.004. [4] S. V. G. Subrahmanya et al., “The role of data science in healthcare advancements: applications, benefits, and future prospects,” Irish Journal of Medical Science, vol. 191, no. 4, pp. 1473–1483, Aug. 2021, doi: 10.1007/s11845-021-02730-z. [5] M. Mazorchuck, et al., “Web-Application Development for Tasks of Prediction in Medical Domain,” 2018 IEEE 13th International Scientific and Technical Conference on Computer Sciences and Information Technologies (CSIT), pp. 5–8, Sep. 2018, doi: 10.1109/stc-csit.2018.8526684. [6] D. Chumachenko, “On Intelligent Multiagent Approach to Viral Hepatitis B Epidemic Processes Simulation,” 2018 IEEE Second International Conference on Data Stream Mining & Processing (DSMP), pp. 415–419, Aug. 2018, doi: 10.1109/dsmp.2018.8478602. [7] N. Dotsenko, et al., “Modeling of the Processes of Stakeholder Involvement in Command Management in a Multi-Project Environment,” 2018 IEEE 13th International Scientific and Technical Conference on Computer Sciences and Information Technologies (CSIT), pp. 29–32, Sep. 2018, doi: 10.1109/stc-csit.2018.8526613. [8] A. D. Shkodina, H. Chopra, I. Singh, S. Ahmad, and D. I. Boiko, “Healthcare system amidst the war in Ukraine,” Annals of Medicine and Surgery, vol. 80, p. 104271, Aug. 2022, doi: 10.1016/j.amsu.2022.104271. [9] V. Poberezhets, “Healthcare crisis in Ukraine – worrying consequences of the Russian- Ukrainian war,” Croatian Medical Journal, vol. 63, no. 4, pp. 315–316, Aug. 2022, doi: 10.3325/cmj.2022.63.315. [10] S. Yakovlev et al., “The Concept of Developing a Decision Support System for the Epidemic Morbidity Control,” CEUR Workshop Proceedings, vol. 2753, pp. 265–274, 2020.