CIUDAD LIMPIA VALDIVIA: A MOBILE AND WEB BASED SMART SOLUTION BASED ON FOSS TECHNOLOGY TO SUPPORT MUNICIPAL AND HOUSEHOLD WASTE COLLECTION

Ciudad Limpia Valdivia is a Web and Mobile application which attempts to tackle some of the Municipality of Valdivia in Chile’s waste collection issues. It is based on Free and Open Source Software and it is currently in the last stage of prototyping. The tool is expected to improve the communication between the users and the service provider. It also has educational materials about waste management and other related environmental issues to guide the users to minimize the waste production and optimize the way it is handled before it is collected. The main features of the solution are: a dynamic map viewer showing the position of the Municipality’s waste collection trucks and estimated future trajectories, a form to report illegal dumping microsites, notifications from the Municipality about the status of the service, educational content and contact list of other independent initiatives related to waste collection. The potential impact of the tool was evaluated on the city’s test pilot sector by means of a neighbourhood survey. It showed that the solution might have a positive impact in the coordination in terms of the service operation. The estimation of the trucks’ future trajectory will be developed using machine learning or computational intelligence algorithms. The integration of FOSS technologies has been essential to address challenges found during development as well as to adapt the tool to new scenarios. The feedback from the Municipality and the community has proved to be very important to define a concrete solution.


INTRODUCTION
Currently, waste disposal management is still a challenge for any city (Ferronato andTorretta, 2019, McGrath, 2019). Usually, local governments such as municipalities are tasked to oversee waste management in their cities (World Bank, 2019, Benito et al., 2021. When disrupted or in operational conditions which are not optimal, this fundamental city process produces great discomfort for the citizens. It can even become a health issue (World Bank, 2018, Ferronato andTorretta, 2019) and it has a negative impact on the city's aesthetics. The latter is of particular relevance in cities with a highly developed tourism industry.
In the case of Valdivia, and probably other cities around the world, some suburban areas are covered by a service without a regular schedule for waste collection trucks due to different causes such as traffic and weather conditions. For this and other reasons, some residents place their garbage on the streets well in advance to ensure collection. However, in Valdivia, medium or large waste disposal bins are not in widespread use and trucks collect domiciliary waste on a "home-by-home" basis. Therefore, the prolonged exposure of the garbage carries the risk of waste dispersion as an effect of climate conditions or by stray animals. This can in turn become a serious problem for peoples' health and contamination of the soil or aquifers.
Additionally, local initiatives by individuals or small companies aimed at recovering waste for reuse or recycling are not able to coordinate with the municipality's collections service in an * Corresponding author optimal way. For instance, municipal waste collection trucks might arrive earlier than small scale private waste collectors to get the recyclable materials and the municipal waste collector truck collectors throw all the waste unsegregated in the truck during collection. This occurs due to lack of a city policy on waste segregation to help have an integrated waste management. Also, unexpected disruptions in the service are not communicated to the citizens in a timely manner since there is not a formal medium of communication between the municipality and the citizens for these matters. Moreover, illegal dumping in areas such as urban wetlands or less dense areas has become an increasingly frequent problem for the municipality and their official reporting hotlines are not centralized. Sometimes, the location of the reporting, after responding to the separate individual calls, was the same location. Thus, causing additional work to prepare the official responses to each reporting.
As part of the efforts in several cities around the world to become "smart", mobile applications and other IT solutions are being developed and deployed. Such is the case of Reciclapp Chile (Reciclapp Chile, 2021) that is being utilized as a tool to promote waste segregation of recyclable materials. On the other hand, RecoleccionAPP Climpia (Ciudad  or CLimpiaAppOperación (Ciudad Limpia Bogotá SA ESP, 2021) are mobile apps that control and monitor the entire operation of waste collection in different cities in Colombia. It is mostly oriented to private waste collection truck operators not directly for the community. There exist several mobile applications in Canada and the USA which provide information on the schedules of waste material pick-ups for recycling (Bothwell, 2020). Another example is Waste Less (HKSARG, 2021) mobile app developed by the government of Hong Kong to show nearby collection points. Unfortunately, each city and, in particular, the city's waste collection procedures exhibit unique features which make reusing existing solutions for other cities difficult to adapt to another city. Ciudad Limpia Valdivia is a Web and Mobile application which attempts to tackle some of the aforementioned issues for the Municipality of Valdivia in Chile. It is based on Free and Open Source Software and it is currently in the last stage of prototyping. Its development has incorporated geospatial analyses as well as some tools from computational intelligence and machine learning. In particular, approximately one year of the municipality's waste collection routes captured by Satellite Navigation Systems have been used to study the system's behaviour for a target neighborhood. Also, surveys were conducted in that neighborhood to evaluate the interest in the application and to assess its potential impact. The waste collection routes dataset will now be used to train a system capable of estimating the arrival of the corresponding waste collection truck to a particular point selected by the user, using machine learning techniques. The "real-time" position of the trucks is shown in the application, thus giving feedback to the user of the current status of the service. Another important feature of the application is the illegal dumping (microbasurales 1 ) reporting that will be received by the municipality. Ciudad Limpia Valdivia's goal is to be a bridge of communication between the citizens and the municipality. This paper will present the general concept design of the whole application, the survey's results, the current development status and preliminary analyses of the routes dataset. It will also discuss the next stages in the project as well as future work after the prototyping phase is finished. Additionally, the discussion will address the importance of Free and Open Source Software in this kind of application with a social impact in the community.

CONCEPT DESIGN OF CIUDAD LIMPIA VALDIVIA
The project has been developed since the early stages from the point of view of the household waste collection user. From this perspective, and given the problems described in section 1, it was possible to identify that by improving communications between the service provider (or providers) and the users a significant impact could be achieved; mainly in terms of better coordination in the operation, improved users' confidence in the service, increased robustness against unexpected perturbances or disruptions in the service.
The core of the solution is a web platform which integrates dynamic and static information from different sources, such as waste recollection service providers, educational resources database, recollection vehicles real-time position providers and service users. To complement the web platform, a dedicated mobile application is also developed.
A general block diagram of the system is shown in Figure 1.
The Smart route estimation system block receives the real-time position of the garbage collection trucks provided by the GNSS 1 Microbasurales are areas where unregulated or illegal dumping of solid wastes had accumulated. In Valdivia, there were several reports of microbasurales by the community and were being reinforced through campaigns against it from the municipality (Flores, 2018). provider and based on the historical route data stored in a database estimates the remainder of the route for a specific truck given its current position. On the other hand, the Smart route optimization system block was expected to work "off-line" and use historical route data to provide the Municipality with optimal routes which could lead to reduce operational costs. However, in the initial discussions with the Municipality, they considered this component of low priority and thus its development has been postponed for future versions of the system. Additionally, the web platform and its complementary mobile app provides educational information regarding the concepts of Reduce, Reuse, and Recycling as well as information related to waste segregation and environmentally friendly waste management at an individual scale. This information has been curated from government plans and campaigns as well as academic sources and other resources released by environmental NGOs.
An example of such materials can be seen in Figure 2. The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences, Volume XLVI-4/W2-2021 FOSS4G 2021 -Academic Track, 27 September-2 October 2021, Buenos Aires, Argentina As it was mentioned earlier, the Municipality has not yet implemented waste segregation procedures. However, several private initiatives from individuals to small and medium sized companies are providing recollection services for segregated waste such as glass, paper, organic material suitable to produce compost, electrical and electronic appliances, batteries and oil. For these providers, the system maintains a database with contact information accessible by the users through the web or mobile application.
Some implementation details will be discussed next. In particular the interface to the real-time GNSS based position of the waste recollection trucks, the web and mobile applications, the interface to integrate information from the Municipality and the route estimation component will be briefly described next. The development progress status of these and other components is discussed in section 4.

Accessing the recollection truck position
All of the Municipality's garbage recollection trucks are monitored using GNSS. The service is provided by a third party to the Municipality. For this research project the Municipality granted the development team full access to the service, including routes' historical data, real-time tracking of trucks using proprietary client application, and access to a proprietary REST API of the service. The REST API is used by a lightweight middleware developed in Python using FIWARE open-source Smart City Platform's components (FIWARE Foundation, e.V., 2021). The proprietary REST API is under-documented an is not self-discoverable. However, the provider's technical support staff was available to guide in how to access the required information.
The FIWARE framework was selected for long-term scalability and possible integration with other Smart City applications which might be developed in the future.

The Web app
General users can access the system through a web interface which has been developed on top of the "Justice" HTML5 Bootstrap Template (FreeHTML5.co, 2017). The template, which is released under the CC-by 3.0 License, is itself based on the open-source Bootstrap CSS framework (Bootstrap team, 2018) allowing the development of responsive, mobile-friendly web front-ends. Using the web interface the users can: find links to the mobile app, report illegal dumping microsites, access related educational information, get service status notifications posted by the Municipality, find contact information on other initiatives for the recollection of segregated waste materials, access a dynamic map showing the position of recollection trucks, and check the estimated future route for a selected truck. Figure 3 shows the report and map pages from an early stage of the web app's development.

The Mobile app
A mobile app developed using the open-source Ionic framework (Ionic, 2019) and the Angular framework (Google LLC, 2017). The mobile app provides the same functionality of the web interface. Screenshots of the current development (alpha) version are presented in Figure 4.

Map rendering
Maps are rendered in both the web and the mobile apps using Leaflet (Agafonkin, 2020) and OpenStreetMap data (Open-StreetMap contributors, 2019). The maps show the location of multiple selected recollection trucks and the estimated remaining route for one selected truck. The user can manually select the position in the map. Alternatively, geolocation can be used, too. The development team has also contributed related map features such as containers for segregated waste to the Open-StreetMap catalogues.

Getting updated information from the Municipality
Since the Municipality is already using different social media as channels to provide updated information about the recollection service to the community, a Python application developed using the Twitter API (Twitter, Inc., 2021) finds tweets from the Municipality with specific hashtags to transform them into notifications for the web interface and then pushed as notifications to the mobile app using a self-hosted notification server such as Gotify (Mattheis, 2021), AirNotifier (Cai, 2021) or equivalent.

Estimating the recollection route
The route estimation system will use machine learning techniques (to be determined) to generate an estimation of the remaining of the route given the current position and based on the routes historical data for a single selected truck.
Some of the complexities in the estimation and general issues when processing the data are further discussed in section 5.
The following section describes the response and interest from the community in the sector where the beta version of the prototype will be tested.

INTEREST OF THE COMMUNITY
The "El Bosque" sector in the city of Valdivia was identified and chosen as the pilot study area with the aide of the Department of Sanitation and Landscaping (Departamento de Aseo y Ornato) to test the prototype. A survey was conducted last August 24, 2019 to know the interest of potential users or beneficiaries of using a technological application that would show the garbage truck routes and municipal service notices or announcements, and possible reporting of microbasurales.  (Cochran, 1977) as shown in Eq. 1 and Eq. 2, respectively.
where n = sample size z = confidence interval N = total population (number of housing) p = population proportion e = margin of error Based on the homogeneous characteristics, wherein there is no significant diversity in the social structure of the neighborhood and also the neighbors were being attended by the same waste collection workers, a confidence interval of 90% and a margin of error of 5% where considered in the calculation. A p-value of 0,5 was set for maximum variance value possible for the sample size.
On the other hand, using the sample size obtained in Eq. 1, the minimum number of housings to be visited for the survey was estimated. Several maps showing the sample size proportions were prepared for the enumerators for guidance using the opensource QGIS software (QGIS.org, 2021). Fig. 5 shows one of these generated maps. In the survey results, it was found out that, even though the respondents have knowledge of the schedule of the household waste collection, they were not aware of the truck's route. 94,7% of the 78 respondents (one more than the calculated sample size) in the pilot study area indicated that they have access to internet and the use of their mobile device (smart phones) to install an application and navigate a web page to access waste collection related information guarantee the usability and scalability of the project.

CURRENT DEVELOPMENT STATUS
The project is currently in pre-alpha stage with different degrees of progress in the different components. The approximate percentage of completion for each component in order to reach alpha stage and begin testing the prototype is plotted in Fig  When all components reach 100% alpha stage will be reached and the first tests will be carried out.
75%, most of the required functionally is implemented except the real-time display of the recollection trucks' position and the notifications from the Municipality because these two components are not completed yet. The web platform is currently undergoing a major upgrade in terms of visual style controlled by CSS to match the style of the mobile application.
The system for route estimation shows approximately 30% of progress. Several complexities related to the normalization and processing of the routes historical data have slowed down the development of this component. More details about them are discussed in section 5.
The code implementing the interface with the Municipality based on the Twitter API has been developed and tested at a "proof-ofconcept" level (50% of progress). The next step is to integrate it to the web and mobile applications.
The mobile app has reached an estimated of 60% of progress. The user interface is fully developed. However, the functionality is still in development.
The routes historical database is completed and it has been "normalized" (more details about this in the next section). It contains the routes of all the recollection trucks since the GNSS system was installed in each one.
The interface to access the real-time position from the Municipality's third party provider is functional. Currently, the FIWARE based component is in the latest stage of development and will be then integrated to the web and mobile apps, achieving an approximate progress of 90%.
The environmental educational database has been completed and its contents are ready to be served through the web and mobile applications. Some of its contents have been already released in social media to keep the community engaged.

PRELIMINARY INSIGHTS ON THE ROUTES DATASET
While analysing the trucks' route historical data, it was found that the GNSS position of each truck is recorded once per minute. Although the trucks collect domiciliary waste on a "home-byhome" basis, the position recording frequency is not enough to capture all details of the route. In particular, if a simple interpolation of the points is used, the interpolated lines do not match the actual streets and every so often go "across" houses or other buildings. Therefore, before feeding a machine learning algorithm to train a route estimation system, a better approximation of the actual routes should be obtained. The main approach is to find which are the most probable street or road segments which correspond to the truck route. A simple solution to this problem which is currently being tested is to use a routing algorithm between two consecutive points in the recorded route. Since the distance between points at the one minute interval is usually small, it works for many cases. However, during the preliminary tests in the proof-of-concept stage, in some situations, particularly, when the truck is moving at higher speeds, the output from the routing algorithm is unlikely to be the actual route of the truck. The OSM routing library for Py-thon3, pyroutelib3 (Kuranowski and White, 2021) was used to test the "proof-of-concept".
Another important issue is that even though most of the time the same truck do the same route every week, under some circumstances, for instance, if the truck is under maintenance, a truck with a different ID from the point of view of the GNSS provider will operate on that route. Therefore, an algorithm to detect the route independently of the truck ID is required. It is expected that also another machine learning algorithm can be trained to identify the different routes with as few points of the route as possible. This algorithm should be robust in terms of perturbances of the service, such as delays due to heavy traffic, detours produced by road blocks, etc.
Another complexity in the data arose from the fact that the provider has changed over time the data format of the route data. Particularly, dates and times are stored in different formats and with different precision. Also, the field names have been changed. For this reason, it was necessary to develop a tool to "normalize" the historical data, so all relevant fields have consistent information.

FUTURE WORK
In the short term, a dry run will be conducted upon finalizing a working prototype (reach alpha stage) to test and calibrate the programming of the web and mobile applications. This will be done mainly in the El Bosque neighborhood to test the prototype along with the collaboration of the Municipality of Valdivia through the Department of Sanitation and Landscaping. The waste collection truck driver and collector will also test the prototype and observe the movement of the collector using a mobile device. Aside from that, a short workshop with the interested local initiatives that are involved in the promotion of reducing, reusing, and recycling processes will be organized. Their presence in the apps is important so the local community will know where they can contact and bring recyclable materials that can be recovered before ending in the regulated dumping site of the city. This could promote circular economy in the city itself.
In the medium to long term, the functionality of the apps will be reviewed and monitored, and with the help of the user's feedback, the apps will be improved until it reach a scalable and stable version. Aside from that, a potential community of developers could be formed to improve and maintain the apps.

CONCLUSIONS
At the beginning, the idea was developed solely from a user perspective. Later, it was possible to contact the Municipality and integrate them in some brainstorming sessions. Their feedback was extremely valuable and it helped focus the solution to a more concrete and feasible product. It is very important in this kind of development to receive feedback from as many stakeholders as possible. This will ensure that the solution is well suited for all interested parties.
The FOSS technologies play a central role in the development of this system. Most complexities can rapidly be addressed by integrating components available from different FOSS-based projects.
Based on the existing apps found, unique solutions were being develop since the ordinances, policies, laws, and/or culture are unique in different cities or countries. With this in mind, FOSS is useful in spreading and adapting solutions in other places, with same basic functionalities but different terminologies or interface design.
The survey helped the project in defining some new ideas to improve the functions of the applications and what kind of information that it will have. The survey results showed that the implementation of this kind of smart technology would give the residents access to information to know the routes and where their garbage go. In addition, the residents would have access to notifications, could report and request the cleaning of microbasurales, and could receive quick responses from the municipality regarding these reports.
In terms of the development progress, most of the components are more than 50% complete. The route estimation system is the one that still requires significant work. It is important to mention that the COVID-19 pandemic and, just before it, the social unrest in Chile have impacted negatively in the development's pace. However, the project is still advancing and it is expected to reach alpha stage in the short term. This will allow to begin the first trials and move to the beta phase.
The complexities dealing with the routes historical dataset as described in section 5 were underestimated at first. Until we were granted access to the data, we expected it to be at least homogeneous, since it came from a single provider. Also, the temporal resolution was not enough to capture the details of the recollection service. We expect that the machine learning or computational intelligence approach which will be used to process the data is capable of coping with these challenges.