Development of an Optical Method to Monitor Nitrification in Drinking Water

Nitrification is a common issue observed in chloraminated drinking water distribution systems, resulting in the undesirable loss of monochloramine (NH2Cl) residual. The decay of monochloramine releases ammonia (NH3), which is converted to nitrite (NO2−) and nitrate (NO3−) through a biological oxidation process. During the course of monochloramine decay and the production of nitrite and nitrate, the spectral fingerprint is observed to change within the wavelength region sensitive to these species. In addition, chloraminated drinking water will contain natural organic matter (NOM), which also has a spectral fingerprint. To assess the nitrification status, the combined nitrate and nitrite absorbance fingerprint was isolated from the total spectra. A novel method is proposed here to isolate their spectra and estimate their combined concentration. The spectral fingerprint of pure monochloramine solution at different concentrations indicated that the absorbance difference between two concentrations at a specific wavelength can be related to other wavelengths by a linear function. It is assumed that the absorbance reduction in drinking water spectra due to monochloramine decay will follow a similar pattern as in ultrapure water. Based on this criteria, combined nitrate and nitrite spectra were isolated from the total spectrum. A machine learning model was developed using the support vector regression (SVR) algorithm to relate the spectral features of pure nitrate and nitrite with their concentrations. The model was used to predict the combined nitrate and nitrite concentration for a number of test samples. Out of these samples, the nitrified sample showed an increasing trend of combined nitrate and nitrite productions. The predicted values were matched with the observed concentrations, and the level of precision by the method was ± 0.01 mg-N L−1. This method can be implemented in chloraminated distribution systems to monitor and manage nitrification.


Introduction
Nitrate (NO 3 − ) and nitrite (NO 2 − ) ions are the most common forms of inorganic nitrogen found in environmental samples [1,2]. The abundance and distribution of these species in surface water are often characterized by hydrological regime, seasonal changes, spatial and temporal variability, and the mode and nature of the nutrient sources [1]. They are regulated pollutants, and drinking water treatment may be required to reduce their level within the regulated limits. Nitrification is a common issue observed in drinking water disinfected by monochloramine (NH 2 Cl) [3,4]. This is a microbiological process where free ammonia (NH 3 ), released through monochloramine decomposition, is converted to nitrite and nitrate by nitrifying bacteria, resulting in elevated concentrations of these species in water [3,5]. Drinking water containing high levels of nitrate and nitrite may pose threats to public health. The World Health Organization suggests that the maximum contaminant level (MCL) of nitrate and nitrite in drinking water should not exceed 11.3 mg L −1 as When a chloraminated sample undergoes nitrification, significant changes in various water quality parameters are evident [3,4]. This includes a decrease in monochloramine concentration, an increase in NO x − production, and an initial increase of ammonia concentration followed by a decrease. The water quality change suggests that the method needs to be sensitive, such that changes in NO x − and monochloramine as a result of nitrification can be detected. Theoretically, the NOM concentration, measured as dissolved organic carbon (DOC), should also change. However, the change of DOC concentration over time is relatively slow and small in magnitude, whereas ammonia has little or no UV absorbances under the typical range of concentration found in drinking water. Hence, the contribution of NOM and ammonia to change the spectra can be ignored. When no monochloramine residual is left in water, the NO x − production between two timestamps, t = 0 and t = t, is related to the NO x − spectra, which can be simply obtained by subtracting the spectra at t = 0 from the spectra at t = t. However, if there is monochloramine residual left in water, the spectra difference between two timestamps does not represent the whole NO x − spectra, as monochloramine has absorbance within the range absorbed by NO x − species. In this case, an additional spectral compensation is required to modify the spectra interfered by monochloramine absorbances. This study proposes such a spectral compensation to account the monochloramine absorbance, based on the behavior of pure monochloramine spectra. Hence, the objectives of this study are: (i) to isolate the NO x − spectra from the total spectra; and (ii) to determine the NO x − concentrations using standard data analytic techniques. This method works on determining the relative NO x − production between two timestamps, hence, it is suitable to use when there is no additional information of lab NO x − is available. This is a novel method, as no previous studies offer a similar approach to what is proposed in this paper. Hence, this paper provides a significant new knowledge contribution to manage nitrification in drinking water systems.

Analytical Methods
Turbidity was measured using a Hach TU5200 turbidimeter (Hach, Loveland, CO, USA), and the measurement was obtained as nephelometric turbidity units (NTU). pH and temperature were measured using a portable pH meter (pH320, WTW, Weilheim, Germany). Free chlorine, monochloramine, and dichloramine were determined using the N,N-diethyl-p-phenylenediamine (DPD)-ferrous ammonium sulfate (FAS) titrimetric procedure (APHA 4500-CI-F) [26]. UV-Vis absorbance was measured using an Evolution 300 spectrophotometer (Thermo Scientific, Waltham, MA, USA) through a 10 cm quartz cell. This is a double beam spectrophotometer capable of acquiring spectra from 200 nm to 800 nm. The data resolution was set to 0.5 nm. Samples were prepared for spectral analysis by filtering them through 0.45 µm filter paper in order to remove the particle absorbances. The DOC concentration was measured using a Sievers M5310C Total Organic Carbon (TOC) analyzer fitted with an auto sampler (GE Analytical Instruments, Boulder, CO, USA). The dissolved species were defined by those that could pass through the 0.45 µm filter paper. Ammonia concentration was measured using the ion-selective ammonia electrode method (APHA 4500-NH 3 -D) [26]. Nitrate and nitrite were determined by the automated flow colorimetry method (APHA 4500-NO 3 -I) [26].

Research Methodology
The systematic procedure adopted in the research is presented in Figure 1. The study tested water samples from the Tailem Bend to Keith drinking water distribution system located in South Australia. Grab samples were collected from two different locations. The first location was the Tailem Bend water treatment plant (TB-WTP) (postchloraminated water), and the second was a location in the distribution system that had experienced rapid chloramine decay and nitrification several times in the past years. Using the collected waters, six different samples were prepared. Sample1 and Sample4 were made up by the original water from these locations, whereas Sample2 and Sample5 were obtained by filtering the original waters through 0.22 µm filter paper. The purpose of the filtering was to remove a portion of microbes/nitrifying bacteria, in order to limit the nitrate and nitrite production. Sample3 and Sample6 were prepared to enhance the microbiological activity by adding the previously obtained 0.22 µm filter retained materials and 0.8 mg L −1 of NH 3 -N. Bacteria was retrieved from the filter by simply rinsing the filter paper with the sample water. The test strategy covers wide variations in water characteristics, allowing different levels of nitrate and nitrite accumulation during the course of the study. The whole sampling strategy is presented in Figure 2. The study tested water samples from the Tailem Bend to Keith drinking water distribution system located in South Australia. Grab samples were collected from two different locations. The first location was the Tailem Bend water treatment plant (TB-WTP) (postchloraminated water), and the second was a location in the distribution system that had experienced rapid chloramine decay and nitrification several times in the past years. Using the collected waters, six different samples were prepared. Sample1 and Sample4 were made up by the original water from these locations, whereas Sample2 and Sample5 were obtained by filtering the original waters through 0.22 μm filter paper. The purpose of the filtering was to remove a portion of microbes/nitrifying bacteria, in order to limit the nitrate and nitrite production. Sample3 and Sample6 were prepared to enhance the microbiological activity by adding the previously obtained 0.22 μm filter retained materials and 0.8 mg L −1 of NH3-N. Bacteria was retrieved from the filter by simply rinsing the filter paper with the sample water. The test strategy covers wide variations in water characteristics, allowing different levels of nitrate and nitrite accumulation during the course of the study. The whole sampling strategy is presented in Figure 2. The samples were kept in a dark place under normal room temperature. The spectra of these samples were recorded for several weeks. At the same time, various water quality parameters, such as monochloramine, dichloramine, free ammonia, DOC, nitrate, nitrite,  The samples were kept in a dark place under normal room temperature. The spectra of these samples were recorded for several weeks. At the same time, various water quality parameters, such as monochloramine, dichloramine, free ammonia, DOC, nitrate, nitrite, etc., were also analyzed on a regular basis. For each sample, the first spectra (t = 0) were considered as baseline, and are represented by S 0 . It has been reported that monochloramine has a UV absorbance peak at 245 nm [14,27]. Therefore, due to monochloramine decay, the spectra will shift downward from the baseline, with maximum offset at the peak. For modelling purposes, the criteria to find a suitable offset was defined by (i) maximum offset and (ii) minimum nitrate and nitrite absorbances. The maximum offset will minimize the error when using it as a model predictor, whereas minimum nitrate and nitrite absorbances will ensure the calculation of the true variation of spectra due to monochloramine decay only. Data analysis suggests that an offset at 245 nm satisfy both criteria. In parallel, the monochloramine decay will produce ammonia, which may further undergo microbiological reactions to produce nitrite and nitrate. Both of the nitrogen species have high UV absorbance between 200 nm and 230 nm. Consequently, the spectra will shift upward from the baseline. Hence, the recorded spectra at any time t, referred to as S t , is characterized by the absorbance contribution by NOM, monochloramine, and NO x − . The term NO x − spectra refers to the combined nitrate and nitrite spectra. To isolate the NO x − spectra from S t , it is required to approximate the spectra at time t due to monochloramine decay only, referred to as S NOM+NH 2 Cl . This was done by investigating the monochloramine concentration absorbance relationship of all wavelengths to 245 nm in ultrapure water. Figure 3 shows the procedure where the value of ∆ 245 is known, whereas its values for other wavelengths (∆ i ) need to be estimated to calculate the spectra at time t resulting from monochloramine decay only.  To assess the spectral characteristics of pure monochloramine, a standard solution at a concentration of 10 mg L −1 was prepared using ultrapure water (Millipore, Molsheim, France). Through successive dilution, a range of monochloramine solutions of concentration, ranging from 0.2 mg L −1 to 5 mg L −1 , were prepared, and their corresponding spectra were recorded. Linear models were used to relate the spectra differences at 245 nm (∆245,ultrapure) with the spectra differences at other wavelengths (∆i,ultrapure). The relationship between ∆245,ultrapure and ∆i,ultrapure was investigated at three different pH of 7, 8, 9, and was found to not change significantly within that pH range. The regression function can be expressed by the following equation: where ∆ , is the set of monochloramine spectra differences between various concentrations at 245 nm in Milli-Q water, and ∆ , is the set of corresponding spectra differences at the i th wavelength. The value of i ranges from 200 nm to 244.5 nm, as the spectra recording resolution was set to 0.5 nm.
It was assumed that chloraminated drinking water will follow the same ∆i pattern as in Milli-Q water. Therefore, these models were used to predict the ∆ , values with To assess the spectral characteristics of pure monochloramine, a standard solution at a concentration of 10 mg L −1 was prepared using ultrapure water (Millipore, Molsheim, France). Through successive dilution, a range of monochloramine solutions of concentration, ranging from 0.2 mg L −1 to 5 mg L −1 , were prepared, and their corresponding spectra were recorded. Linear models were used to relate the spectra differences at 245 nm (∆ 245,ultrapure ) with the spectra differences at other wavelengths (∆ i,ultrapure ). The relationship between ∆ 245,ultrapure and ∆ i,ultrapure was investigated at three different pH of 7, 8, 9, and was found to not change significantly within that pH range. The regression function can be expressed by the following equation: where ∆ 245, ultrapure is the set of monochloramine spectra differences between various concentrations at 245 nm in Milli-Q water, and ∆ i, ultrapure is the set of corresponding spectra differences at the i th wavelength. The value of i ranges from 200 nm to 244.5 nm, as the spectra recording resolution was set to 0.5 nm. It was assumed that chloraminated drinking water will follow the same ∆ i pattern as in Milli-Q water. Therefore, these models were used to predict the ∆ i, sample values with ∆ 245, sample being predictors. These predicted ∆ i values were subtracted from the baseline to approximate the spectra caused by the monochloramine decay effect only (S NOM+NH 2 Cl ). This estimated S NOM+NH 2 Cl spectra do not include the absorbances by the NO x − component. It should be noted that NOM may have some minor changes in concentrations during the time t, and can affect the S NOM+NH 2 Cl spectra. However, DOC analysis suggests that NOM concentration is relatively stable compared to monochloramine, and the subsequent effect can be ignored. Further, subtracting the S NOM+NH 2 Cl spectra from the sample spectra at time t, S t will give the NO x − spectra. To extract the combined nitrate and nitrite concentrations from the NO x − spectra, standard light absorbances by these species in ultrapure water need to be assessed. For this purpose, standard solutions were prepared. A nitrate standard solution at a concentration of 100 mg L −1 as NO 3 − -N was prepared by dissolving 0.7218 gm dry potassium nitrate (KNO 3 ) to ultrapure water, and diluted to 1000 mL. Similarly, a nitrite standard solution (100 mg L −1 as NO 2 − -N) was prepared by dissolving 0.15 gm of sodium nitrite (NaNO 2 ) to Milli-Q water, and diluted to 1000 mL. From these standard solutions, different concentrations of nitrate and nitrite solutions were prepared using appropriate dilution factors.
The NO x − spectra and the known nitrate and nitrite concentrations data were used to develop a machine learning model using the support vector regression (SVR) algorithm. Absorbances at various wavelengths were considered as predictor variables, whereas the corresponding concentrations were assumed to be the response variables. The theory and application of the SVR algorithm is available in many pieces of literature [14,28,29]. In brief, the SVR algorithm is an extension of the support vector classification (SVC), where a hyperplane is defined to classify two classes of data. From both sides of the hyperplane, an epsilon(ε) range is assigned where the regression function is considered to be insensitive. The support vectors are the data points closer to the hyperplane. For a multi-class classification problem, the SVC algorithm uses a series of binary classifiers to perform the classification. If the hyperplane cannot separate the data linearly, SVC uses a kernel trick to transform the data into higher dimensions where a linear separation exists. The four major types of kernel functions commonly used in the SVR algorithm are: (i) linear; (ii) polynomial, (iii) radial basis function (RBF); and (iv) sigmoid. The accuracy of the SVR model can be improved by tuning the model parameters and choosing the appropriate kernel function. The SVR model training performance was validated using a 10-fold cross-validation. Data were scaled in between +1 and -1 to ensure the SVR convergence. The goodness-of-fit in model training and cross-validation were assessed using the coefficient of determination (R 2 ) and root mean square error (RMSE). They were calculated by the following formulae: where O i and P i are the observed and predicted values of the NO x − concentrations, respectively, n is the number of data points, and O and P are the observed and predicted mean values. The value of R 2 lies between 0 to 1, where 1 indicates that the model can describe 100% of the variation in the data. In contrast, 0 means that model prediction is not any better than the mean of the data [30,31]. The value of RMSE indicates how widely the residuals (difference between the modelled and the observed data) disperse. A relatively low RMSE value indicates a better fit [30,31].
Finally, the developed SVR model was used to predict the relative NO x − concentrations in several test samples using their isolated NO x − spectra. A local calibration was done to improve the NO x − estimation accuracy. In the local calibration, a linear/non-linear relationship is developed between the observed lab data and the model predicted values.

Results
The average water quality parameters at the TB-WTP and the selected location of the distribution system (Meningie) are presented in Table 1. These values were obtained through grab sample analysis at the laboratory. Table 1. The average value (mean ± 1 SD) of water quality parameters at the TB-WTP and the studied points in the distribution system.

Water Quality Variables TB-WTP Meningie
As shown in Table 1, most water quality parameters, including pH, turbidity, DOC, free chlorine and dichloramine concentrations, are similar at both locations. However, monochloramine, free ammonia and NO x − concentrations vary significantly. For instance, the typical monochloramine concentration at the WTP is 4.10 ± 0.30 mg L −1 , whereas at Meningie, the concentration drops to 1.60 ± 1.0 mg L −1 . A significant amount of monochloramine residual is lost along the way to Meningie. At the same time, free ammonia and NO x − concentrations at Meningie also increased. Decreased monochloramine residual and increased free ammonia and NO x − concentrations show the incidences of nitrification at Meningie several times in the past years.
The typical monochloramine spectra presented in Figure 4a shows the UV absorbances in Milli-Q water of up to 300 nm for concentrations ranging from 0.2 mg L −1 to 5.0 mg L −1 . Water utilities usually practice chloramination within that range. The remaining region of the spectra is relatively flat and not shown. The peak absorption appeared at 245 nm wavelength, which aligns with many previous studies [14,27]. For all concentrations tested, the spectra were very symmetric, with a high correlation between concentrations and absorbances at 245 nm wavelength observed. For the formation of monochloramine in Milli-Q water, the pH was initially adjusted to 9 to minimize the formation of dichloramine, as a relatively high pH can potentially reduce the dichloramine formation [32,33]. Consequently, the interference by the dichloramine spectra was the minimum. A relatively high pH value also ensured no significant monochloramine autodecomposition occurred during the course of the experiment [32]. After chloramination, the measured dichloramine concentration was less than 0.1 mg L −1 . Therefore, the spectra obtained were assumed to be the pure monochloramine spectra without any significant interference by dichloramine. As the pH of chloraminated drinking water samples can vary throughout the distribution system, the pure monochloramine spectra were also investigated for two other pH of 8 and 7. Using the spectral data at various pH combinations allows a reliable estimate to be determined for a range of values at an unknown pH. However, no significant differences were found in absorbance spectra between pH values of 7 and 9. dichloramine. As the pH of chloraminated drinking water samples can vary throughout the distribution system, the pure monochloramine spectra were also investigated for two other pH of 8 and 7. Using the spectral data at various pH combinations allows a reliable estimate to be determined for a range of values at an unknown pH. However, no significant differences were found in absorbance spectra between pH values of 7 and 9. As can be seen in Figure 4a, the spectra are very symmetric about the concentrations, hence, the absorbance differences (∆I,ultrapure) for two different monochloramine concentra- As can be seen in Figure 4a, the spectra are very symmetric about the concentrations, hence, the absorbance differences (∆ I,ultrapure ) for two different monochloramine concentrations at various wavelengths can be related to each other by some functions. Newly composed R programming codes were used to calculate ∆ i,ultrapure for all possible combinations of concentrations at each wavelength from 200 nm to 245 nm. The wavelength 245 nm was chosen because monochloramine peak absorption wavelength approximately appears at 245 nm, hence, maximum absorbance difference (∆ max ) is expected at that wavelength (∆ max,ultrapure = ∆ 245,ultrapure ). Therefore, expressing ∆ i,ultrapure as a function of ∆ 245,ultrapure will encounter a relatively lower error in regression. Moreover, typical nitrate and nitrite spectra do not have significant UV absorbances beyond 245 nm. The relationship between ∆ i,ultrapure and ∆ 245,ultrapure can be determined by plotting these data and fitting the standard trend line. Figure 4b shows the plot of ∆ i,ultrapure against ∆ 245,ultrapure at many intermediate wavelengths from 240 nm to 200 nm with a 5 nm increment. The trend lines in these plots indicate that there is a linear association between ∆ i,ultrapure and ∆ 245,ultrapure . Figure 4c shows the R 2 and RMSE values in the linear model fit, where it is evident that the value of R 2 gradually improved, and RMSE decreased towards 245 nm. The lowest R 2 obtained in the linear model fit was greater than 0.93, which indicates that the variable ∆ 245,ultrapure can adequately predict the ∆ i,ultrapure with a good level of accuracy. The full range of R 2 and RMSE values between 200 nm and 244.5 nm is presented in Table A1 in Appendix A.
The recorded spectra for samples1-6 during a period of eight weeks is shown in Figure 5. For each sample, the initial spectra (t = 0) were considered as baseline. As can be seen in Figure 5, the absorbances at 245 nm decreased in all samples over time due to monochloramine decay, whereas it increased between 200 nm and 225 nm due to nitrate and nitrite productions. All sample spectra intersect their baseline spectra at approximately 220 nm, which also indicated that, except monochloramine, there are absorbances by other species involved in the spectra, which was nitrate and nitrite. Due to the monochloramine decay effect, the whole spectra will shift proportionally downward throughout 200 nm to 245 nm, and will not cross the baseline. The highest variability in spectral configuration was found in the enhanced samples (Sample3 and Sample6). The starting monochloramine concentration of these samples were 4.3 mg L −1 at the TB-WTP site (Samples1-3) and Sensors 2021, 21, 7525 9 of 18 1.3 mg L −1 at the Meningie site (Samples4-6), respectively. Nitrification was observed in Sample6, where a significant increase in UV absorbance was evident. It is possible that Sample3 did not experience nitrification because its initial monochloramine concentration was relatively higher compared to that of Sample6. Thus, the microbial inactivation rate by monochloramine was also much higher compared to their growth rate. On the other hand, Sample4 and Sample5 have near similar spectral changes around the 245 nm region, but different level of changes in between 200 nm and 225 nm, indicating different levels of NO x − productions in these samples. This suggests that NO x − production is related to a number of factors, including initially available ammonia, the production of additional ammonia through monochloramine decomposition, and the rate of ammonia conversion to NO x − . With regard to the baseline, the absorbance difference at 245 nm wavelength, ∆245, sample, was calculated for each sample, which was then used to predict the ∆i, sample values using the linear functions between ∆245, ultrapure and ∆i, ultrapure. This produces a dataset of n-1 sets of ∆200-245 values for n number of spectra at each sample. These estimated ∆i, sample values were subtracted from their baseline values to estimate the spectra change caused by the monochloramine decay only. Figure 6 shows the estimated spectra for the six samples, where the topmost spectra are the baseline. It is evident in the figure that spectra sets in Samples 1-3 (Figure 6a-c) have much downward shift compared to that observed in Samples 3-6 ( Figure 6d-f). This is because initial monochloramine concentration of Samples1-3 was much higher compared to Samples 3-6, hence, more absorbance reduction occurred in these samples because of monochloramine decay during the study period. With regard to the baseline, the absorbance difference at 245 nm wavelength, ∆ 245, sample , was calculated for each sample, which was then used to predict the ∆ i, sample values using the linear functions between ∆ 245, ultrapure and ∆ i, ultrapure . This produces a dataset of n − 1 sets of ∆ 200-245 values for n number of spectra at each sample. These estimated ∆ i, sample values were subtracted from their baseline values to estimate the spectra change caused by the monochloramine decay only. Figure 6 shows the estimated spectra for the six samples, where the topmost spectra are the baseline. It is evident in the figure that spectra sets in Samples1-3 (Figure 6a-c) have much downward shift compared to that observed in Samples3-6 ( Figure 6d-f). This is because initial monochloramine concentration of Samples1-3 was much higher compared to Samples3-6, hence, more absorbance reduction occurred in these samples because of monochloramine decay during the study period. Sensors 2021, 21, x FOR PEER REVIEW 11 of 20  Figure 5, the subsequent spectra in all samples in Figure 6 do not cross the baseline, as no NO − absorbances are considered.
For all samples, the spectra in Figure 6 were subtracted from the spectra in Figure 5 to obtain the NO − spectra that includes both nitrate and nitrite absorbances. The isolated NO − spectra presented in Figure 7 show that the enhanced samples (Sample3 and Sam-ple6) have the maximum UV absorbances, suggesting that the production of nitrate and nitrite are the maximum in these samples. This is because the ammonia concentration was increased in these samples to encourage microbiological activity, resulting in an increased conversion of ammonia to nitrate and nitrite. Further, some spectra in Sample6 showed an increase in absorbance compared to other samples by several orders of magnitude, suggesting that severe nitrification occurred. In contrast, the NO − spectra in filtered samples (Sample2 and Sample5) have the lowest absorbance response, hence, nitrification was absent in these samples because microbiological activity was reduced by filtering these samples. Compared to filtered and enhanced samples, the unprocessed samples (Sample1 and Sample4) have an intermediate level of NO − production. The isolated NO − spectra closely resemble the typical NO − spectra in Milli-Q water. For all samples, the spectra in Figure 6 were subtracted from the spectra in Figure 5 to obtain the NO x − spectra that includes both nitrate and nitrite absorbances. The isolated NO x − spectra presented in Figure 7 show that the enhanced samples (Sample3 and Sam-ple6) have the maximum UV absorbances, suggesting that the production of nitrate and nitrite are the maximum in these samples. This is because the ammonia concentration was increased in these samples to encourage microbiological activity, resulting in an increased conversion of ammonia to nitrate and nitrite. Further, some spectra in Sample6 showed an increase in absorbance compared to other samples by several orders of magnitude, suggesting that severe nitrification occurred. In contrast, the NO x − spectra in filtered samples (Sample2 and Sample5) have the lowest absorbance response, hence, nitrification was absent in these samples because microbiological activity was reduced by filtering these samples. Compared to filtered and enhanced samples, the unprocessed samples (Sample1 and Sample4) have an intermediate level of NO x − production. The isolated NO x − spectra closely resemble the typical NO x − spectra in Milli-Q water. The estimated NO x − spectra presented in Figure 7 were passed to the machine learning model developed using the SVR algorithm to predict the relative NO x − concentrations. For this purpose, nitrate and nitrite solutions of known concentrations were mixed to form several combinations, and the corresponding NO x − spectra were acquired and used in model training. Figure 8a-e shows the individual nitrite, nitrate, and mixed NO x − spectra at various concentrations in Milli-Q water, where it is evident that for the same concentration, nitrate has a relatively higher absorbance than nitrite. The peak absorption of nitrite spectra appears at 210 nm, which is approximately symmetric with respect to concentration (Figure 8a). On the other hand, the peak absorption for nitrate spectra starts from 205 nm and gradually shifts to the right as the concentration increases (Figure 8b). For a relatively high concentration of nitrite and nitrate (over 10 mg-N L −1 ), a secondary peak was visible at 302 nm and 355 nm, respectively (Figure 8c,d). However, for low concentrations (below 10 mg-N L −1 ), the UV absorption at the secondary peak region is inadequate, hence, they cannot be effectively applied to quantify the low level of nitrite and nitrate usually encountered in drinking water during nitrification. Spectral analysis suggests that the shape of the NO x − spectra is primarily dominated by the nitrate concentration, as it has a relatively higher absorbance compared to nitrite (Figure 8e). Using the NO x − spectra as predictor variables, and corresponding concentrations as response variables, the SVR model requires a fine tune of the two parameters. The parameter C represents the penalty for misclassified data points, whereas the parameter Y controls the curvature of the decision boundary. They were obtained by the grid search method, and the RBF kernel was used to map the data. Using a 10-fold cross-validation, the performance of the SVR model, in terms of R 2 in model training and cross-validation, was over 0.99, with RMSE < 0.04, which indicates a satisfactory relationship between spectra and concentration. The final parameters of the SVR model are presented in Table A2 in Appendix A. The developed SVR model was used to predict the NO x − concentrations in the six samples using the separated NO x − spectra presented in Figure 7. The estimated NO − spectra presented in Figure 7 were passed to the machine learning model developed using the SVR algorithm to predict the relative NO − concentrations. For this purpose, nitrate and nitrite solutions of known concentrations were mixed to form several combinations, and the corresponding NO − spectra were acquired and used in model training. Figure 8a-e shows the individual nitrite, nitrate, and mixed NO − spectra at various concentrations in Milli-Q water, where it is evident that for the same concentration, nitrate has a relatively higher absorbance than nitrite. The peak absorption of nitrite spectra appears at 210 nm, which is approximately symmetric with respect to concentration (Figure 8a). On the other hand, the peak absorption for nitrate spectra starts from 205 nm and gradually shifts to the right as the concentration increases (Figure 8b). For a relatively high concentration of nitrite and nitrate (over 10 mg-N L −1 ), a secondary peak was visible at 302 nm and 355 nm, respectively (Figure 8c,d). However, for low concentrations (below 10 mg-N L −1 ), the UV absorption at the secondary peak region is inadequate, hence, they cannot be effectively applied to quantify the low level of nitrite and nitrate usually encountered in drinking water during nitrification. Spectral analysis sug- The estimated NO x − concentration by the proposed method is shown in Figure 9a, and the numeric values are presented in Table A3 in Appendix A. The NO x − values in the figure represent the relative NO x − concentration with respect to the baseline values, as the initial NO x − content in the baseline spectra was set to zero. Therefore, the total NO x − concentration would be the sum of initial NO x − content in the baseline spectra plus relative NO x − content estimated by the method. In Figure 9a, Samples 1-3 show an increasing trend in NO x − production, whereas Samples 4-5 show an initial increase, followed by either a stable or decreasing trend. On the other hand, the trend of Sample6 shows a sharp rise in NO x − concentration, indicating a nitrification episode. Overall, the estimated NO x − concentrations for all samples closely reflect their spectra presented in Figure 7. The proposed method was validated against the lab NO x − data (Appendix A, Tables A4 and A5), and a good level of agreement was found between them. Figure A1 in Appendix A compares the estimated relative NO x − concentration by the proposed method and the relative NO x − concentrations calculated from the lab data. Figure 9b shows a strong linear relationship (R 2 = 0.83) between the estimated and the lab data. The trend-line equation represents the local calibration function to relate the lab data with the model predicted values. Some inaccuracies may be encountered during the estimation of the ∆ i, sample and corresponding NO x − spectra by the linear models. Also, if the time difference between the spectra fingerprint and the lab test result varies, local calibration performance can be poor. The estimated NO − concentration by the proposed method is shown in Figure 9a, and the numeric values are presented in Table A3 in Appendix A. The NO − values in the figure represent the relative NO − concentration with respect to the baseline values, as the initial NO − content in the baseline spectra was set to zero. Therefore, the total NO − concentration would be the sum of initial NO − content in the baseline spectra plus relative NO − content estimated by the method. In Figure 9a, Samples 1-3 show an increasing trend in NO − production, whereas Samples 4-5 show an initial increase, followed by either a stable or decreasing trend. On the other hand, the trend of Sample6 shows a sharp rise in NO − concentration, indicating a nitrification episode. Overall, the estimated NO − concentrations for all samples closely reflect their spectra presented in Figure 7. The proposed method was validated against the lab NO − data (Appendix A, Tables A4 and A5), and a good level of agreement was found between them. Figure A1 in Appendix A compares the estimated relative NO − concentration by the proposed method and the relative NO − concentrations calculated from the lab data. Figure 9b shows a strong linear relationship (R 2 = 0.83) between the estimated and the lab data. The trend-line equation represents the local calibration function to relate the lab data with the model predicted values. Some inaccuracies may be encountered during the estimation of the ∆i, sample and corresponding NO − spectra by the linear models. Also, if the time difference between the spectra fingerprint and the lab test result varies, local calibration performance can be poor. The literature and the guidance manuals of many water utilities suggest that changes in nitrite by 0.05 mg-N L −1 or above gives an indication of nitrification [34]. The proposed method tracks the change of relative NO x − concentration, hence, a value around 0.05 mg-N L −1 indicates either an increased level of nitrite or nitrate or both. In such a case, further investigation is required to ensure the status of nitrification.

Discussion
The spectrophotometric method proposed in this paper can be implemented by the drinking water industry to monitor nitrification activity throughout the network. Implementing this method online will require regular changing of the baseline to cope with the incoming water. In a drinking water distribution system, the quality of water and spectral characteristics change continuously, depending on source and treatment characteristics. To obtain more accurate estimates of NO x − , a local calibration using site-specific water quality data is recommended. The accuracy of the laboratory measurements may also be subject to errors from various sources, including measurement range, analysis method, human errors in grab sampling, etc. This is a critical part, as the accuracy of the method is highly affected by the level of calibration. Therefore, calibration using good water quality data is required to obtain a better accuracy by the proposed method.
The lab UV-Vis fingerprint was obtained by filtering the sample through 0.45 µm filter paper to remove the particle absorbances. However, in recent years, several chemometric techniques have been developed to do the particle compensation [14,35]. It is recommended to compare both methods to improve the particle compensation. The chemometric particle compensation techniques could be possibly incorporated into the method proposed in this paper to develop an automated nitrification monitoring system. This could be an area to investigate further.
It was assumed that the absorbance reduction at 245 nm was entirely caused by monochloramine decay. However, at that wavelength, NOM may contribute towards absorbance reduction. As shown in Figure 10, monochloramine decay during the study period was much faster than the decrease of organic concentration (measured as DOC), which was ≤ 0.2 mg L −1 . When this method is employed within a short period (usually less than a week), spectra change due to organic absorbance at 245 nm can be considered to be zero. Therefore, this method works well within a short period. Otherwise, if the DOC concentration is available, it can be used to quantify the absorbance reduction by NOM, since DOC is reported to have an excellent correlation to UV absorbances. Moreover, due to monochloramine autodecomposition, free ammonia is produced, which may also absorb UV light. The spectral analysis of the pure ammonia solution indicated that it has little or no UV absorbances when appearing in a relatively low concentration, usually found in drinking water systems (up to 5 mg L −1 as NH 3 -N).  The spectral fingerprints were taken using a 10 cm optical pathlength cell, and the maximum NO − concentration used to build the SVR model was 2.4 mg-N L −1 (1.2 mg-N L −1 of nitrite + 1.2 mg-N L −1 of nitrate), hence, the method works well within that limit. Beyond that limit, the instrument sensitivity may affect the measurement accuracy. If a  The spectral fingerprints were taken using a 10 cm optical pathlength cell, and the maximum NO x − concentration used to build the SVR model was 2.4 mg-N L −1 (1.2 mg-N L −1 of nitrite + 1.2 mg-N L −1 of nitrate), hence, the method works well within that limit. Beyond that limit, the instrument sensitivity may affect the measurement accuracy. If a high concentration of nitrate and nitrite are expected, it is recommended to use a short pathlength cell. Also, it was assumed that the major light-absorbing species in the spectra were NOM, nitrate, nitrite, and monochloramine, which are common in most typical drinking waters. No chemical reaction between these species, or absorbance increase/decrease due to their internal reactions, were considered. For a relatively short time duration between the baseline and the subsequent spectra, the internal reactions and their effects on the spectra can be negligible. If other UV light-absorbing species exist in the spectra, the accuracy of the method may differ due to the interferences by these species. Further study is required to confirm this.
Currently, UV spectrophotometry has been increasingly used for online monitoring of various water quality parameters [1]. Among the various methods of nitrification monitoring, spectroscopic methods are preferable because of their simplicity, rapid detection, and high sensitivity, which improves the accuracy of detection [2,36]. To develop online based sensors, Banna et al. [37] indicated important criteria, including response, measurement range, sensitivity, accuracy, lifetime, maintenance, and cost, need to be considered. The proposed method has a rapid response with high sensitivity and good accuracy, hence, it can be used to develop an online nitrification monitoring system. Unlike many other UV-based methods of nitrate/nitrite monitoring of environmental samples which use oxidizing or complexing agents, this method is simple and does not require any chemical addition. Compared to other methods, such as SDA, the incorporated spectral compensation for monochloramine absorbance makes it more compatible for monitoring rapid chloramine decay and nitrification in chloraminated systems. By incorporating the online monitoring to the proposed method, an early warning system can be developed that will help to prevent nitrification in drinking water distribution systems. This could be an area to explore further.

Conclusions
A novel method of monitoring nitrification in drinking water is proposed in this paper. In typical chloraminated drinking water, major UV light-absorbing substances are NOM, nitrate, nitrite, and monochloramine. Both nitrate and nitrite absorb UV light in the same wavelength range, hence, nitrification activity can be monitored by assessing the combined NO x − spectra. When complete or incomplete nitrification occurs, the spectra fingerprint is changed due to the change of concentrations of these species. With some simple assumptions, the NO x − spectra were isolated from the total spectra to estimate its NO x − content. The spectral analysis for a number of test samples over several weeks suggest that maximum downward spectral shift was due to monochloramine decay at 245 nm wavelength. In contrast, the spectra shift slightly upward between 200 nm and 225 nm wavelengths due to the production of NO x − . Since both monochloramine and NO x − have an effect on spectra change in between 200 nm and 245 nm, pure monochloramine spectra were investigated to quantify its individual effect. The analysis of pure monochloramine spectra at various concentrations indicated that the absorbance difference between two concentrations at 245 nm (∆ 245 ) is related to other wavelengths (∆ i ) by a linear function. Using these linear models established in ultrapure water, the ∆ i values for the test sample were calculated based on its ∆ 245 value.
To work with this method, the test sample is required to keep for a certain period to allow monochloramine decay and NO x − production. The spectra fingerprint is recorded at the beginning (t = 0), considered as baseline, and at the end (t = t). The estimated ∆ i values are subtracted from the baseline to approximate the spectra change caused by monochloramine decay only. Finally, subtracting these estimated spectra from the spectra at time t will give the NO x − spectra for that time duration.
A dataset was created using a range of NO x − spectra and corresponding concentrations in ultrapure water. The dataset was used to train a machine learning model using the support vector regression (SVR) algorithm. The detection accuracy by the model was tested for different kernel functions, and the radial basis function was found to have excellent accuracy. The SVR model was used to predict the relative NO x − concentrations of the test samples. Finally, the following points can be summarized: • Nitrification in chloraminated water can be monitored by isolating and modelling the NO x − spectra • The level of precision by the proposed method is ± 0.01 mg-N L −1   Table A5. Relative NOx production between the first row and the subsequent rows in Table A4 (mg-N L −1 ).