Introduction

Rapid urbanization and population growth across the world have led to the widespread production of emerging contaminants, which puts significant pressure on wastewater treatment systems. Water scarcity drives our focus towards achieving maximum resource recovery. Zero waste generation is one of the ideal pathways towards achieving a circular economy, which brings remarkable transformation of wastewater treatment systems through commercialization by adding value management processes (Matheri et al. 2022). If left untreated and discharged from conventional wastewater systems, emerging pharmaceutical contaminants in aquatic or marine ecosystems can adversely impact human health and the environment (Osman et al. 2023; Priya et al. 2022).

When pharmaceutically active compounds are released into the environment through human metabolites, it can cause a wide range of side effects on non-target aquatic organisms even at minute concentrations (ng/L or μg/L). This leads to the development of multi-resistant strains and the formation of endocrine-disrupting chemicals from breakdown of intermediate by-products from parental compounds, causing significant carcinogenicity, mutagenicity, and teratogenicity in humans and aquatic organisms (Zhan et al. 2019). Among these pollutants, the types of contaminants that have become increasingly challenging to treat are pharmaceuticals and personal care products, disinfection by-products, and per- and poly-fluoroalkyl substances. In addition, wastewater treatment systems are highly complex and dependent on different environmental factors. Process parameters are optimized to tailor the control systems to improve the efficiency of wastewater treatment processes.

Although industrial and anthropogenic activities have introduced significant amounts of impurities and hazardous pollutants into our environment, several methods have been developed to minimize the effects of water pollution. These methods have its own merits in terms of the levels of water treatment quality and its varying effects on the environment. The treatment methods proposed by other researchers include coagulation–flocculation (Kooijman et al. 2020), membrane filtration (Ganiyu et al. 2015), ion exchange (Swanckaert et al. 2022), desalination (Shah et al. 2022), and biological treatment (Singh et al. 2023).

For biological treatment, the parameters used to characterize the levels of water treatment quality include biological oxygen demand and chemical oxygen demand. However, the conventional wastewater treatment used to purify or disinfect the wastewater is time-consuming and requires lengthy or arduous procedures (Safeer et al. 2022). To ease the complexity of wastewater treatment systems, artificial intelligence and machine learning algorithms are used to improve the intelligent systems and manage complex dynamics of mathematical models to effectively optimize the operational conditions of the wastewater treatment systems (Oruganti et al. 2023).

Currently, artificial intelligence and machine learning algorithms have been widely integrated into the existing operational management system of wastewater treatment plants, improving the water quality monitoring system (Chawishborwornworng et al. 2023), accuracy, and precision of model prediction (Serrano-Luján et al. 2022) and maximizing optimization efficiency of the process parameters (Zhang et al. 2023a). On the other hand, the theoretical or computational models developed for conventional wastewater treatment systems are overtly simplified based on the ideal assumptions rather than the real-world applicability of process models to make it practical for industrial purposes (Safeer et al. 2022).

Although empirical and statistical regression analyses are developed to predict the behaviour of process control systems, the complexity of real-world process dynamics and deviation in the non-linearity of regression models affect the accuracy of prediction (Özdoğan-Sarıkoç et al. 2023). Artificial intelligence can be incorporated into pharmaceutical wastewater treatment plants integrated with renewable energy technologies to forecast energy efficiency and offer advanced analytics for optimal energy management of pharmaceutical wastewater treatment systems.

Figure 1 depicts the critical components of advanced computing and software technology for improving pharmaceutical wastewater treatment systems. With the ever-growing issues of antimicrobial-resistant genes and viral diseases, future trends are forecasted to rely on developing more advanced artificial intelligence and machine learning algorithms to optimize the process conditions. This review is divided into five main topics encompassing the artificial intelligence applications in managing big data, strengthening cyber-physical systems, blockchain technology, and internet of things to improve the disinfection performance of pharmaceutical wastewater treatment systems.

Fig. 1
figure 1

Advanced computing and software technology allow to enhance technical reliability, cyber-resilience, energy resources management, and water quality in pharmaceutical wastewater treatment systems

Assessment of water quality

In the era of digital health and artificial intelligence, the challenges and perspectives for the future of electrochemical technologies, epidemiology, and interdisciplinary research can be bridged, unleashing the power of artificial intelligence and machine learning algorithms in diagnosing and treating infectious diseases (Tang and Cao 2023) and other antimicrobial-resistant genes developed from issues associated with water sanitation and environmental pollution, advancing both health informatics, precision medicine, and toxicogenomics related to improvement in water quality assessment of pharmaceutical wastewater effluent.

More interestingly, artificial intelligence and machine learning algorithms empower sustainable circularity, digital twin, and intelligent data-driven operations and process control systems, improving data mining, analysis, and prediction to support policymaking to achieve a circular economy and enhance energy efficiency, life cycle environmental and cost management technologies (Matheri et al. 2022; Osman et al. 2024). Artificial intelligence/machine learning algorithms can also be used to optimize complex process dynamics and non-linearity, using artificial neural network and adaptive neuro-fuzzy inference system and support vector machine software interfaces and other intelligent systems to assess water quality by predicting chemical oxygen demand, biochemical oxygen demand, total suspended solids, total dissolved solids concentrations in pharmaceutical wastewater (Safeer et al. 2022).

The artificial neural network was among the first machine learning algorithms developed based on perceptron (Park et al. 2022). An artificial neural network's model structure comprises three layers: input, hidden, and output. The hidden layer is a critical structure of an algorithm made up of nodes. Each node calculates the output variable for a series of steps using a nonlinear function called the activation function (Park et al. 2022). An increase in the number of hidden layers results in more complicated calculations due to additional predictions from input parameters. However, the problems associated with hidden layers are due to overfitting the training data and diminishing gradients during the optimization of the models (Jariwala et al. 2023).

To address this deficiency, a deep learning algorithm is used as an alternative function involving a rectified linear unit instead of a conventional sigmoidal function to minimize the problems associated with the vanishing effect of gradient. However, before the development of neuronal networks such as autocoders, feed-forward neural network, convolutional neural networks (Muniappan et al. 2023), recurrent neural network, and so on, there were various setbacks in artificial neural network architecture that needed to be explored.

The first significant issue associated with artificial neural network architecture is the non-existence of rules for defining neuronal network structures (Jariwala et al. 2023). The appropriate artificial neural network architecture design can be obtained through trial-and-error experience. This makes the process of developing artificial neural network architecture increasingly tedious.

Secondly, the artificial neural network architecture is hardware-dependent, which means the parallel processing power in computation becomes problematic because it is limited by the hardware properties (Jariwala et al. 2023). Hence, translating mathematical problems into numerical information leads to more issues related to artificial neural network architecture. This phenomenon involves unexplained network behaviour, constituting a probing solution and eventually leading to a fourth issue. The underlying issue associated with probing solutions is due to artificial neural network's justification and reliability, which may breach users' trust within the network.

When dealing financially with pharmaceutical companies, artificial intelligence and machine learning play a significant role in all aspects of drug discovery, wastewater treatment, and technological development processes. During wastewater treatment, the application of artificial intelligence can minimize the utilization of manpower and considerably reduce the expenditure on capital investment and maintenance costs related to treatment methods used.

On the other hand, the setbacks of wastewater treatment infrastructures can be attributed to the setting up of artificial intelligence infrastructures and computation technologies involving complex process control systems to improve the water quality at the output processes. There are several setbacks involved (Jariwala et al. 2023):

  • The cost of setting up complex computation infrastructure to facilitate artificial intelligence systems becomes a financial impediment to small wastewater treatment industries and pharmaceutical firms. The requirement to install compatible hardware and software into the existing computational systems for proper functioning of artificial intelligence incurs significant financial expenditure.

  • The speed of artificial intelligence algorithms affects the data processing power when it comes to accessing the data in real time to perform analysis and facilitate decision-making processes. Slow processing power and prolonged latency lead to undesirable consequences, resulting in delayed project timeline.

  • Minimization of energy consumption is an important agenda when integrating compatible hardware with existing systems to deploy artificial intelligence technology. New integration systems with optimization modes to reduce power consumption would ease the financial burden on the business and wastewater treatment industry.

  • The complexity of the artificial intelligence infrastructure can be managed through optimization and automation. Artificial intelligence technology can debug and troubleshoot any issues that arise rather than increasing computational complexity.

  • Artificial intelligence systems require enormous computational energy to process and analyse data. Computational power grows immensely as the data grows, requiring algorithms to manage the voluminous data and minimize power consumption.

  • Regular auditing and testing of machine learning models to improve the integrity of algorithms would help to streamline the deployment of artificial intelligence technology. This requires a diverse team of technical experts and personnel.

The optimization of analytical process conditions is significant. The characteristics and trace origins of water pollutants can be identified using unique artificial intelligence systems called the integrated long short-term memory network involving cross-correlation and association rules (Apriori) (Wang et al. 2019b).

Firstly, internet monitoring systems can acquire critical information about the pollutant sources entering the pharmaceutical wastewater treatment systems. The complex information on pollution incidents involving flow simulations, number of point sources at influent and effluent systems, and pollutant release processes can be interpreted using long short-term memory (Wang et al. 2019b). This method is computationally efficient because it deals with an artificial intelligence algorithm using a time-recursive neural network to predict critical events such as long intervals and delays of water pollutants on influent and effluent systems.

In addition, a convolutional long short-term memory provides a framework for sequencing learning problems using training data temporally to evaluate or predict the water quality pollutants in effluent systems (Wang et al. 2019b). However, there is currently a lack of robust mathematical expressions to correlate the measured parameters such as biochemical oxygen demand and chemical oxygen demand, total suspended solids, ammonia, organic nitrogen, and organic phosphorus content of wastewater, in which the data can only be obtained using online sensors. There are also uncertainties or perturbations in predicting biochemical oxygen demand and chemical oxygen demand values.

For this reason, integrating other artificial intelligence methods, such as gene expression programming and Monte Carlo simulation technique, can provide insights into estimating the levels of uncertainty or perturbations in wastewater process conditions. These techniques assess the sensitivity of target parameters and its influences on the variations in input parameters and scrutinize the interactions between the process parameters to evaluate the wastewater quality parameters (Aghdam et al. 2023). However, the online-based optimization technique has not been adequately applied to the bio-processing system due to the complexity of the biological behaviour.

Furthermore, the lack of data visualization techniques, low-quality industrial measurement systems, and understanding of underlying phenomena in wastewater treatment plants are ongoing issues. The data modelling approaches can be strengthened using artificial neural network, Gaussian process regression (Yao et al.), and polynomial chaos expansion to analyse the meta-models of wastewater treatment plants efficiently.

In addition, other artificial intelligence application tools such as expert systems (Wu et al. 2021), fuzzy logic (Mazhar et al. 2019), artificial neuro-fuzzy inference systems (Nam et al. 2023), support vector machine (Zhang et al. 2023b), knowledge-based systems (Liu et al. 2023), ruled-based systems (Victor et al. 2005), fuzzy logic control (Santín et al. 2018), pattern recognition (Gao et al. 2023), swarm intelligence (Negi et al. 2023), genetic algorithm (Aparna and Swarnalatha 2023), reinforcement learning (Wang et al. 2023a), hybrid systems (Tariq et al. 2021), and so on have gained its purposes in process control systems and prediction of water quality characteristics.

In addition, poor wastewater quality often leads to membrane fouling of filtration technologies used in the pharmaceutical wastewater treatment industry. Membrane fouling is a major obstacle hindering the widespread application of anaerobic membrane bioreactors to treat pharmaceutical wastewater (Niu et al. 2023).

Artificial intelligence algorithms and its modelling framework can predict membrane fouling phenomena in membrane filtration technologies using hyper-parameter optimization of artificial neural network and random forest to improve predictive capabilities (Niu et al. 2023; Yuan et al. 2023). In addition, artificial neural network and Bootstrap methods enhance the accuracy, robustness, and reliability of prediction tools to estimate the water quality indexes (Chawishborwornworng et al. 2023).

However, bootstrap programming adds a significant number of codes into the network, limiting the performance and processing speed of the software management system. On the other hand, the combination of artificial neural network and bootstrap algorithms improves the estimation of prediction error distributions, making it easier to analyse any faults or anomalies within the wastewater treatment systems (Mo et al. 2024).

In contrast, the main disadvantages of hybrid artificial intelligence models are complicated design constraints and uncertainties in predicted data arising from data clustering, making it challenging to discern exact data patterns to achieve optimal forecasting (Tikhamarine et al. 2020). For example, seasonal variation influences the wastewater streamflow and effluent quality; it is rather challenging to forecast the hydrological streamflow due to uncertainties in prediction (Ibrahim et al. 2022). In addition, Fig. 2 shows the artificial intelligence optimization framework applicable to various calculation tools for evaluating and predicting pharmaceutical wastewater treatment quality.

Fig. 2
figure 2

Artificial intelligence research optimization framework for predicting pharmaceutical wastewater quality. Many data and model parameters can be arduous and challenging to manage, such as high-dimensional space and complex process control systems that require a powerful framework to assist computational resources in improving model performance, calibration, and optimization techniques. Error function analysis can determine the quality of predictive model performance to simulate process conditions and behaviour of pharmaceutical wastewater treatment systems

Overall, we observed that artificial intelligence applications in complex biological wastewater treatment systems are still developing, which could trigger severe and undesirable problems. Integrating artificial intelligence technologies may lead to system-wide compromise due to incompatibility with existing operational systems, a cascade of design errors, malfunctions, and possible cyber-attacks leading to other critical infrastructure failures, causing havoc in ecological systems and service availability to local communities. Hence, software and hardware functions of artificial intelligence technologies must account for the systemic risk and benefits of integrating advanced cyber-physical systems, data security infrastructure, blockchain technology, and the internet of things to achieve a robust system.

Disinfection

The concentration of disinfection by-products and severe acute respiratory syndrome coronavirus 2-related pharmaceuticals in wastewater effluents and surface water in aquatic environment impact the orchestration of coronavirus disease-19 pandemic. For example, a significant increase in concentrations of disinfection by-products such as trihalomethanes and haloacetic acids in hospital and pharmaceutical wastewater effluents and surface water ranging from 5.9 to 21.7 μg/L from wastewater discharge points increased ecotoxicities in aquatic environment (Zhang et al. 2022).

Wastewater-based epidemiology is one of the most effective surveillance tools for examining the sources of transmission of bacteria, microorganisms, and coronaviruses such as severe acute respiratory syndrome coronavirus 2 in wastewater. However, significant research gaps exist in addressing the difficulties and challenges in detecting, monitoring strategies, remediation, and disinfection methods of viruses in pharmaceutical and general wastewater (Bhattacharya et al. 2023).

More critically, there is a lack of regulatory framework and compliance related to the integration of artificial intelligence and machine learning technologies into existing pharmaceutical wastewater treatment systems, the uncertainties in technology efficiency for disinfection performance of wastewater treatment systems, and the economic viability of the wastewater treatment infrastructure, public or socio-economical resistance which may hinder practical implementation of artificial intelligence and blockchain-related technologies in wastewater treatment systems.

Moreover, these barriers can be minimized through collaborative efforts and systematic approaches from regulators, policymakers, engineers, and social scientists to translate innovative information technology into solutions to improve water sustainability in wastewater treatment domains (Robbins et al. 2022). However, method development and validation are the most significant challenges of implementing artificial intelligence and machine learning in complex process dynamics in pharmaceutical wastewater treatment systems.

Method validation is extremely critical to obtaining high-quality data (Corominas et al. 2018). A simple installation of sensors and cohesive maintenance efforts for optimizing process control systems do not guarantee adequate data quality, regardless of high computational processing power of information technology infrastructure. Dynamic wastewater processes are often characterized by constant changes at many different real-time scales, spanning from seconds to years in terms of dynamic pH changes, plant configuration, layout arrangement, and construction periods, which are also critical conditions to how the processes change over time (Corominas et al. 2018).

Moreover, it is not practical to obtain voluminous, computationally expensive, and complex datasets, including real-time process dynamics over a meaningful period that requires uncompromised high-quality data (Ye et al. 2020). A large dataset of repositories requires continuous validation and comparison with predictive models for optimization, monitoring diagnostic purposes and updating control algorithms, which may require intensive labour and maintenance. There is a lack of standardized information technology protocols for selecting and implementing specific data analytic techniques equivalent to industry standards.

More advanced data management techniques are required to combine existing process systems with artificial intelligence, blockchain-related technologies, the internet of things, and cyber-physical systems. A plethora of methods have been developed or assessed. Still, challenges related to objective comparison between different industry artificial intelligence technologies, regulatory guidelines, validation limitations at full-scale systems, limited active and real-time data optimization, information sharing content, and quality affect the implementation of knowledge generation and artificial intelligence applications (Zhao et al. 2020).

The complexity of operational management systems increases with transmission routes of influent connecting to the pharmaceutical wastewater treatment plants, which involve several point sources discharged from hospitals, isolation centres, quarantine centres, and public places. The metropolitan and municipal wastewater plumbing systems are a significant pathway for spreading severe acute respiratory syndrome coronavirus 2. Severe acute respiratory syndrome coronavirus 2 is a member of a large family of viruses called coronaviruses that can infect people and some animals, causing mild to moderate respiratory illness.

The influent wastewater contains substantial viral loads of severe acute respiratory syndrome coronavirus 2 ribonucleic acid, a molecule present in most infected living organisms. Different treatment phases involving primary, secondary, and tertiary treatment methods are required to disinfect the pharmaceutical wastewater thoroughly. In primary physical treatment, the large, suspended solids in wastewater act as a physical barrier in removing viral particles (Bhattacharya et al. 2023).

Moreover, in the secondary treatment of wastewater treatment plants, diverse biological methods, including activated sludge process, membrane bioreactor, moving bed biofilm reactor, sequencing batch reactor, treatment ponds, and so on, are used to remove organic matter and large suspended solids from pharmaceutical wastewater. However, applying conventional activated sludge in large-scale hospitals and pharmaceutical wastewater treatments poses high energy consumption required for aeration, capital, and operational costs.

Although membrane bioreactors are progressively replacing the conventional activated sludge treatment systems and may achieve better treatment potential, the major drawback is due to membrane fouling, energy cost associated with aeration, and gradual reduction in membrane permeability resulting in the pressure fluctuation and greater energy consumption which lead to reduced performance at sizeable industrial-scale operations (Werkneh and Islam 2023).

In the tertiary treatment phase, various organics, turbidity, phosphorus, nitrogen, and other pathogenic microorganisms are removed using coagulation, advanced oxidation processes, filtration technologies, ultraviolet treatment, ozonation, chlorination, adsorbent materials such as titanium dioxide, carbon nanotubes, and other nanomaterials to inactivate viruses in the conventional wastewater treatment plants. It was reported that free residual chlorine species at a concentration of 0.5 mg/L required a contact time of 30 min at pH lower than 8, and 2.19 mg/L of chlorine dioxide is recommended for complete inactivation of severe acute respiratory syndrome coronavirus 2 in pharmaceutical wastewater (Bhattacharya et al. 2023).

More interestingly, artificial neural network can be applied to forecast the chlorination behaviour in the secondary pharmaceutical wastewater effluent containing ammonia, nitrate, and other pharmaceutical constituents. Disinfection of hospital wastewater results in changes in microbiome, resistome, and mobilome of wastewater and other bacterial communities and reduction in specific antibiotic resistance genes (Akhil et al. 2021; Rolbiecki et al. 2023).

An advanced control scheme can be developed to optimize the chlorination disinfection quality by integrating an artificial neural network model with fuzzy logic control to improve the chlorination process and minimize the cost of disinfection as well as maximizing disinfection efficiency while keeping the plant’s budget within reach (Khawaga et al. 2019). However, the degrees of disinfection provided by direct chlorination were comparable to those attained by combining the conventional activated sludge process and chlorine treatment at conventional wastewater treatment plants (Azuma and Hayashi 2021).

In addition, the integrated photocatalytic-biological wastewater treatment systems are effective alternative processes for the removal of emerging pharmaceutical contaminants and pathogens, capable of achieving greater than 99% removal of chemical oxygen demand and nitrogen from the system with total disinfection of 106 colony-forming units/mL E.coli using hydroxyl radicals generated from photocatalysis (Ghosh et al. 2023). Moreover, colony-forming units estimate the number of active and viable microorganisms in a sample. Artificial neural network and adaptive neuro-fuzzy inference system can be used to model the photocatalytic degradation process and mineralization efficiency of pharmaceutical and other organic pollutants while optimizing energy consumption and catalyst dosage for practical pharmaceutical wastewater treatment (Tabatabai-Yazdi et al. 2021).

Overall, we observed that artificial intelligence techniques can monitor complex variations in process conditions and accurately predict the performance of wastewater disinfection characteristics. However, extreme fluctuations in wastewater quality parameters during complex, full-scale disinfection processes, conventional biological wastewater treatment system, and predictive disinfection models may not handle intricate non-linearity issues, and immediate responses to remediate the disinfection level may not be effective. However, hybrid artificial intelligence technologies integrated with robust cyber-security infrastructures, blockchain technology, and distributed network design with the internet of things can facilitate autonomous wastewater treatment processes, reducing undesirable risks caused by incomplete disinfection processes.

Renewable energy

Current researchers rarely consider using renewable energy technologies for pharmaceutical wastewater treatment. Although conventional wastewater treatment plants are designed primarily to remove undissolved and dissolved wastewater, they are crucial in controlling water pollution and offering sanitary engineering. The additional energy generation potential of conventional wastewater treatment plants involves the utilization of digested sewage sludge for incineration, and electricity generation can provide a significant amount of energy and resource recovery (Zahmatkesh et al. 2022).

In addition, the settling properties of activated sludge having a sludge volume index greater than 150 mg/L could be susceptible to sludge bulking, which hinders the operation of the activated sludge process. This process may result in a mass proliferation of filamentous bacteria, impacting the techno-economic feasibility of the pharmaceutical wastewater treatment systems. For this reason, artificial neural network is very effective at simulating the nonlinear processes of sludge bulking, especially in various fluctuating environmental conditions (Deepnarain et al. 2020).

On the contrary, full industrial-scale pharmaceutical wastewater treatment systems comprise different physical, chemical, and biological processes that are highly complex and challenging to model using a linear method. Artificial neural network and multivariate statistics involving principal component analysis can model and extract valuable information by being adaptive and developing self-learning ability to discern the influence of process parameters (Guo et al. 2018; Verma and Suthar 2018). However, traditional principal component analysis is still limited by linear dimensionality reduction (Wang et al. 2019a).

On the other hand, nonlinear projection of principal component analysis can be determined using Gaussian process mapping, but the model lacks robustness and is susceptible to process noise (Wang et al. 2019a). When combined with another artificial intelligence technology, the artificial neural network model can optimize the process parameters for more accurate and robust results than regression-based mathematical models (Deepnarain et al. 2020).

The onsite nutrient recovery process of pharmaceutical wastewater treatment plants in which waste materials can be reused for other industrial purposes is crucial. The control components, such as energy distribution systems and metallurgical phosphorus recycling, can utilize activated sludge from wastewater treatment systems and transform it into energy and mineral products (Zahmatkesh et al. 2022). Artificial intelligence-powered renewable technologies can increase the sustainability of energy use at pharmaceutical wastewater treatment systems and reduce electricity costs or financial expenditure for energy supply.

Onsite renewable energy sources, such as solar, water, wind, and so on, can help minimize energy wastage and greenhouse gas emissions, saving economic costs immensely. Optimization via artificial intelligence can help to reduce the environmental impact of the combined energy systems using genetic algorithm to lessen the effect of carbon dioxide emission on the environment (Hai et al. 2022). However, integrating microgrids with renewable energy technologies and sharing with external grid networks are very challenging due to maintaining optimum power flows in the industry (Fan and Li 2023).

Overall, we observed that direct solar energy-assisted wastewater treatment with energy storage systems makes it convenient during day and night. Still, the installation and maintenance costs to achieve robust system efficiency affect effective renewable energy utilization. The complexity of adapting the existing electricity grid to a distributed energy network to utilize renewable energy resources in pharmaceutical wastewater treatment systems is still in its infancy.

Biological treatment

Artificial intelligence is one of the popular machine learning-based approaches in biological wastewater treatment simulations due to its high level of adaptability and learning strategies. Artificial neural network can be used to model or predict biochemical oxygen demand and total suspended solids in removing activated sludge (Li et al. 2023b). It can also simulate total nitrogen, total phosphorus, and chemical oxygen demand for real-time dynamics of process conditions in wastewater treatment plants (Zaghloul and Achari 2022). However, the training datasets require high computational power and may not apply to small-scale industrial plants.

Unlike artificial neural network, support vector machine provides a unique solution to multiple regression systems to minimize errors while generating extensive computational data to improve model accuracy and predictability. On the other hand, adaptive neuro-fuzzy inference system is a hybrid algorithm that integrates the adaptability and computational power of artificial intelligence with fuzzy logic’s learning ability to manage uncertainty or perturbations in process dynamics (Zaghloul and Achari 2022).

More interestingly, the complexity of data generated from biological processes can be interpreted using the multidimensional non-linearity of adaptive neuro-fuzzy inference system, where the number of fuzzy rules increased exponentially in both functions and number of input parameters. However, the high sensitivity of biomass combined with an array of parameters and frequent changes in influent characteristics can affect the stability of the operation of aerobic granular sludge reactors.

Furthermore, the combination of adaptive neuro-fuzzy inference system and support vector regression to form a two-stage prediction process as separate algorithms can be trained for individual output parameters to provide greater flexibility in tuning the discrepancies in model prediction to minimize errors. Combining machine learning-based models such as feed-forward neural network, support vector machine, and adaptive neuro-fuzzy inference system for benchmarking pharmaceutical wastewater treatment systems has yielded efficient performance.

The additional combination of feed-forward neural network increases the effectiveness of identifying complex problems or patterns using multilayer non-linearity of machine learning tools to examine the input and output parameters (Jana et al. 2022). Moreover, the three layers of feed-forward neural network are trained with the Levenberg–Marquardt algorithm (Jana et al. 2022). The first layer consists of a flattened input vector containing various input parameters.

When combined with the auto-regressive characteristics of predictive modelling, lagged data are integrated into the input vector (Negi et al. 2023). The second layer consists of hidden neurons with nonlinear activation functions (Jariwala et al. 2023). The third layer represents the output vector, which compares the predicted values with input parameters to produce targeted responses (Nourani et al. 2023). Overall, we observed that artificial neural network is prone to computational overload when handling massive datasets, which can be a challenge for wastewater treatment industries to adopt due to limited computational processing power and is primarily hardware dependent.

In addition, Fig. 3 shows the standard feed-forward neural network architecture, which consists of three layers of a computational network. Furthermore, Table 1 shows 1 shows the equations used by researchers who applied various models including the process parameters and criticize each model based on their advantages and disadvantages. Table 2 lists recent work in which error functions were used to calculate and validate the performance of models describing pharmaceutical wastewater treatment systems. These error functions measure the deviation in a digital communication system that uses statistical computations.

Fig. 3
figure 3

Feed-forward neural network architecture involves a number of artificial neural network connections in which the flow of information is between nodes or its layers. The flow is usually in one direction or forward from the input nodes, passing through the hidden nodes to output nodes without any loops or cycles. Feed-forward neural network is trained using Marquardt’s backpropagation method

Table 1 Standard functions of models applicable to pharmaceutical wastewater treatment systems
Table 2 Error functions are used to validate artificial intelligence and machine learning models applicable to pharmaceutical wastewater treatment

Blockchain technology

The convergence of blockchain technologies and artificial intelligence in the internet of things network revolutionized intelligent network design to create sustainable processes (Mao et al. 2023). This means smart grids that use digital technologies can be connected to the network to detect and respond to local change to improve the industry’s energy usage in electricity grids (Chen et al. 2021). When the electricity supply networks are equipped with internet protocol addresses, intelligent meters and energy sensors will relay the data to utility providers with information about energy usage, offering greater control over their energy consumption (Chen et al. 2021).

The emergence of blockchain technologies offers one of the most feasible solutions for decentralizing autonomous energy management in distributed energy systems using a simplified model inversion process of blockchain SM2 encryption by sending verification data of nodes with high energy distribution to improve the computational ability of the distributed energy systems (Wang et al. 2023b).

Conventional decentralized management modes have several drawbacks with respect to the high cost of communication from central controller to individual equipment, leading to single-point failures (Wang et al. 2023b). However, with the advent of new digital technology, the distributed information of blockchain provides a new vitality to the energy management of distributed energy systems. Distributed energy systems improve the permeability and utilization efficiency of renewable energy technologies, leading to high energy efficiency of pharmaceutical wastewater treatment systems.

Overall, we observed that blockchain technology has several limitations due to the scalability of software and hardware infrastructures, data security vulnerabilities, integration complexity, and high energy consumption. Innovative solutions should focus on improving energy efficiency and interoperability with existing systems.

Artificial intelligence-integrated blockchain distributed ledger technology has the potential to become one of the most critical research and development areas in the domain of renewable energy technologies and power automation (Gawusu et al. 2022). Artificial intelligence-integrated blockchain distributed ledger technology can address smart grid-based control management systems, decentralized energy management systems, power distribution, and related mechanical automation to pharmaceutical wastewater treatment plants (Junaidi et al. 2023; Khan et al. 2023).

Most critically, the purpose of combined technologies is to optimize power flow and process conditions to minimize energy consumption, perturbations, noise disturbances and prevent unstable working conditions (Zhu et al. 2023); promote stability, production efficiency; and reduce pollution of an industrial process using a local outlier factor-based abnormality detection logic to measure prediction statistical error (Feng et al. 2022).

The purpose of involving network reconfiguration of distributed systems is to facilitate the real-time operation of process dynamic conditions (Mishra et al. 2023), integration of cyber-physical security into software and hardware infrastructures to protect privacy and prevent external network infiltration and improve auto-generation of process control systems (Li et al. 2023a; Liu et al. 2022). Artificial intelligence-based data analysis and evolutionary learning mechanisms can diagnose water quality, facilitating autonomous decision-making and process optimization with a strong potential to establish predictive model analysis and universal process control (Li et al. 2021).

More interestingly, dynamic monitoring and controlling of smart grid technology can optimize the renewable energy used to power automation in pharmaceutical wastewater treatment plants, enabling machine learning developments and customizing executions of operational parameters to produce desired responses by screening and adjusting process parameters (Johnson et al. 2022). Integrating artificial intelligence with a power distribution network can create a real-time generation of process conditions, logistical distribution of pharmaceutical wastes by transportation, and monitoring electric power supply to facilitate wastewater treatment processes.

In remote regions, the field programmable gate array-based embedded internet of things system is one of the most preferred systems beneficial for optimizing wastewater treatment plants and leveraging logistics flow to improve the sludge management process in the future (Ding et al. 2021; Henriques et al. 2020). In addition, artificial intelligence technology in electrical automation provides fault diagnosis and troubleshooting of the process conditions, electrical control system, and electrical equipment and facilitates daily operation (Yang 2020).

In electrical process diagnosis, expert system, artificial neural network, and adaptive neuro-fuzzy inference system are three common methods of fault diagnosis, producing accurate detection results (Yang 2020). However, the main disadvantages of using artificial neural network optimization are a greater computational burden, susceptibility to overfitting, and empirical nature of the model development with minimalistic approach (Świetlicka and Kolanowski 2023). However, the existing ledger management of power distribution systems for wastewater treatment plants utilizes smart grid technology to deliver cloud scalability, optimize management, and minimize redundancy.

Integrating artificial intelligence and machine learning technologies improves data distribution efficiency and transmission across different networks, operational management, and privacy security (Khan et al. 2023). However, the most significant challenges of integrating the internet of things and blockchain technology into artificial intelligence and machine learning are related to financial, technical, environmental, organizational, and legal issues. These identified challenges are cyber-security, privacy, smart contract, trusted oracles, scalability, interoperability, lack of standardized structure, regulatory constraints, governance, fog computing, and so on (Tanha et al. 2022).

The convergence of blockchain technology, internet of things, artificial intelligence, and machine learning algorithms into cyber-security systems synergistically enhances trust, transparency, privacy, and cyber-security of overall operational systems in pharmaceutical wastewater treatment systems by providing a shared and decentralized distributed ledger (Xia et al. 2022). A blockchain technology, generally known as a distributed ledger, can store all information or data related to industry assets like a register (Thakur 2022). These data are primarily related to money and identities.

Integrating artificial intelligence and machine learning algorithms with the internet of things automates process dynamics within pharmaceutical wastewater treatment systems and related industrial networks, improving user-friendliness of business processes, which are essential for wastewater and water treatment industries (Sandner et al. 2020).

By the integration of artificial intelligence and machine learning into cyber-physical systems or its related information security infrastructure, the overall systems enhance pattern recognition, online transaction networks, supply chain management, troubleshoot information security vulnerabilities, and optimize outcomes of the wastewater treatment processes (Clark and Burstall 2018; Fernández-Caramés and Fraga-Lamas 2022; Sandner et al. 2020). In addition, Fig. 4 represents an artificial intelligence-enabled smart grid distribution network that integrates renewable energy technology, such as solar power to achieve energy efficiency and sustainability.

Fig. 4
figure 4

Artificial intelligence-enabled smart grid distribution network for integrating renewable energy technology in pharmaceutical wastewater treatment plants to achieve process sustainability and decentralize energy management systems. This smart grid integrates energy distribution and digital communication technology to exchange two-way flow of electricity and energy usage data, offering personalized information related to the optimization of distributed energy systems and power outages or process equipment failures that impact the overall reliability of pharmaceutical wastewater treatment systems. Various electronic devices such as data concentrators, gateways, feeder meters, and aggregation meters can process data from parts of the smart grids such as consumption points, secondary substations, and so on. It helps to streamline the energy forecast across the grids to connect renewable energy technologies to large-scale pharmaceutical wastewater treatment plants

Overall, we observed that integrating artificial intelligence technologies in automation may help improve data analytics. Still, implementation costs are expensive and require specialized knowledge, system interoperability, and complex computational resources.

Big data

Water quality in pharmaceutical wastewater treatment plants can be optimized before discharging the effluents into the environment. The involvement of simulation models for examination of wastewater quality can be performed using databases, harmonic function, phenomenological methods, and benchmark simulation models, traditionally used to predict the behaviour and fate of wastewater constituents (Ly et al. 2022). Comprehensive knowledge and sophisticated control systems are required to facilitate model calibration and validation, making the control process a major disadvantage.

Machine learning can predict various water-related variables and wastewater constituents, unlike traditional approaches. It does not require expert knowledge to operate. It can handle and analyse large datasets and requires less processing power. In addition, complex, nonlinear variables of wastewater quality parameters can be modelled using computed autoregressive integrated moving average to forecast the levels of nitrogen, biochemical oxygen demand, chemical oxygen demand, phosphorus, ammonia, total suspended solids with relatively high accuracy ranging between 71 and 97% for the training data and low prediction errors less than 9% for the testing data (Ly et al. 2022).

Other machine learning algorithms such as random forest, support vector machine, long short-term memory, gradient tree boosting, adaptive neuro-fuzzy inference system, and so on all forming parts of deep learning architectures can be used to forecast and perform extensive data analysis of wastewater quality and its constituents. Artificial neural network and genetic algorithms can model pharmaceutical wastewater treatment systems for advanced oxidation processes to predict the operational parameters involving three-step processes such as acidification, adsorption, and photocatalysis to solve wastewater composition (Yang et al. 2021).

Data mining techniques such as artificial neural network and M5 tree model can be used to analyse a range of datasets due to its reliability, robustness, and high generalization ability to achieve a coefficient of determination greater than 0.90 for forecasting biochemical oxygen demand, chemical oxygen demand, and total suspended solids (Asami et al. 2021). However, using photocatalytic approaches has numerous limitations, such as lengthy procedures and impractically large amounts of wastewater treatment catalysts with limited resource recovery process.

The integration of sonolysis with photocatalysis could benefit the environmental remediation, maximizing the catalyst surface area and rapidly improving the production of free radicals to degrade toxic organic pollutants in pharmaceutical wastewater (Theerthagiri et al. 2021). On the other hand, the electrocatalytic reduction of nitrogenous compounds, such as nitrate waste into ammonia, facilitates rapid removal of toxic nitrate contaminants and forming an alternative production of ammonia with secondary benefit compared to conventional Haber–Bosch process (Theerthagiri et al. 2022b).

For the advancement of photo- and electrocatalytic technologies, a fabricated electrochemical sensor based on novel zinc sulphate/gold/multi-walled carbon nanotube nanocomposites can be integrated into the process control system using big data mining technique in pharmaceutical wastewater treatment systems to improve the sensitivity of detection on toxic organic nitrogenous pollutant, which is part of human metabolites produced from the breakdown of pharmaceutical ingredients and strengthening process analytics of wastewater quality (Naik et al. 2021).

The future design and fabrication of innovative pulsed laser-assisted technologies can improve structural optimization of electrochemical sensors with electrocatalytic performance in various renewable energy and environmental remediation processes (Theerthagiri et al. 2022a). In addition, pulsed laser irradiation technologies can dechlorinate persistent organic pollutants containing chlorine-based compounds, which are by-products widely generated in industrial production (Yu et al. 2021).

Overall, we observed that data analytics processes can revolutionize wastewater treatment technologies, but operation and maintenance costs are high. Compliance concerns are also associated with reporting errors in the systems, stability of operational systems, data security vulnerabilities, data acquisition, and interoperability of existing systems.

Cyber-physical systems

The increasing interconnections and interdependencies between cyber-security systems, physical assets, humans, and environment resulted in rapid evolution of pharmaceutical wastewater treatment systems (Mohebbi et al. 2020). Technological innovation and advancement in pharmaceutical technology, environmental sustainability, economic and regulatory factors all influence wastewater treatment systems (Cui 2021).

In addition, cyber-physical framework provides an integrated approach to facilitate efficient management of technologies, improving precision in detecting wastewater constituents and optimizing output variables. Adaptable digital solutions can help various stakeholders understand the effect of pharmaceutical wastewater quality on public health and improve water governance by promoting social awareness and collaboration between wastewater treatment industries and citizens (Alexandra et al. 2023; Radini et al. 2021).

On the other hand, maintenance of cyber-physical systems in modern pharmaceutical wastewater treatment plants requires improving the cyber-resilience of information security infrastructure to complement a traditional physical resilience assessment (Colabianchi et al. 2021; Patriarca et al. 2022). To address the level of resilience, stochastic cyber-resilience metrics must be proposed and computed to assess the impact of cyber-attacks on information technology infrastructure to uncover the vulnerability of the industrial control systems and its distributed networks (Avraam et al. 2023; Chaves et al. 2017; Li et al. 2023c; Yang et al. 2022).

More critically, challenges arise from ageing information technology infrastructure, environmental impact, and sustainability of pharmaceutical wastewater treatment systems require improvement in data management, analytics and cyber-security systems, requiring knowledge and skills of experts to satisfy regulatory compliance and governmental requirements as well as supporting the decision-making process of various stakeholders (Bhandari et al. 2023).

Understanding the evolutionary process and its influences on pharmaceutical wastewater infrastructure and characteristics affects the quality of water and sanitation services, which drive socio-economic changes in industrial wastewater treatment systems. New strategies must be developed to solve health-related problems arising from pharmaceutical water pollution (Foglia et al. 2021).

Physical assets in wastewater treatment industries that involve various water infrastructures, such as hydraulic pumps, network analysis of processes, optimization of water distribution, and output variables, can influence the progression of wastewater infrastructure development.

Various stakeholders must be involved in the planning and decision-making process when configuring the cyber-physical systems of industrial wastewater treatment processes, with responsibilities assigned to federal and local governments to manage water resources and deliver sanitary drinking water and clean wastewater for public and agricultural uses (Hasan et al. 2023).

The rapid transformation of digital technology used in cyber-physical systems improves the techno-economy of wastewater treatment services, enabling the decision-making process using internet of things and assisting industry professionals to achieve a new paradigm of water resources management (Song et al. 2023).

Figure 5 outlines the evaluation criteria for appraising the artificial intelligence and machine learning-based optimization technologies recommended for pharmaceutical wastewater treatment systems. It shows a specific framework related to evolutionary artificial intelligence technologies that can be implemented into pharmaceutical wastewater treatment systems to satisfy industry standards.

Fig. 5
figure 5

Evaluation criteria for critical appraisal of artificial intelligence and machine learning technologies recommended for use in wastewater treatment systems. These evaluation criteria form the rubric for artificial intelligence tool evaluation to provide a framework for assessing the artificial intelligence tools based on a set of criteria, including interoperability, functionality, compatibility, and so on. Critical process involves the rigorous assessment of data quality and model performance, including predictive accuracy and process control capabilities. The top hierarchy represents the most critical component of artificial intelligence tool: autonomous operation, process efficiency, and technical efficiency. Last but not least, the bottommost layer in the pyramid is also important for any artificial intelligence integration into the wastewater treatment industries, but the regulatory frameworks and industry standards may differ worldwide

In addition, Fig. 6 shows a structured analysis of various artificial intelligence and machine learning approaches and their suitability for addressing specific challenges encountered in pharmaceutical wastewater treatment systems. Additionally, Table 3 critically evaluates the evolutionary characteristics of the pharmaceutical wastewater treatment systems from multidimensional perspectives. Furthermore, Table 4 critically evaluates the findings of different artificial intelligence and machine learning optimization techniques, supporting the empirical evidence with an interpretation to address the research deficiencies and outcomes.

Fig. 6
figure 6

A structured analysis of various artificial intelligence and machine learning approaches and their suitability for specific challenges within pharmaceutical wastewater treatment systems to facilitate autonomous process control systems and global optimization of wastewater quality characteristics and other operational conditions. The top pedigree represents the main category of algorithm in which supervised learning involves a formula generation based on input and output values. It uses labelled training datasets, whereas unsupervised learning does not. Reinforcement learning trains software to make decisions and generate the most optimal solutions. Under all subcategory of learning algorithms, clustering is the most common one. Clustering is used to detect anomalies and outliers in the dataset. Classification algorithms determine the category of an entity, object, or event in a given dataset

Table 3 Evolutionary characteristics of pharmaceutical wastewater treatment systems and multidimensional changes involving the amalgamation of technologies such as artificial intelligence, blockchain, internet of things, and cyber-physical systems
Table 4 Systematic analysis of different artificial intelligence and/or machine learning optimization techniques, critically appraising the deficiencies and efficiencies of various artificial intelligence technologies and its impact on the optimization efficiencies

Overall, we observed that data security vulnerabilities are significant issues due to difficulty authenticating the information data in automated systems. Coordinated cyber-attacks on critical infrastructures and industrial control systems can affect community service availability. More efficient and robust solutions are required to form a new ecosystem that involves cyber-physical systems combined with the internet of things to operate a massive and complex wastewater treatment system.

Conclusion

Sustainability of pharmaceutical wastewater treatment systems is increasingly critical in the modern world. Integrating artificial intelligence and machine learning-based models can potentially revolutionize the wastewater sectors, including public health and environment. In particular, managing wastewater quality and optimizing process parameters using artificial intelligence technologies help achieve the best removal rate of pharmaceutical pollutants to minimize the likelihood of pathogen transmission and spread of viral vectors and antimicrobial resistance genes in complex pharmaceutical wastewater environments.

Effective monitoring process dynamic conditions demand advanced process control systems to manage water resources. The application of blockchain-related technologies towards sustainable wastewater and energy management should be extended to both metropolitan and rural areas, but further technological investigation, cost, and carbon footprint assessment should be conducted to evaluate the techno-economic and financial viability of such technologies.

The technological capabilities of internet of things and cutting-edge cyber-physical systems in the digital economy to integrate decision-making processes should be incorporated into wastewater treatment industries to promote intelligent waste transportation systems, minimize carbon footprint, and remove barriers to resource recovery and energy management processes. Several points of summary for future directions are outlined as follows:

  1. (1)

    Artificial intelligence and machine learning approaches are applied to develop predictive models for monitoring pharmaceutical wastewater quality and its constituents in complex wastewater matrices.

  2. (2)

    Minimization of operational cost and improvement in energy efficiency of pharmaceutical wastewater treatment systems require the integration of artificial intelligence technologies.

  3. (3)

    Predictive control of various contaminants, including viral vectors, antimicrobial resistance genes, severe acute respiratory syndrome coronavirus 2, water quality parameters, chemical oxygen demand, biochemical oxygen demand, phosphorus and other organics or nutrient removal, is crucial for future research.

  4. (4)

    Sanitation and disinfection services are critical for pharmaceutical wastewater treatment systems, and emerging artificial intelligence technologies should be used to optimize renewable energy, process control systems, and wastewater treatment processes.

  5. (5)

    Comprehensive models involving socio-economic, governmental, environmental, techno-economic, technological innovation, and so on require thorough investigation when designing pharmaceutical wastewater treatment systems.

  6. (6)

    Advancements in cyber-physical systems can increase sensitivity for fault detection, troubleshoot technical issues, improve diagnosis and prognosis of vulnerability in information technology infrastructure, and help maintain distributed networks of pharmaceutical wastewater treatment systems.

  7. (7)

    Different approaches should be implemented to identify and analyse vulnerabilities and risks in information technology infrastructure, but identification of complex dynamic behaviours, uncertainties, or perturbations in complex process control systems and data management processes in pharmaceutical wastewater treatment systems requires artificial intelligence technologies. Standardization of frameworks and assessment metrics will assist in computing efficiency, improving the reliability and performance of pharmaceutical wastewater treatment technologies.