SOFTWARE FOR CALCULATING A WATER QUALITY INDICATOR SPECIFIC TO THE AMAZON REGION

The quality of the water in the Amazon's reservoirs is of fundamental importance for natural ecosystems, biota, and for the region's population. Maintaining the water quality involves long-term monitoring programs established by the requirements of Brazilian legislation. A web interface may facilitate the use of monitoring results routinely, which allows periodic insertion of previously selected water quality parameters results, to finally provide a simple and direct way to evaluate the water quality. The general objective of this study was to develop a software based on a water quality indicator (WQI) system considering chemical, physical-chemical, and biological parameters evaluated in four seasonal periods in Samuel dam. Multivariate analysis was used to select 10 significant variables (oxidation-reduction potential, dissolved oxygen, total dissolved solids, chlorophyll a, phosphate, Ba, Ca, Fe, Na, and Sn). The web software added innovation to the project, enabling to storage of data from analysis of field-collected samples in an organized and safe way in a database, in addition to speeding up the calculation of the WQI, making it possible to classify the water quality more quickly and accurately.


INTRODUCTION
Water is a vital resource, both to sustain life and for the global economy, being the rivers of the Amazon an important natural source for the planet. The water quality of these resources has been lost over time due to anthropic factors such as the lack of basic sanitation, mining, the use of pesticides in agriculture, industrial activity, among other factors (Cantonati et al., 2020).
Assessing water quality, i.e. its chemical, physical, and biological characteristics, for different purposes of use, such as domestic, irrigation, conservation, and industrial use, is an important strategy for food security and human health (Matta et al., 2020;Son et al., 2020).
Several chemical, biological, and physicochemical parameters have been used as water quality indicators with reference values varying according to each country legislation Pereira et al., 2011), such as concentration of metals (chemical) (Mokarram et al., 2020;Miranda et al., 2009), coliforms (biological) (Manara & Clemente, 2011), and pH and DO (physicochemical) . In the Amazon and other locations, water quality parameters have also been used to determine water quality indicators (WQI) (Maulud et al., 2021;Costa et al., 2020;Oliveira et al., 2017).
The water quality indicators (WQI) setting is essentially based on the formulation of a method for calculating a value to assess the usability of a waterbody for a given purpose, based on parameters of water samples previously analyzed and which must be within certain limits. The use of water quality indicators is a tool to improve communication between interested parties, which play a fundamental role as a facilitator for the protection of water sources.
The process of building a water quality indicator is complex, and there is no clear rule for such a process (Zuffo et al., 2013;Medeiros, 2012). However, a set of parameters that measure the characteristics considered important should be selected in the indicator construction. These characteristics can be physical, chemical, and even microbiological. After defining the characteristics, the next phase consists of determining a rule that reduces all the information related to the parameters of interest in a single number, i.e. in the water quality indicator.
Different methods have been proposed: from deterministic processes, such as those proposed by the National Sanitation Foundation of the United States of America (Brown et al., 1970) and by Provencher and Lamontage (1977), to the use of more sophisticated techniques related to computational intelligence, such as, for example, the fuzzy logic (Gharibi et al., 2012) and the Artificial Neural Networks (Gazzaz et al., 2012).
To automate the WQI calculation process, it is necessary to develop a software to register the parameter values of the water collection samples in a database and use this data to perform the WQI calculations according to a preestablished method, and later enabling to visualize this information. The Surface Water Quality Assessment Tool (SWQAT) is a software developed by Sharma et al. (2013) to calculate the Overall Index of Pollution (OIP), which employ physical-chemical, toxicological, and bacteriological parameters to classify water quality as 'Excellent', 'Acceptable', 'Slightly Polluted', 'Polluted', and 'Heavily Polluted'. In addition, Nabizadeh et al. (2013) developed a software for calculating the WQI named Iranian Water Quality Index Software (IWQIS), which, like SWQAT, is based on the three fundamental functions of data inclusion, data processing, and visualization of results. However, the IWQIS allows the user to select the parameters that should participate in the WQI calculation, along with dynamically assigning the weight, unlike SWQAT.
The software development process requires different steps that are based mainly on a well-defined understanding of the user's needs, database construction, and development of the program that will perform the functions of data entry, processing, and output. The database construction process involves the development of a data model (Elmasri & Navathe, 2015) that contemplates the entities and their respective attributes, which are of interest within the scope of the system, which in this study is aimed to assess the water quality. After defining the database, the software proceeds to the developed phase, using a programming language.
This study aimed to develop a software to calculate the water quality index (WQI) using multivariate statistics in the treatment of the water quality parameters obtained in Samuel dam, state of Rondônia in the Brazilian Amazon, in four seasonal periods.

LOCATION
Samuel hydroelectric dam is located on the Jamari River in the municipality of Candeias do Jamari, 50 km from the city of Porto Velho, in the state of Rondônia, in the Amazon region -Brazil, at 08º 45' 04" south latitude and 63º 27' 14" west longitude (Fig. 1). The facility initiated its activities in 1989, with an installed capacity of 216 MW (Santos et al., 2015).
The hydrographic basin of the Jamari River is relatively small compared to other basins in the Amazon, with 15,280 km2, only 26 times larger than the area of the 585 km² reservoir with a length of 120 km (Santos et al., 2015).
For the development of the area map, the free QGIS program found on the site https://qgis.org/downloads/QGIS-OSGeo4W-3.10.7-1-Setup-x86_64.exe (public domain) was employed.

SAMPLE COLLECTION AND ANALYTICAL METHODOLOGY
The water samples were collected from the surface according to the national guidelines for the collection and preservation of water, sediment, aquatic communities, and liquid effluents of the Brazilian National Water Agency (ANA, 2011) in 11 sampling stations and georeferenced through a global positioning system (GPS) ( Table 1).
The variables conductivity, DO, pH, ORP, TDS, temperature, transparency, and turbidity were analyzed at the collection site using field equipment. The equipment employed was calibrated before use ( Table 2).   The analytical methods adopted followed the standards of the Standard Methods for the Examination of Water and Wastewater (APHA, 2005), and other technical standards. All analyzes were performed in triplicate. The operating conditions of the ICP-OES are shown in Table 3.
Samples for the analysis of chloride, chlorophyll, apparent color, true color, chemical oxygen demand (COD), phosphate, ammonium ion (NH4+), metals (Ag, Ba, Be, Ca, Cd, Co, Cr, Cu, Fe, K, Mg, Mn, Na, Ni, Pb, Sn, Sr, Ti, V, and Zn), and nitrate, were packed in 1-liter polyethylene bottles, previously decontaminated with 10% nitric acid solution, washed with deionized water, dried, and then washed with water from the collection station (environment) and labeled. After collection, the samples were transported in thermal boxes at 4°C to Tucuruí and Belém. In partner laboratories, the samples were subjected to filtration with GFF-type membranes (Millipore 0.45 m) using a vacuum filtration system, except for the analysis of apparent color. Only the samples intended for metals testing were acidified to pH <2 with supra-pure concentrated nitric acid for further analysis at the ICP-OES.

ANALYTICAL QUALITY
The analytical quality was performed for the metal analysis methodology using the ICP-OES. The accuracy study was carried out with a standard river water sample (NIST SRM 1640) showing a recovery between 92.36 and 108.00% for the metals evaluated. In the study of repeatability, a coefficient of variation of 1.54 and 4.66% was found. The method was linear in the range of 0.00 to 15.00 mg L-1 for macro-elements and 0.00 to 1.00 mg L-1 for micro and trace elements, with a linear correlation coefficient from 0.9958 to 0.99998. The detection limit (3s), for all the elements surveyed, was calculated according to the reading deviation of 15 whites and was in the range of 0.0001 to 0.0271 mg L-1. The limit of quantification (10s) was between 0.0002 to 0.0826 mg L-1.

STATISTICAL METHODS
Statistical calculations were performed using Excel, Minitab, and Statistica programs. The WQI determination followed three steps as proposed by Sahu and Sikdar (2008). In the first step, a weight (wi) was assigned to each of the parameters according to their relative importance in the general quality of the water. The maximum weight of five (5) was attributed to the parameters with great importance in water quality evaluation. The minimum weight of one (1) was assigned to parameters that play a less significant role in assessing water quality. In the second step, the relative weight (Wi) was calculated as in Equation 1, where Wi is the relative weight, wi is the weight that was assigned to each parameter, and n is the number of parameters.
In the third step, a quality assessment scale (qi) was assigned to each parameter, dividing the concentration of each water sample by its standard according to the respective guidance established in CONAMA resolution 357/2005, then the result was multiplied by 100 as shown in Equation 2, where qi is the quality assessment, Ci is the concentration of each chemical parameter in each water sample in mg L-1, and Si is the water quality standard for each chemical parameter in mg L-1.
To calculate the WQI, SIi was first determined for each chemical parameter (Equation 3), and then this value was used to determine the WQI by Equation 4 where SIi is the sub-index of parameter i.
The calculated values of the water quality index (WQI) were based on the classification of five categories as shown in Table 4. It was necessary to understand the user's needs to start building the web system to calculate the water quality indicator (WQI). Therefore, the first stage of the process was the survey and analysis of the functional and nonfunctional requirements of the system. Techniques such as interviews, meetings, and inspection of spreadsheets and other documents already known by the user before the system were considered in this step.
The system was then documented using the following UML (Unified Modeling Language) diagrams: use case, sequence, and activity diagrams. In addition, the complete description of the use cases was provided to facilitate the understanding of what should be built, resolving doubts concerning the real needs of the user, increasing the chances of developing a system that solves the user's premises. Table 5 shows an example of the model used to describe the use cases.
The next step was to perform conceptual modeling of the database, making it possible to enumerate the entities, with their respective attributes, and understand the relationship between the various entities that compose the database. Then, the conceptual modeling was converted to logical modeling, allowing a lower-level view of the database. Fig. 2 shows an entity-relationship model (ER Modeling) for logical modeling. From the logical model, the physical model was conceived, which uses the SQL (Structured Query Language) programming language to create the database in the relational database management system (RDBMS) known as MySQL version 8. This functionality must control access to the system through an email and a valid password.

Preconditions
Access the authentication screen and have an account registered in the system.

Postcondition
Be redirected to the system's home screen. Main flow 1) The user accesses the authentication screen 2) Inform their e-mail and password previously registered by the system administrator; 3) If the e-mail and password are in accordance with the data registered in the database, then the user is redirected to the system's home page. Validation Email and password fields are required. Software for Calculating A Water Quality Indicator Specific to The Amazon Region With the system requirements defined and the database created, the system development stage was initiated using the programming language PHP version 7.2 to implement its logic. To develop the user interface, HTML5, CSS3, Javascript, and Bootstrap version 4 technologies were used. The development environment used to program the software was Eclipse version Oxygen.

PHYSICAL-CHEMICAL, BIOLOGICAL, AND CHEMICAL RESULTS
The average values found for the parameters evaluated at Samuel dam were compared with the values recommended by Resolution 357/05 of the Brazilian National Environment Council (CONAMA, 2005).
Among all the physical-chemical and biological parameters evaluated, in terms of average, only the DO was in non-compliance with Brazilian legislation in the dry season The concentration of dissolved oxygen (DO) in any waterbody is controlled by several factors, such as the oxygen solubility in water and the temperature. The lower DO concentration recorded during the summer may be due to the higher temperature which has a stronger effect on organic matter decomposition and increased photosynthetic activity, in addition to the fact that hot water retains relatively less oxygen than cold water (Lone et al., 2021).
At the end of 2015 and beginning of 2016, there was a temperature increase in the region with higher evaporation and lesser volume in the water bodies due to the El Niño phenomenon that influenced the beginning of the rainy season throughout the Amazon region (MOURA et al., 2019).
The elements Cd, Co, Cr, Ni, Pb, Sr, and V showed results below the Limit of Quantification (LOQ) of the chosen method for all seasonal periods, indicating the preservation of the water bodies evaluated concerning carcinogenic elements such as Cd, Cr, Ni, and Pb. Therefore, these elements were not considered for this study.
The Considering the average values found in the rainy season, the largest elements K, Ca, and Mg predominated in the following order: K>Ca>Mg>Fe>Na>Sn>Ag>Cu>Ba>Zn>Be. In the intermediate period 1, the order was: K>Ca>Mg>Na>Fe>Sn>Ag>Ba>Zn>Be, also with the predominance of the major elements K, Ca, and Mg. In the dry season the order was: Ca>K>Na>Mg>Fe>Mn>Ti>Ba>Zn. In intermediate period 2, the order was: Ca>Fe>Na>K>Mg>Ti>Mn>Ba.

CALCULATION OF WQI
Many significant correlations (p<0.0500) were found between the parameters evaluated in each seasonal period. These preliminary statistical tests were used to verify the results obtained and to select the most significant parameters for the elaboration of a water quality index (WQI).
The correlation matrix of the eigenvalues, the variance, and the accumulated variance of the principal components with all the evaluated parameters totaled 71.40% of statistical information in the first two components (PC1 and PC2) in the rainy season, 79.30% in the intermediate period 1, 75.70% in the dry season, and 87.7% in the intermediate period 2.
After correlation analysis, the principal component analysis (PCA) was applied to all parameters evaluated in the surface water samples from the Samuel dam. The parameters with weights >0.500, which represent those with the greatest statistical importance, were selected and evaluated given the assigned weights and the environmental importance of each parameter in water quality evaluation. The extraction of factor loading (not rotated) was performed and the principal components (PC1 + PC2) >0.500 per seasonal period are shown in Table 6. The parameters were selected based on the principal components of all seasonal periods. The parameters that showed the greatest significance (highest percentage of variance) were transparency, temperature, ORP, DO, turbidity, TDS, conductivity, chlorophyll-a, phosphate, and apparent color. These parameters were considered of greater statistical importance and, therefore, received a relative weight of 0.0495 for the calculation of the WQI. It is important to note that all parameters evaluated were also used in the calculation, but with a lower relative weight.

SOFTWARE DEVELOPMENT
The system was divided into two profiles: administrator and field specialist. The difference between the profiles was that the administrator can change, remove or add new users with an administrator or specialist profile; whereas the specialist cannot perform user management operations on the system. The first screen of the system, shown in Fig. 3a is for authentication. The field specialist must be registered to log in to the system, guaranteeing security. If the user forgets their password, they can recover it as shown in Fig. 3b (a) (b) Figure 3: (a) Authentication screen, (b) Password recovery screen.
User management takes place through the functionality represented by the screen in Fig. 4. This screen is accessed through the "Manage Users" option in the menu, which is only shown for users with an administrator profile account. One of the main reasons to develop this system is to facilitate the data import to generate results that will be visualized and interpreted by a field specialist, as the WQI calculation is carried out from collected experimental data. In this sense, instead of the user having to enter the value of each parameter collected on a system screen, the data entry is done through an electronic spreadsheet that has two tabs: the first contains all the data necessary for WQI calculation (Fig. 5), and the second the parameters for the calculations (limit established in the legislation and its respective weight) (Fig. 6). It is important to note that spreadsheet validation rules have been implemented in the system to generate consistent results. Therefore, after transferring the spreadsheet to the system (upload) and before performing the calculations, the system performs the following validations: • Checks whether the extension of the transferred file is .xls or .xlsx; • Checks whether the order of variables in tab 1 is the same as in tab 2.
The validation of variables order considers that the names of the variables are the same. For example, if the variable in tab 1 has the name "Temperature (ºC)" and in tab 2 it has "temperature (ºC)", then the system will report an error, due to the difference in the letter "t".
The set of spreadsheet management features represents the core of the system. The screen that the user must operate to inform the year of data collection, the state, and the municipality where the data was collected, select the spreadsheet file, assign a name, describe the spreadsheet, and define their status (private or public) is presented in Fig. 7. Also, at the beginning of this screen, it is possible to list the spreadsheets already registered by the user and the public spreadsheets, through the "List Spreadsheets" option; download a spreadsheet template and have access to help to learn how the spreadsheet structure works (options "Download the template here" and "Understand the structure", respectively).  Still on the screen shown in Fig. 7, after the user clicks on the button "Import and View Results", the system will execute the validation rules mentioned above, check if all fields identified with an asterisk (*) have been filled and, if these restrictions are met, the system records the information and the spreadsheet in a database. After this procedure, the user will be able to view the results on the next screen. Then, the results of the qi (Fig. 8) and si ( Fig.  9) calculations are displayed to the user.  Still on the results screen, the WQI values per sample/season are displayed in a table, as well as the category to which the value fits. Fig. 10 presents an example.
In this section, one can see the average WQI of all samples/stations. Furthermore, an interesting feature was developed, which is the calculation of the mean WQI considering samples/stations selected by the user in the first column of the table by clicking on the button "Calculate Average of Selected Values". The functioning of this system function is presented in Fig. 11. Fig. 12 shows a graph of the WQIs calculated by sample/station, which allows the user to summarize the results. From the screen that lists the spreadsheets, one can see the spreadsheets that have already been imported into the system. The screen shown in Fig. 13 shows the table that displays the spreadsheets registered by the user and the public spreadsheets, i.e. those that were defined by other users with a "public" status. There is a button entitled "Download" (dark blue color) that allows the user to download the spreadsheet to his computer and another option "View results" (green color) that directs the user to the screen that shows the results. spreadsheet WQI results. Therefore, through this functionality, the system works like a repository of spreadsheets with experimental data that can be shared with other users.

CONCLUSIONS AND RECOMMENDATIONS
Managing data without the aid of a computational tool is laborious, unproductive, and unsafe. To solve these problems, the system described in this study was created. Moreover, the fact that the system works in a web environment adds several advantages, such as organization and data security; speed and accuracy of calculations; use of the system from anywhere via the internet, and adds an innovative character to the project, since the researched literature shows only similar systems of the stand-alone type (which are not web).
The web software to calculate the water quality indicator specific to the Amazon region was registered within the INPI (Brazilian National Institute of Industrial Property), in the category computer program, through the process BR512020001541-7, which confirms its innovative nature and highlights its importance.

SOURCES OF FUNDING
This research received no specific grant from any funding agency in the public, commercial, or not-for-profit sectors.

CONFLICT OF INTEREST
The author have declared that no competing interests exist.