A Framework for Sustainable Planning and Decision-Making on Resource Recovery from Wastewater: Showcase for São Paulo Megacity

: Currently, it is important to develop strategic frameworks to support the selection of sustainable resource recovery solutions. This study applies a new framework for planning, implementation, and assessment of resource recovery strategies for a full-scale wastewater treatment plant (WWTP) in São Paulo megacity. The framework comprises several steps based on case study-specific data and information from current literature. Data were collected from various sources: a survey with a wastewater treatment utility, national and regional databases, and review of local regulations and international literature. Treatment configuration, wastewater and by-products composition, potential demand (for water, energy, and phosphorus), stakeholder identification, and local legislation were thoroughly discussed regarding decision-making on resource recovery. Scenario analysis was used to explore suitable nutrient and energy recovery measures based on indicators. Biogas recovery and sewage sludge composting showed more favorable conditions due to similar experiences in the area and robust legislation. The proposed framework is a simplified tool, and its application can support managers to get information on resource recovery and how to plan such initiatives in easier ways to facilitate wiser decision-making, and better operation and management. The results on framework use and refinement can guide potential applications in other contexts and stimulate public policy formulation and further research.


Introduction
The scarcity of natural resources is a driver for initiatives of resource recovery and reuse, by producing biogas, fertilizer, and water that can be returned to the market. Recovering valuable compounds of municipal wastewater includes several important aspects for the planning process, decision-making, and implementation. Table 1. Identified knowledge gaps with key journal paper references and how these gaps are directly addressed by the present paper.

How this Gap is Addressed in Our Paper
Great potential of application of resource recovery solutions in megacities; few studies on nutrient recovery in South American countries [9][10][11]18] The framework is applied to a representative WWTP in São Paulo megacity. Additionally, there is an indication of applicability to other megacities, considering resource scarcity and local characteristics. Nutrient recovery options are assessed.
Lack of studies that focus on interactions with local environment and stakeholders (integrated approach) [16,17,19] Linkages of sanitation with economic activity (market demand), social (stakeholders), and analysis from waterenergy-nutrient nexus perspective (e.g., water consumption in the area). Comparison of resource recovery strategies from systems' perspective and understanding of related impacts [20] Step 9 of the framework contains detailed comparison of different scenarios for energy and nutrient recovery.
Lack of tools and methodologies to identify the best solution to each context, to support planning and decision-making [12][13][14] The framework application allows the most suitable solution to be identified considering technical, environmental, societal, economic, and political/institutional indicators. More comprehensive framework for planning, decision-making, and assessment of any kind of resource [21][22][23][24] The proposed framework is tested in a real case: It is shown to be simple to apply and facilitates the planning process and the choice of the recovery technology.
recovery action, including a large set of indicators and stakeholders' groups.
Nutrient and energy recovery scenarios are analyzed in detail.
Decision-making on urban water infrastructure projects is complex, since it should consider the interactions between infrastructure (e.g., technological options), environmental, institutional, economic, and social characteristics [19]. Several decision-making parameters can be evaluated to choose the optimum recovery technology such as costs (capital and operational expenditures), recovery rate (%), environmental impacts (heavy metals and organic contaminants), wastewater composition, and market for the recovered product (e.g., phosphate fertilizer) [25]. These parameters should be considered as early as possible, such as at the design stage [23].
Local context characteristics should be carefully examined and considered in the planning process for resource recovery [7,26]. Especially in developing countries, there is insufficient planning to include efficient sanitation systems [27]. Many technical options are available to recover resources from wastewater and sludge; however, some technologies might not be suitable for developing countries, because of the costs and requirements on treatment processes and energy demand [28].
Besides the costs, local legislation can also influence the selection of resource recovery measures [14]. In some cases, legislation can act as a barrier and changes are required, while in others legislation and standards can be drivers for resource recovery implementation. Then, identifying legal and institutional challenges related to resource recovery can assist in the planning of wastewater treatment plants to support strategic decisions.
It is important to develop strategic frameworks to support society (policymakers and general public) in the selection of resource recovery solutions, such as sustainable options for sewage sludge management [22,29]. According to Romeiko [20], it is necessary to compare environmental performances of resource recovery-based wastewater treatment plants to support the design and implementation of resource recovery strategies from system perspectives. This comparison can include several indicators. As a result, a better understanding of resource recovery technologies will allow for the design of future systems [30].
A proposed framework as a tool to stimulate/support planning and decision-making on resource recovery from wastewater treatment was presented by Chrispim et al. [31]. As the next step, this paper presents how this framework can be applied, offers significant suggestions for improvement, and addresses research gaps in the field ( Table 1). The aim was to showcase the new framework for planning, implementation, and assessment of resource recovery strategies for a representative WWTP. The specific objectives were to apply all the steps of the proposed framework to support decision-making on resource recovery strategies; to recommend operational and technological strategies of resource recovery (nutrients and energy) to be applied in this representative facility, considering economic, technical, environmental, societal, and political indicators; and to identify strengths and potential improvements of the framework.
In this paper, the case study was a large WWTP in São Paulo megacity and the authors identified current practices and opportunities for improvement of this facility, including processes and technologies for resource recovery. Based on real data from a practice system, it was possible to propose innovations, and to support the implementation of new strategies and more effective solutions for resource recovery from wastewater. Understanding and testing the framework application was an important task to prioritize future data collection efforts.
The results could contribute to the creation of technical and scientific knowledge and a better understanding of planning, retrofitting, and upgrading of municipal WWTP with resource recovery, and to support the development of public policies or regional programs in this area. Wider applicability of the results for other cities is suggested for better wastewater management practices and for supporting resource recovery implementation. Through the framework application, it is possible to address what needs to change to achieve or optimize the resource recovery initiatives. Some key questions addressed in our paper are: What resources are available in the waste streams in the studied plant; what market demand there might be for them; how they could be recovered; what the linkages with local legislation are; and who the key stakeholders are.

Developed Framework
The methodology applied in this paper was based on a framework developed to support the planning and decision processes about resource recovery strategies in wastewater treatment plants [31]. In the cited paper, the framework was just outlined (briefly introduced). The present paper contains novel aspects: The first application in a real situation, suggestions of improvements and new arrangements of the framework, potential impact of its application in world's megacities, and estimation of potential resource recovery solutions for the study region. The framework (Figure 1) was applied in a case study of a wastewater treatment plant in the São Paulo megacity (or the metropolitan region of São Paulo). Wider applicability of the framework is suggested in Table 2.

Studied WWTP
The information regarding the plant was gathered with the support of the São Paulo State Water Supply and Sewerage Company (SABESP), who owns and operates this facility. The wastewater treatment plant ABC is located in São Paulo city (23°36′41.58′' S and 46°35′9.24′' W) ( Figure 2). This facility treats sewage from six cities, totalizing an approximate population equivalent of 1.4 million inhabitants. This plant started up in 1998, with a maximum treatment capacity of 3 m 3 /s, and it is foreseen to increase this capacity (Section 3.1.1). The mean wastewater inflow rate was 2.33 m 3 /s during the analyzed period (07/2016 to 06/2017). The treatment processes for liquid and solid phases are illustrated in Figure 3. A detailed description of treatment stages is given in Section 3.1.1. Detailed information about the study area is presented in Section 3.1.2. Notes: Wide arrows: Liquid state; dashed arrows: Solid state; thin arrows: Gaseous state. On the final arrows that do not have continuity in another unit operation: Final effluent, part is discharged in the river, part is conducted to a non-potable water reservoir, and part is sent to the Aquapolo Project; scum from settling tanks is conducted to digesters or disposed in landfill.
The motivation for the choice of this plant was based on the availability of data, its completeness, representativeness (in terms of scale, treatment flow, and treatment processes compared to other large-scale WWTPs of São Paulo megacity), and because this plant already applies one measure of resource recovery: Water reuse. It is noted that Cornejo et al. [36] also used similar criteria to choose WWTP in their study.

Data Collection for Application of The Framework in the Case Study
The input data to achieve steps 1, 3, and 4C of the framework (treatment configuration; qualitative and quantitative characterization of effluent and by-products; and identification of internal demand) were obtained with the managers and engineers of the plant (WWTP ABC). For this, a list of the necessary primary data (general data, characteristics of the treatment processes used, monitoring data, by-products, and environmental indicators) was prepared (Supplementary Material 1).
For characterization purposes (step 3), the substances considered for analysis were: Water, phosphorus, nitrogen, and organic matter. The water (treated effluent, reclaimed water, and water consumed by the WWTP) represents a relevant local resource for the context of the study area. Phosphorus (P) is a resource that is globally limited, and it presents actual scale recovery processes implemented in several countries where it is considered economically viable. In addition, P can be recovered from different units of wastewater treatment processes. Nitrogen is an important constituent (in quantitative terms) of municipal sewage, as well as P, and has potential as fertilizer. Organic matter is source for recovery of many products (e.g., energy from biogas and soil conditioner). Further information on research design is presented in the Supplementary Material 2 (2A).
The temporal boundary of the analysis comprised a period of one year (from 07/01/2016 to 06/30/2017). The definition of this period followed the recommendation of Brunner and Rechberger [37], and it was considered a reasonable period to determine reliable average values, since the period should be enough to counterbalance momentary instabilities of the analyzed system and seasonal variations. The analysis included all processes and unit operations of the WWTP ABC from the arrival of raw wastewater until the discharge of treated effluent ( Figure 3).
The data to achieve the other steps of the framework were collected from various sources, consulting the related legislations on water reuse, sludge recycling (in the form of organic fertilizer and soil conditioner) and energy recovery, technical reports, regional databases, journal articles, and planning documents for the study area. For step 4, in order to complement the data (estimated volume and price of reclaimed water for non-potable uses in urban areas), we contacted the plant managers of WWTP that commercialize reclaimed water and the responsible secretaries of the city council of study area cities.
The comparison of recovery technologies options (step 9) considered evidence from the literature about the respective technologies. Scenario analysis was used to explore some possible resource recovery measures for the studied plant. Detailed information for each attribute/indicator can be found in the Supplementary Material 3.

Data Analysis
After data collection, both qualitative and quantitative data were organized into data spreadsheets for comparison purposes. Based on the collected raw data about the plant, mean concentrations, organic and nutrient loads, and removal efficiencies for the main parameters chemical oxygen demand (COD), biochemical oxygen demand (BOD), nitrogen (N) and P were calculated. In general, the results were represented as tables and graphs. The final step was the comparison between the recovery options according to the indicators. The outlook (recovery scenarios) was a result of the different assessment indicators given in this work (educated guesses) and based on the literature.

Application of the Proposed Framework for Resource Recovery in a WWTP in São Paulo Megacity
The results are organized and discussed according to each step of the proposed framework. Future upgrades of the studied plant are changes to increase its treatment capacity. The expected upgrades are to increase to 6 m 3 /s, and a further stage to upgrade the settling tanks to increase the treatment capacity to 8.5 m 3 /s. Currently, it is foreseen that there will be an increase of the treatment capacity to 4 m 3 /s in 2023. It is important to take it into account when planning resource recovery strategies since the increase of the plant's capacity will imply increase of generated by-products (e.g., sludge) and will have effects on characterization (effluent and sludge quality).

3.1.2.
Step 2-The Surrounding Areas of the WWTP Understanding the local context is a crucial step to support future decisions about which resource(s) to recover. Firstly, we defined the area nearby the WWTP. The named group 1 includes the municipalities of the Great ABC Region (Santo Andre, São Bernardo do Campo, São Caetano do Sul, Diadema, Maua, Ribeirao Pires, and Rio Grande da Serra) and São Paulo city. Furthermore, a broader area (group 2) was considered, including four other municipalities of the metropolitan region of São Paulo (MRSP) (Biritiba-Mirim, Mogi das Cruzes, Salesópolis, and Suzano) due to their importance to agricultural activity (high values added to agriculture among the cities of the MRSP). Figure 2 shows the study area, comprising cities of groups 1 and 2. The main economic sectors correspond to those with the highest contribution to gross domestic product in the study region (groups 1 and 2). Figure 4 shows the distribution of the main economic activities in terms of the number of facilities in the study region.  [38]; data refer to 2017; (b) it includes planted and native forests; (c) based on [39]; data refer to January to September of 2019; the automobile sector is not included. Other sectors were not included because they are not highlighted in the Great ABC region [40]. Other sectors correspond to the mechanical industry; electrical and communications industry; transport material industry; wood and furniture industry; paper, cardboard, editorial, and graphic industry; and footwear industry (23,390 facilities in total); (d) manufacturing of materials such as cement; (e) industries such as pharmaceutical, veterinary, perfumery, and others; (f) smoke, leather, fur, and similar industries.
In the group 1 region, there is a predominance of processing industries and other services (transport, post office; accommodation and food; information and communication; private education; health; among others) [41]. The main processing industries are automobile industries, chemical industries, metallurgy industries, rubber and plastic production, food industries, and textile [40].
Agriculture and livestock are not significant economic activities in the group region 1. Nevertheless, in the small city of Rio Grande da Serra, there is considerable agricultural activity (fruit and vegetable production and farms for chicken production) [42]. In quantitative terms, there are 5064 units considering agriculture, forestry, plant extractivism, and livestock in group 2 (considering the 12 municipalities) [39]. It is worth adding that in the rural zone of São Paulo city, there are about 428 units of agricultural production, particularly in the southern region, for fruit, ornamental, and leave crops [43].
In the analyzed region (group 2), the quantity of settlements is higher in horticulture and floriculture [38]. In addition, there are initiatives such as: Urban agriculture programs in Diadema and Santo Andre, community gardens in São Paulo city [44], and vertical farming. The products of horticulture in the region are diverse, but the crops linked to the highest number of farms are lettuce, cabbage, and coriander [45]. Therefore, this diagnostic (step 2) can support the identification of the local area needs and the potential demand for resources that could be recovered by the studied WWTP, which is discussed in step 4.

Step 3-Qualitative and Quantitative Characteristics of the Treated Effluent and by-Products
This step allows for the support of decisions on what recovery measures would be feasible for a specific facility. It is possible to identify resources that are present in which treatment stages and in what quantities. The analysis was based on the volumes of wastewater, consumption of inputs, and generation of waste in the period of one year. All treatment processes are summarized in Figure 3.
Regarding quantitative data, the average daily raw wastewater flow rate that entered the plant was 2.33 m 3 /s. The total volume of the raw wastewater inflow rate during the analyzed period was 73,720,195 m 3 and the total volume of treated effluent was 71,266,865 m 3 per annum. Part of the treated effluent by the plant was discharged into the river nearby, another part was directed to the Aquapolo Project (423 L/s during the monitored period), and a third part went to an internal reclaimed water facility. This reclaimed water was used internally for washing of streets and installations, sealing of pumps, cooling equipment, and foam breaking.
The Aquapolo Project is the largest wastewater reuse facility in the southern hemisphere, and the fifth largest of its kind in the world. In the Aquapolo Project, the advanced treatment processes used are disk filters (400 microns), membrane bioreactor (0.05 microns), and reverse osmosis [46]. After this treatment, the reclaimed water is pumped to a Petrochemical Complex, mainly for cleaning of cooling towers and boilers [46]. The current capacity is to provide up to 650 L/s of water to the industrial complex [47].
Steps 3B and 3C (Figure 1) comprise the qualitative monitoring of the treated effluent and the by-products (Tables 3 and 4) to identify potential resources to be recovered. The removed grit and screening material are currently sent to landfills. The annually removed amount was about 765,755 kg of grit and 152,641 kg of screening material. The generation of screening material was 2.07 kg per 1000 m 3 of raw wastewater (plant influent) and 10.38 kg of grit per 1000 m 3 . The generation of screening material was lower than the findings of a previous study [48]: Average of 6 kg per 1000 m 3 , but in other WWTP in the São Paulo state. It is worth noting that the data on generated screening material and grit (of our studied plant) were underestimated due to maintenance of the equipment during part of the monitored period, which can explain the lower value. Notes: a It includes screening with fine, medium, and course screens; b data referring to the period between 1 July 2016 and 30 June 2017; for grit and screening material quantities there were missing data for some months due to maintenance; and c data from December 2017. Cells with "-": data not available or not measured by the wastewater treatment plant operators.
The total amount of produced dewatered sludge (or biosolids, which refer to stabilized sewage sludge) was 41,190 tons in the analyzed period (one year). The WWTP ABC had higher sludge production compared to a similar study [49], which obtained 2894 tons annually of biosolids produced in a WWTP in USA with a flow rate of 0.541 m 3 /s using activated sludge process. However, it is emphasized that the amount of sludge produced depends on the treatment flow rate, the treatment processes used, and the composition of sewage. Notes: a Sampling point located at the entrance of the ABC WWTP (before grit chamber); b effluent of secondary clarifier. "-": data not available due to no measurement.
In the studied plant, the removal efficiencies were: 85.7% COD, 24.5% total N, and 73.5% total P. The COD load was 93,350 kg/day. The total P load that entered the plant during the analyzed period was 2997 kg/d, which totalized around 1094 tons/year. The total N load that entered the WWTP ABC was 6707 kg/day, or 2448 tons/year. Considering that 73.5% of the P total load was removed by the studied plant, which ended up in the sewage sludge, the content of P was estimated to be around 2.2 tons P per day in the sludge.
Analyzing the waste stream composition is essential to the selection of suitable resource recovery technologies. Different technologies may have strengths and weaknesses in targeting specific wastewater components [23]. Data for P concentration (Table 4) in secondary streams allow for technology options for recovery to be defined. The highest P concentration was observed in the supernatant from the gravity thickeners. There was no monitoring of P concentration in the supernatant of digesters. In the case where the nutrient concentration was below 20 mg/L, it was recommended to apply accumulation techniques such as: Wetland or microalgae cultivation, and physicochemical treatment [50]. There was no monitoring for nutrient content in sludge for the studied facility. However, a recent study [51] reported the mean value of 16.4 ± 2.1 (g P/kg of dewatered sludge) for the studied plant (ABC).
Characterization of influent and effluent quality of WWTP provided useful information for designing strategies and selecting processes for resource recovery [5,52]. The next steps aimed to guide on how the WWTP could be improved, defining strategies for recovering resources.

Step 4-Mapping the Demand for Recovered Resources
This step aimed to identify the needs for resources (water, nutrient, and energy) in the local context as well as potential customers (e.g., industries, farmers, and households) for recovered products. Consumption of water, electricity, and fertilizers in the surrounding area and internally in the plant is presented in Table 5. In Brazil, the highest water demand from industries is in São Paulo state (59.7 m 3 /s). The industries of manufacturing of food products, beverages, cellulose and paper, petroleum products, biofuels, chemical products, and metallurgy correspond to 90% of the flow of the water consumption by the national industry [60]. The quality required for industrial uses is highly variable, depending on the sector and level of process sophistication. A further step could be to analyze the quality of the treated effluent to find out if it could meet the specific quality requirements of one industry or a group of them in the same sector. Then, it is possible to evaluate the need for additional treatment to water reuse.
In quantitative terms, in some sectors such as paper and cellulose, chemical products, textile, and cement industries, the water consumed for cooling (non-contact) can represent up to 94%, 95%, 57%, and 82% of the total water consumption, respectively [61,62]. It is worth noting that industries of chemical and textile sectors are predominant in the studied region and represent high water consumption rates ( Figure 4 and Table 5).
Other important water use is agricultural irrigation. In Brazil, the south-eastern region corresponds to the largest irrigated area for agriculture; 34% of the total irrigated area [63]. Reclaimed water could be used for irrigation in agriculture, but currently there is not yet local regulation for water reuse for agricultural irrigation in the state of São Paulo.
The demand for non-potable urban purposes (irrigation of parks, squares, public cleaning, clearing of rainwater galleries, and sewage networks) was based on the volume reported by one plant as commercialized to urban purposes in São Paulo city (Table 5). Comparing the total water demand for the predominant industries, agriculture and urban use (4,339,054 m 3 /month) ( Table 5) and the treated effluent flow that is discharged into the river (4,341,600 m 3 /month) by the studied plant, if directed to reuse, this flow would be sufficient to supply all the water demand for these corresponding purposes.
Electricity consumption data were collected for São Caetano do Sul city, which is close to the WWTP (Table 5) [56]. Regarding the internal demand of the plant, the average energy consumption of WWTP ABC was about 2.6 GWh/month (consumption for all processes). Considering the volume of treated sewage, the energy consumption corresponds to 0.42 kWh/m 3 of treated sewage.
In this paper, the local market value (of phosphate fertilizer, water, and electricity) was estimated to make the analysis more complete. The price for potable water is dependent on the consumed volume. Based on SABESP (service provider), the current fee for potable water in São Paulo city varies from 3.6 € per m 3 (for consumption higher than 50 m 3 /month) to 9.3 € per month (for consumption lower than 10 m 3 /month) in commercial, industrial, and public sectors [64]. This value varies among the cities. Regarding the reclaimed water, there is no standard price for the reclaimed water from treated effluent. According to information from one WWTP in São Paulo city, which sells reclaimed water, the price varies from 0.4 €/m 3  Regarding other megacities, Table 2 provides an indication on which resources (water, energy, or P) are scarce in each megacity, supporting the identification on where resource recovery technologies could be more beneficial. Moreover, detailed sustainability assessments considering stresses based on local data are necessary to identify the most suitable technologies to each context [7].

Step 5-Relevant Legal and Regulatory Framework
In Brazil, legislation (regulation, quality standards, and requirements) related to wastewater treatment focuses more on standards for discharging the treated effluent than on standards for water reuse. In this section, current legislations related to water reuse, energy and nutrient recovery are addressed.
At a national level in Brazil, there are two national regulations for non-potable reuse: National Water Resources Council (CNRH) 54/2005 and CNRH 121/2010. The first defines general criteria for non-potable direct reuse, while the second establishes guidelines for non-potable direct reuse in agriculture and forestry. The states and municipalities may have more restrictive laws and regulations than the national ones [67].
In the state of São Paulo, where this study took place, the joint resolutions SES/SMA/SSRH n.1 (2017) and SES/SIMA n.1 (2020) govern the non-potable direct reuse of water for urban purposes, originated from WWTP, and establish guidelines and general criteria. There are quality standards for uses (e.g., landscape irrigation, washing of streets and other public and private spaces, and civil construction). Irrigation for agricultural uses, grazing and forestry is not included. The WWTP must have at least secondary treatment, disinfection, and filtration, and meet the quality standards and a microbiological characterization of the treated effluent [68,69].
In the state of São Paulo, there is also a decree (48138/2003), which determines some measures for the rational use of water, among which is the prohibition of use of potable water for cleaning streets, squares, and sidewalks, except in specific cases [70]. The Environmental Agency of the State of São Paulo (CETESB) has guidelines for irrigation in agriculture with treated effluent. The application is permitted for fruit gardens, raw uneaten crops, forage (except for direct grazing), reforestation areas, and forest plantations, and establishes some restrictions regarding areas of application and effluent monitoring (heavy metal concentration, thermotolerant coliforms, helminth eggs, sodium adsorption ratio, and electrical conductivity) [71,72]. At the city level, some legislations to promote water reuse from treated effluents for urban non-potable purposes are mentioned in Supplementary Material 2F.
The main barriers to water reuse projects are: No federal program or financial incentives for planning and implementation of water reuse projects (e.g., loan guarantees, tax-free); there are no nationally or locally defined goals (e.g., no obligations or incentives for industries to reuse); the criteria for urban reuse adopted (resolutions n.1/2017 and n.1/2020) in the state of São Paulo are perceived as very restrictive, do not consider agricultural irrigation, and hinder urban reuse [67].
Appropriate policies and the establishment of water quality regulations are required to encourage the creation of markets and the development of water reuse technologies [19].
Regarding energy recovery, the relevant legal and regulatory framework is discussed below. There is a regulation (SMA-079/2009) from the Environment Secretary of the State of São Paulo, which provides guidelines and conditions for operation of thermal treatment of solid waste for energy recovery (e.g., incineration of biosolids) [73]. The Brazilian Electricity Regulatory Agency (ANEEL) establishes the general conditions for the access of microgeneration and mini-generation to the electricity distribution systems (resolution 482/2012). In the case of self-producer, the electricity generated is to meet, partially or totally, the consumption needs of the producer, although the sale of eventual surplus energy may be authorized by ANEEL (law 9427/1996, [74][75][76]).
In Brazil, biomethane from wastes is an emerging biofuel, and the legal framework for biogas and biomethane recovery has been developed, especially for the state of São Paulo [77]. The regulations in the state of São Paulo about biomethane production are in Supplementary Material 2F. The state decrees n. 60,001 (2013) and 60,298 (2014) provide economic benefits (tax deductions) to utilities that recover biogas or biomethane [78,79].
The national regulation (CONAMA 498/2020) [80] defines the criteria and requirements for production and application of treated municipal sewage sludge (biosolids) in soil. Some requirements are environmental permission, treatment processes, criteria for application, and frequent monitoring of the biosolids quality depending on application. This regulation also defines conditions for cultivation of food crops consumed raw and crops whose edible part has contact with the soil as well as for pasture and forages, food crops that are not consumed raw, fruit trees, and nonfood crops [80]. This regulation [80] has been recently published and has updated the previous regulation [81]. It expands opportunities for use of sewage sludge, and in general is more flexible than the previous regulation (in terms of frequency of analyses, guidelines for application, and permitted uses). Therefore, it is expected that this new practice of biosolids for agricultural use will be more widespread in the national territory, contributing to organic matter and nutrient recycling. Biosolids as a product to be applied in soil for agriculture must be registered in the Brazilian Ministry of Agriculture, Livestock and Food Supply (MAPA). It is also possible (based on standard n. 06/2016 of MAPA) [82] to register sewage sludge as a raw material, and to send it externally to a fertilizer or soil conditioner production process. More detailed information about standards on biosolids fertilizer and soil conditioner are in Supplementary Material 2F.
Besides legislation, regional planning documents were consulted (Master Plan of Great ABC region, Municipal Master Plans, Municipal Plan of Sanitation, and others) to identify whether they mention resource recovery from wastewater and/or set goals for implementation. The Policy on Climate Change of the State of São Paulo encourages the methane recovery from anaerobic digester of WWTP [83]. The Action Plan on Climate Change in the Great ABC mentions as strategic the biogas recovery from wastewater treatment plants to reduce GHG emissions. In addition, this plan states that sludge generated by the plants is disposed in landfills and has not explored its energy potential [84]. Municipal master plans (Mogi das Cruzes and São Caetano do Sul cities) mention, as one of their guidelines for the promotion and stimulation through tax incentives, the reuse from WWTP-treated effluent. The Municipal Plan of Sanitation of São Paulo states that new arrangements of reuse of sewage sludge for agriculture and civil construction as well as energy recovery from biogas are studied and highlight the potential of expansion of water reuse from treated effluent [85].
The analysis of the local institutional environment (addressed in step 5) allows for checking whether there is legal compliance and availability of supportive incentives [86]. Consequently, these results support the definition of resource recovery scenarios.

Step 6-Stakeholders Identification
The stakeholders (groups and institutions) are those interested in resource recovery measures, the potential beneficiaries, those who may be impacted by these measures, and the ones that have power to influence the process [29,87]. In our framework, stakeholders were divided into groups (Figure 1) based on their main roles. The stakeholders for assistance with recovery technology, research, and innovation include universities and research institutes as well as private companies in the region. We considered stakeholders mainly in the municipalities close to the plant: São Paulo city, São Caetano do Sul, Santo Andre, São Bernardo do Campo, and Diadema. Some stakeholders identified were universities that offer undergraduate and postgraduate courses in environmental science and engineering fields and conduct scientific research in related topics, research groups, and private companies on resource recovery technologies. Another group of stakeholders is the potential customers or end-users for the recovered product. It includes the main local farmer associations, trade and industrial associations of the study area, and others. All the mapped stakeholders are listed in Supplementary Material 2G.
The identification of stakeholders should also consider governmental agencies active in the field (e.g., water, energy, and agriculture sectors) that act as intermediary and have control on operation [88]. Thus, stakeholders regarded with political and legal support should be considered such as local governments, authorities, and environmental regulatory organizations. Some examples are water resources managers and the river basin committees, municipal secretaries of environment, and the Secretary of Agriculture. Additional stakeholders could be mapped such as the ones to provide funding or stakeholders supporting public awareness activities related to resource recovery acceptance (e.g., non-governmental organizations (NGO)).
During this process (step 6), potential roles and responsibilities should be assigned to different stakeholders and how they can engage and collaborate in the framework application towards resource recovery implementation. Some examples of key roles for universities and research institutes are to perform laboratorial analysis to ensure the quality of the product, to perform risk analyses, life-cycle assessments, and experimental studies, while NGO or public authorities could assist by awareness raising and promotion of resource recovery approach among the public. The company in charge of providing wastewater treatment services owns the studied plant and their plant managers or board of directors are important stakeholders. In our case study of the framework application, it was considered hypothetically that the water and sanitation provider would manage and coordinate the resource recovery system. We highlight that the list of stakeholders (Supplementary Material 2G) is not exhaustive and can be updated in the future.
All the identified relevant stakeholders could contribute with their opinions and participate actively in the resource recovery project formulation, which would result in an acceptable solution within the local context. Thus, design strategies could incorporate the stakeholders into the decisionmaking process for a better governance [22,89]. In step 6, it is expected that representatives of the mapped stakeholders' groups have regular meetings. It could include interactive workshops (group learning, discussion of the current state, and strategies and pathways, as proposed by Iwaniec et al. [90]). In these collaborative meetings, the stakeholders could provide practical recommendations for overcoming some of the barriers to planning and implementation of resource recovery target solutions [91].
Results from Laura et al. [22] corroborate with our findings regarding the lack of contact among the stakeholder's groups. For instance, WWTP managers and local authorities have very little collaboration with scientific experts and negligible relationships with NGOs, causing an absence of technical support to WWTP. Some measures to address this barrier are visits to universities for demonstration of technologies/studies related to resource recovery, pilot-scale projects in WTTP to increase the collaboration with research universities, benchmarking of successful operational practices in other contexts, and the regular stakeholders' meetings (as suggested previously).

Steps 7 to 9-Comparison between Resource Recovery Technologies Options
Previous steps of the framework assisted decision-making about which resource is worth being recovered. Based on this diagnosis (steps 1 to 6), the energy recovery and sludge management (e.g., nutrient recycling) seem to have higher potential and to be priorities according to consulted regional planning documents, and based on a previous study [31], when these options were reported as an area of interest by plant managers. The choice of recovery technologies considered the existing technology set-up in the plant, the level of development of the technology, and the availability of a thorough data basis for analysis. Only processes at full-scale (reported in the literature) were considered.
The scenario evaluation captured the necessary infrastructure updates, operational changes, and reuse applications [92]. Our purpose was not to produce an exhaustive evaluation of all possible technological alternatives that could be employed to recover resources. Instead, we focused on the most appropriated ones based on the previous steps of the framework and on previous literature.
The evaluated scenarios are listed as follows (Table 6): A: Struvite production from supernatant obtained from thickeners and digesters, and sludge dewatering centrate. Crystallization of struvite with magnesium (Mg) and pH increase via NaOH (sodium hydroxide). Examples: Fluidized bed reactor Pearl ® , Struvia ® , and others. B: Organic fertilizer and soil conditioner production from windrow co-composting of dewatered sludge. Pre-treatment by mixing different types of wastes (e.g., sawdust/wood chips, chopped urban pruning, sugarcane bagasse, and eucalyptus husk) to achieve the C/N ratio of 20:1 to 30:1 [93,94]. During composting, the temperature of sludge rises to about 50-60 °C, which reduces the pathogen content. After composting, screening using sieves. C: Energy recovery from biogas of anaerobic digesters. Co-digestion with food waste from street markets. Optimum temperature: 35-36 °C [95,96]. Otto cycle engine to generate electricity [97]. D: Energy recovery by co-processing of sludge as raw material and fuel in kilns for cement industry. Pre-treatment for extra drying of sewage sludge (e.g., fluidized bed dryers and rotary dryers, solar drying, or by recovering residual heat from the cement kiln) until moisture content is less than 30%-25% [98][99][100]. The sewage sludge should be fed to a kiln system from the main burner, kiln inlet, or pre-calciner [99].
Technologies for P recovery based on sludge ashes were not included among the scenarios, because the plant does not perform sludge incineration and it is not a common route in Brazil (for municipal sewage sludge). The existing sludge disposal route in the plant is an important variable that influences the cost [101].

D. Energy (Co-processing of Sludge in Cement Industries) Technical and Environmental
Recovery potential 10%-40% from WWTP influent P and 85%-95% of P input of the recovery process 1 Estimate for the studied plant 2 : About 532.6 kg of P/day (in struvite) Organic matter content in dewatered sewage sludge (50%-70%), N (3.4%-4%), P (0.5%-2.5%) and micronutrients [118][119][120]. Full-scale biogas recovery initiatives already take place in Brazil, including one plant with codigestion in Paraná state (20,000 m 3 of biogas/day) (TRL 9) [131] Full-scale, few applied in Brazil (sewage sludge corresponds to 0.4% of the total amount of coprocessed wastes by cement companies in Brazil) [142] (TRL  9) Resource utilization (e.g., energy and chemical consumption) Electricity: 4.9-6.6 kWh/kg P rec., reactants consumption: MgCl2*6H2O 7.7-8.5 kg/kg P rec. and NaOH: 0.2-0.22 kg/kg P rec. 4 [103] Low energy demand and low demand for reagents for composting (it may require micronutrient addition and additives to the product) [22] Electricity consumption for pretreatment: 35 kWh per ton of organic waste [132]. Electricity consumed by Otto cycle engine: 2% of the total generated (up to 219.9 kWh/day) [133]. Water consumption: 0.37 m 3 per ton of waste (in pre-treatment) [134] Energy consumption for sewage sludge drying: 30 to 1400 kWh per ton of evaporated water (depends on the process) [143,144]. Estimate for the studied plant: 34,577.88 kWh/day [11] Indicator A. Phosphorus (struvite recovery) B. Nutrients and organic matter (Sewage sludge co-composting) C. Energy (biogas from codigestion with food waste) D. Energy (co-processing of sludge in cement industries) Need for additional skilled labor Require a high degree of operator skill to maximize the recovery efficiency, additional labor and maintenance requirements [108,109] Additional personnel for operation of composting [22] (middle), simple operation 12 Additional personnel for operation of biogas recovery system and of pre-treatment of food waste (middle, authors' estimation) [135,136] Low (authors' assumption). No need of additional skilled personnel for sludge coprocessing, especially in industries which already perform co-processing  6 : Considering processes Ostara ® , DHV ® , PRISA ® , P-RoC ® , and Nuresys ® ; 7 : Considers Nuresys ® process; 8 : Authors' assumption based on site visit and observation; 9 : Estimated by authors based on [115][116][117]; 10 : Based on consulted legislations and regulations valid in the study region (authors' assumption); 11 : Explanation in SM3; 12 : Based on authors' experience; Biosolids: Compost; 13 : Explanation in the text (Section 3.1.7); 14 : Authors' estimation based on electricity price [135] and estimated generated power from co-digestion.
Existing P recovery techniques (e.g., struvite crystallization) are economically feasible with high P concentration streams (>50 mg-P/L), such as sludge liquors obtained from anaerobic digestion [153,154]. The recovery potential of struvite was estimated for the case study. Based on Jansen et al. [104], it was estimated that the thickeners' supernatant flow corresponded to 1%-2% of the raw wastewater flow, which approximately equaled to 35.1 L/s. The digester supernatant flow was around 29.23 L/s (0.5%-2% of raw wastewater flow), and the reject water from dewatering was 8.2 L/s. These side streams could be directed to a reactor for P recovery-precipitation, and about 10%-40% of P in the raw wastewater could be recovered [104]. There were no data for P concentration in the digester supernatant for our case study, but according to literature, sludge liquor (thickener supernatant, dewatering centrate, and the anaerobic digestion side streams) had total P concentrations between 110 and 289 mg/L [105,106]. Considering the flow of the P-enriched streams (72.53 L/s), a mean P concentration (100 mg/L), and the average rate of recovery of 85% from P influent (supernatant), the estimated P recovered would be 532.6 kg/day in the studied plant. This value would be enough to meet the annual fertilizer demand (P2O5) in the study area (Table 5).
However, for the removal of lower P concentrations, both operational and investment costs would be higher [102]. The studied WWTP does not have enhanced biological phosphorus removal (EBPR); thus, it could be a limitation for struvite recovery processes from the liquid phase [106]. The polyphosphate contained in P-accumulating organisms (PAOs) can be released as orthophosphate when EBPR sludge is digested [155], facilitating struvite recovery [156]. By combining EBPR and P precipitation, a great percentage of P in solution could be recovered as struvite [157]. If the studied plant applied EBPR, the P content in sludge would increase, consequently allowing for a higher recovery.
Regarding scenario B, a previous study [158] in another WWTP in Brazil showed that the composting process was enough to produce a compost that complied with the national quality standards (from the National Environmental Council) for heavy metals and pathogens. Thus, we expect that the composting scenario will be suitable to meet the quality requirements, but further regular analyses of the sewage sludge composition for the studied plant are necessary. A recent study by Nascimento et al. [51] investigated the quality of dewatered sludge generated in several plants in São Paulo state and assessed the suitability of the sludges for agricultural applications. Considering the results for São Paulo megacity plants, all sludge samples complied with the threshold values from CONAMA standards (National Environmental Council [81]), except for samples from two plants where Zn exceeded the maximum permitted. The authors considered the sludge promising as agricultural correctives to soils due to their high pH and micronutrient contents (Fe, Zn, and Mn). Regarding organic contaminants (e.g., pharmaceuticals and persistent organic pollutants) in sewage sludge, in Brazil, this research field is incipient so far. Souza et al. [123] evaluated aromatic polycyclic hydrocarbons (APH) in sewage sludge in Porto Alegre (Brazil) and found that the concentration was lower than the limits established by the European Union for APH. Another study [159] showed degradation of antibiotics during co-composting of sewage sludge with vegetable wastes (in Morocco).
Co-digestion with fruit and vegetable wastes was chosen for scenario C because it can improve biogas yield [160]. In addition, anaerobic sludge digesters are usually oversized due to low organic sludge loading, indicating capacity to receive other substrates, enabling co-digestion [97,161]. Considering methane production, the lower calorific value of methane (9.97 kWh.Nm-3CH4) [139], and assuming an electric conversion efficiency of 38% [135], the generator power capacity would be 405-501.7 kW. In addition, considering 8000 operating hours per annum by the motor-generator [135,162], the annual and daily power generation capacities were estimated (Supplementary Material 3 and Table 6).
A low temperature in digesters (22 °C) was noted for our case study. Thus, the following improvements in operation conditions were suggested: The increase of temperature of digesters, and frequent measurement of biogas flow and its composition. These matters (digesters operation) are currently under consideration by SABESP (wastewater treatment company). It is also possible to suggest the implementation of a co-generation system to recover thermal energy from exhaust gases of the engine for heating the digesters, which would increase the efficiency of the process [163].
For scenario D, the following aspects should be considered. The dewatered sludge in the studied plant contained humidity between 60.6% and 74.5%; thus, it would be necessary to dry the sludge before forwarding it to cement industries. Supplementary Material 2H contains some drying options. Another relevant aspect when exploring sewage sludge as fuel for co-processing is the proximity between the WWTP and cement industries. There are cement industries across the state of São Paulo, which makes it a possible alternative. However, in Brazil, fossil fuels represent 82% of calorific value in cement industries [142], and the use of sewage sludge for co-processing is irrelevant, being just some tests until the present moment. Sewage sludge corresponded to 0.4% of the total amount of coprocessed wastes by cement companies in Brazil [142]. However, it is expected that it will increase significantly, particularly in south-eastern and southern regions in 2030 [164].
In developing countries, the most common routes for sludge disposal are landfilling and agricultural application [27]. These countries usually have little or no waste management infrastructure; therefore, properly controlled co-processing can be a practical, cost-effective, and more sustainable option instead of landfill and incineration [165]. In the metropolitan region of São Paulo, the sewage sludge is disposed in landfill [31]. In the studied plant, 113 tons of dewatered sludge was produced per day. Thus, scenarios B and D represent promising sustainable solutions to sewage sludge management.
Based on their quality, the fertilizer or soil conditioner products (scenarios A and B) could be used for several applications such as landscaping in agriculture to restore degraded land or to cultivate crops, especially sugarcane, eucalyptus, ornamental plants, and in some cases, coffee and vegetables, following the existing standards (step 5). The electricity produced by scenario C would be used to supply part of the internal demand in the WWTP (about 10%-13% of the total electricity consumed daily). For scenario D, the recovered energy would be used by cement industries. Considering two cement industries with kilns for clinker production (about 134 and 115 km of the WWTP ABC) [166], the thermal energy recovered by scenario D could meet about 2.3% of its total thermal energy demand annually (Supplementary Material 2H).
Social acceptance depends on the context and issues can be more critical for facilities in a densely populated region rather than in a nearly inhabited area [150]. One of the most influential factors associated with public acceptance in wastewater sector is the level of contact [167]. For scenarios C and D (energy recovery), the social acceptance is not truly relevant since these solutions do not directly affect the local population (no contact). Differently, the acceptance of plant managers and cement industries for these options could be aspects for further investigation.
In addition, concerns about environmental risks and human health associated with resource recovery measures can affect acceptance. For struvite recovery in agriculture, low acceptance can be attributed to low environmental awareness, lack of knowledge of public, and few scientific studies on this topic [168]. Until the present moment, struvite granules have been unknown by local fertilizers consumers in the São Paulo metropolitan region [18].
Regarding acceptance of compost from sewage sludge, there is a positive example in Jundiai city (60 km from São Paulo city) where the acceptance of the product is very good, and it does not represent a barrier. According to the technical director, responsible for composting facility, they have not done any prior acceptance studies, but they conducted initiatives such as promotion of visits to their plant, lectures, dissemination of information, sales offers, and participation in events with farmers. There was no resistance to the use of the product due to its origin (sewage sludge as raw material). The quality of the produced compost meets the standards (e.g., heavy metal concentration and pathogens-thermotolerant coliforms, Salmonella sp., and helminth eggs) [128]. In our scenario B, the composting plant could be built inside the WWTP area to reduce transportation costs, then only the compost volume (final product) would have to be transported.
As addressed in Table 6, all scenarios require further changes and demand necessary training for operators of the recovery processes. Further aspects that contribute to a better decision on recovery strategies are analysis of the final products and estimation of the market size [126]. However, concerning the economic indicators, cost calculations and estimates related to recovery processes are challenging, since there is no market for the recovered products in some cases. Indeed, the development of the market can occur in parallel to the implementation of resource recovery solutions in the WWTP.
The selected example WWTP already performs water reuse. Thus, in the future, other measures that could take place in parallel with the increase of its treatment capacity would be the expansion of water reuse for internal purposes, industrial supply and for other sectors such as irrigation, nonpotable urban purposes, and for indirect potable reuse through discharging of the treated effluent in water reservoirs (of water supply systems).
The different scenarios (step 9) can provide new insights in the design of sustainable value chains. Delanka-Pedige et al. [169] have proposed the wastewater infrastructure attributes that support sustainability: Reuse-quality of water recovered from wastewater; safe pathogen reduction from wastewater; energy use and recovery in wastewater treatment; biofertilizer recovery from wastewater; and emission (direct and indirect) reduction in wastewater treatment. The recovery scenarios proposed (Table 6), together with the existing water reuse practice contribute to sustainability in all these attributes.
The proposed framework supports the application of a circular economy at a regional level, through the integration of production and consumption systems. In practice, the success of a circular economy approach in the water and sanitation sector will depend on some factors such as partnerships among stakeholders, user engagement, and overcoming of existing barriers [170]. In this context, there is a need for tools that enable the translation of scientific results to create an evidence base that supports decision-makers to act [171,172]. The proposed framework can be an example of tools that fit to this purpose.
Considering all indicators (Table 6 and Figure 5) for the studied plant, scenario B seems to be the most favorable for nutrient recovery due to low costs, high recovery potential, and a lesser requirement for skilled labor. For energy recovery, biogas recovery seems more favorable considering the set of indicators. In terms of institutional and political indicator, the biogas recovery scenario is the most favorable. Steps 10 and 11 were not considered in this paper, since the resource recovery solution implementation was not part of this research, and decision-making depended on wastewater treatment plant managers' and local stakeholders' preferences. For instance, they could assign a high weight to one of the sets of indicators (e.g., economic or environmental), which would influence the final choice about the best solution among the defined scenarios [26]. Depending on stakeholders' and decision-makers' preferences, more than one scenario could be chosen, or they could be combined.
Overall, prior to a decision on implementation of any resource recovery technology (e.g., nutrient recovery), it is recommended that quantitative flows and qualitative data should be more thoroughly analyzed (e.g., nutrient content in the supernatants and in sludge, and other relevant parameters such as contaminants).

Strengths of the Proposed Framework and Comparison with Similar Studies
Some frameworks related to urban water management have been proposed and can play an important role to enable sustainability assessments, planning, and decision-making at different scales [173]. Frameworks can be useful to multiple purposes: To enable the diagnosis of a specific current situation, to be a management tool, to assess opportunities of improvement, and to facilitate stakeholder engagement and communication [173]. The framework tested in our study fits all these purposes.
Previous studies have developed frameworks for water reuse [21] and sludge management [22]. Papa et al. [21] developed a tool for evaluating the water reuse from technical and economic sustainability. Their framework aimed to judge the feasibility of wastewater reuse and considered the rating of the WWTP, hydraulic system (required for transportation), and the final user. The need for additional/polishing treatment of the effluent to satisfy quality criteria, and an increase of the costs (e.g., for plant upgrade, water distribution system, and the monitoring of reuse system) were considered as constraints to water reuse [21].
Laura et al. [22] created a framework to guide decision-making towards selecting sustainable options to handle sewage sludge. It included the evaluation of possible scenarios and considered four dimensions: Economic, environmental, social, and technical. Similarities with our study were the inclusion of stakeholder analysis (mapping), characterization data of sewage sludge, and analysis of local regulation.
O'Dwyer et al. [23] created a framework focusing on the optimization of design schemes of treatment plants and transport networks. In their assessment, environmental impacts and financial costs were considered for each scenario. Kehrein et al. [24] presented a framework for designing and planning of WWTP towards resource recovery activities. Some similarities compared to our framework are market analysis for recovered resources, inclusion of stakeholders, treatment performance analysis, and techno-economic and environmental assessment.
In our study, the proposed framework is not restricted to water reuse or sludge scenarios and serves for assessing other resource recovery measures, including more indicators and involving a variety of stakeholders. Thus, compared to previous developed frameworks, our framework is more comprehensive and offers descriptive instructions on how to approach each step. Another highlight is the final step of implementation and monitoring, which allows to optimize the recovery process and/or restart the framework application to combine with other resource recovery solutions.
One advantage of the proposed framework is that it could be easily presented to third parties with no specific technical background. Operationalization of the framework may be complicated and complex especially in data-scarce regions, but applying the framework in a collaborative way with key stakeholders (representatives of different groups/sectors) could facilitate the process and contribute to an increase in managers' and policy-makers' understanding of the subject (resource recovery).
Planning in the sanitation sector in developing countries should consider a multi-sectoral approach recognizing the interrelations between sanitation and other sectors such as water supply and solid waste management [174]. Van der Kooij et al. [17] highlighted the importance of making connections between wastewater treatment systems, agri-food systems, and ecological aspects to find more suitable recovery options. In our study, the application of the framework allowed us to identify these interactions and contributed to a better knowledge on recovery options.
Our framework aimed to capture context-specific characteristics to make a better decision. This addressed the future research needed mentioned by Diaz-Elsayed et al. [7] about the analysis of demand for resources and potential resources that can be recovered within design and local conditions. By applying our framework, it would be possible to identify potential challenges in the selection and implementation of resource recovery process configurations (e.g., water, energy, and nutrients), and as an additional step it was possible to restart the framework application (from step 7) to combine technologies to recover different resources. This should facilitate decision-making on integrated resource recovery since the previous steps were already concluded. Thus, the new framework had a practical value and allowed for plant managers to think about new potential solutions by providing relevant information. The proposed framework could also be complementary to the City Blueprint Framework, which is a tool that evaluates urban water management in a city [33].

Practical Challenges as well as Future Directions and Perspectives
After testing the framework with the case study, suggestions for improvements were evaluated.
Step 7 (the choice of resource to be recovered) could be placed before step 6. Then, based on the target resource potential, key stakeholders could be mapped. This could make conducting step 6 easier and quicker; i.e., narrow down the number of stakeholders. Other suggestions for future applications of the framework were to limit the scale of analysis, for instance, to a smaller geographical area (at a city level or a neighborhood), or to a specific sector as an end-user (industry or agriculture). We believe that it could reduce the complexity of analysis and reduce the amount of data required, and, consequently, the challenges related to data collection and availability, despite losing the holistic perception of recovery alternatives and the view of the interactions at different scales.
Another possibility could be to start the framework application at step 6 (identifying stakeholders), particularly for contexts and places where data are scarce. It would likely facilitate (reduce time demand) the process to gather data needed for applying the other steps of the framework. For instance, if stakeholders from a local environmental agency/government were involved from the beginning, they could assist in the identification of the relevant legal and regulatory frameworks.
In this study, the authors considered the application of the framework for recovering of water, energy, and nutrients, although it is highlighted that the framework could be adapted for application even in different contexts (e.g., WWTP in urban or rural areas) and for other target resources.
The planning process requires detailed and accurate data and information. In step 9, in order to perform more accurate evaluations, it is recommended to replace qualitative limits by quantitative values as mentioned by a previous study [22]. This could be done in future studies, depending on data availability.

Limitations
The presented findings captured only a snapshot in time, conveying the current developments of recovery technologies and providing the framework application considering the data collected during a specific period. But the study region is very dynamic. Therefore, some aspects and data continually change in short or long terms (e.g., price of recovery technology, demand, and regulations), and the analysis through the proposed framework should be updated or restarted. According to Van der Hoek et al. [14], many external factors may change over time due to technological, environmental, economic, and market developments, and these uncertainties can influence the possibilities of resource recovery implementation. Other limitations noticed during application of the proposed framework was the lack of availability of some input data (e.g., some parameter concentration of treated effluent and sludge composition data, and costs for struvite precipitation in the Brazilian context).
Finally, we would like to emphasize that integrated evaluations at large-scale are characterized by a high degree of complexity (as mentioned by Papa et al. [21]). This was the case for our study, because we considered a large area, and the steps of the framework considered several types of data.
The results of framework application depend on the overall availability of input data. Therefore, it highlights the need for improvement of monitoring practices either in a wastewater treatment plant or beyond (in other sectors; for example, water consumption in urban uses). There is uncertainty associated with secondary data used in the framework. For instance, although we considered the most updated available data, in some cases, they came from various sources.

Conclusions and Recommendations
Through the framework application, local context was deeply analyzed and the demand for water, energy, and P was identified. Some scenarios were recommended, and opportunities for improvement of existing processes were proposed.
Based on the results, all scenarios could be feasible for the studied WWTP, especially biogas recovery from co-digestion and sludge co-composting considering all the technical, environmental, societal, and political/institutional indicators. Local legislations seem to be favorable to implementation in all scenarios, except for struvite recovery, which needs further development. In addition, we recommend tests at pilot scale in the study region before applying struvite at full-scale WWTP. The suggested scenarios have potential to provide environmental benefits such as improvement of effluent quality (scenario A), low CO2 emissions, reduction in global warming potential, and reduction of waste generation (scenarios B, C, and D).
With increasing demands for water, energy and food, particularly in urban areas, recovering resources from sewage is an important strategy. Considering only one WWTP in São Paulo megacity, the authors showed there is a potential to meet all the current demand for phosphorus fertilizer and non-potable water (main industries and agriculture) in the study region. Therefore, in quantitative terms, water reuse from the treated effluent could meet the current water demand for industrial and agricultural uses; and P recovery potentials from recovery scenarios could supply all the current demand for phosphate fertilizer in agriculture in the study region.
In summary, the strengths of the proposed framework are addressing the complexities of dynamic systems and integrating with relevant sectors and stakeholders, while the main limitations include the need of some data, which may not be available. The methodology used in this paper might be applied to other contexts, and the data from the case study (effluent and by-product characterization and potential demand) could be compared to other studies/regions. In addition, the comparison of recovery scenarios based on indicators and literature (Table 6) can be used as a basis for further studies under the circular economy perspective. This paper provided a simple tool as a structuring mechanism to support resource recovery implementation from wastewater treatment, which is useful to managers and decision-makers. The results can help the elaboration of resource recovery projects. The framework refinement and use (presented here) can guide potential applications in other contexts.
In future studies, as soon as the market for recovered products develops, it is possible to calculate economic indicators using detailed local prices, and the social acceptance evaluation after consulting stakeholders and survey with the local community. Further studies could also explore stakeholder engagement and cooperation during framework application. Other relevant and necessary themes are the monitoring of sludge quality, removal of persistent organic pollutants in sewage sludge composting, analysis of risks to environment and human health from its application in soil, monitoring of P in reject water (thickeners, digester supernatants and dewatering centrate), development of local business models for resource recovery, multi-sectoral engagement approaches, and testing of the framework application in other cities. Funding: This study was funded by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior (Brazilian Federal Agency for Support and Evaluation of Graduate Education), Brazil (CAPES), finance code 001, through a scholarship granted to the double degree doctoral student Mariana Cardoso Chrispim.

Acknowledgments:
The authors thank the staff of SABESP (water and sanitation company) for kindly providing the requested data about the studied wastewater treatment plant. We acknowledge the support received from local experts concerning the selected megacities for their contribution by providing related data. We are also grateful to the student Karla Mesquita for assisting in part of the data collection (and the scientific initiation scholarship from Cnpq