Alerts and Notifications for Smart Citizens

Smart cities function on the premises of efficiency and transparency. One of the key requests of smart citizens is to be informed, through modern, digital and personalized means, of issues that might affect them: utility cut-offs, changes in public transportation, exceeding levels of pollutants and so on. In this research, we implement an extension – to an existing smart city notification platform – that consists of a notification and alert module build as a chatbot for Facebook Messenger. We describe the sources of notification data, how we designed the chatbot and current possibilities for users to interact with it and be notified. We also relate on future plans on improving the chatbot.


Introduction
To fulfil the vision of the smart city, "better, faster and more efficient" [1], local governments must provide public services that make the best of current information and communication technologies.
One of the ways is issuing automated alerts and notifications about expected or unexpected issues that interfere with citizen daily plans: water, gas or electricity cut-offs, changes in the schedule or route of public transportation, exceeding levels of pollutants in water or air and others.
Such notifications are usually issued by private and/or public companies that provide the impacted services, most of the times on their website, but rarely as open and easily processable data. To make notifications to properly and effectively arrive at the citizens, the city must implement a notification platform that extracts these notifications from the publishing source and effectively delivers them to interested citizens, through means of emails, SMS, social media messaging apps and others.
One such platform, a smart city notification platform based on open data, has been implemented and described in an earlier paper by the authors [2]. In this paper, we extend the notification capability of the platform via a chatbot integrated in the Facebook Messenger platform.
Chatbots are programs that can have a conversation with humans through text or voice, usually with the help of artificial intelligence [3]. Chatbots have been implemented lately by numerous big companies, such as Facebook, Microsoft's Skype, Amazon's Alexa and others. There are used in various domains, such as customer service, shopping, news, services, health or education. These platforms offer an API through which developers can manipulate the chatbot, irrespective of the server side programming that they choose to use.
Released in 2016 and constantly updated, the Facebook Messenger chatbot platform has the most potential to reach a high number of clients to the platform's popularity.
The paper is organized as follows. While chapter 1 was a short introduction to the researched fields, chapter 2 is a review of similar research done in the field. Chapter 3 relates on the implementation of a Facebook chatbot that notifies citizens of non-emergency issues (to the best of our knowledge, the first of its kind). We present the sources of data that are used, how we designed the chatbot and how it interacts with the users. Chapter 4 presents the conclusions and further work on the prototype.

Related work
Several researchers have studied the implementation of alerts, warnings and notifications in smart cities [4]- [7]. The general design of the proposed systems is based on a publishsubscribe architecture, with aggregated official and non-official sources of information, with personalized and near-real time notifications being delivered to the citizens.
Researchers have studied the application of modern chatbots in such areas as smart homes and surveillance systems [8], sports [9], news [10] or education [11]. Even though Facebook recently announced that it passed 300,000 monthly active chatbots, we could not find a chatbot used in the context of a smart city alerts and notification service.
We presume such chatbots to start being developed, since Facebook introduced the "community alerts" tag for its messages only in February 2018 [12], a method which allows for sending subscribed users such messages.

The Context of the Platform
The City Alerts platform was released in 2014, as part of an effort between the Politehnica University of Timisoara, the Timisoara City Hall and the Smart City Association to open up the government data in the city and create applications that enhance the life of the citizens of Timisoara, the biggest city in the western part of Romania. City Alerts was designed as a platform used to notify citizens of situations when public services do not operate as expected: gas, electricity or water cutoffs, temporary changes in public transportation, roads closed due to public works and so on [2].
The strength of the platform lies in the ability to integrate into a single database heterogeneous data, both in terms of content and format, from various local government agencies that provide it as public open data, and to expose it afterwards through open protocols.
The platform can acquire data through manual submission of notifications, through importing the notifications from open data files (XLS, CSV or XML) or through scraping the content from the agencies' websites.
For this research, we employed the quicker but more painful alternative, the latter one. In the context of student-developed projects at the Programming Languages 2 course, at which the first author of this paper is teaching, we extracted such information provided by these companies on their websites using Python tools and libraries.

Platform data
The following data sources have been scraped for notifications and alerts that would be interesting for the citizens of Timisoara: Cold water. The public company Aquatim, which provides potable water for Timisoara and its surroundings, publishes news in a special section on its website † , some of these news being about planned cut-offs of water supply, usually for urgent works. The information can be accessed through RSS/Atom and streets that will be affected can be extracted from the unstructured text.
Hot water. The public company Colterm, which provides hot water for Timisoara, publishes planned cutoffs of water supply, usually for urgent works, in a special section on its website ‡ . The information can be accessed through RSS/Atom and streets that will be affected can be extracted from the unstructured text.
Electricity. The electricity company Enel, which provides electricity services to the whole area of Banat, is announcing its planned interruptions on a special section § of its website. The interruptions are announced in weekly batches, in PDF format, from which it has to be extracted.
Public transportation. The public transport agency in Timisoara, SPTP, publishes a news section ** on its website, which contains announcements related to temporary or permanent changes of routes in public transportation. The section has an RSS equivalent, however only a few of the announcements are included in this RSS version. As such, we needed to scrape the HTML version of the news section to be able to get all relevant information.
Air quality. The Romanian National Agency for Environmental Protection is publishing data on air quality measured through its more than 100 monitoring stations spread all over the country. There are 4 stations in Timisoara and they show hourly measurements of 5 pollutants, along with quality indexes. These values need be extracted directly from the HTML code of the website † † .
Water quality. The public company Aquatim, already mentioned for supplying potable water, publishes monthly measurements of the quality of the water in all the neighborhoods of Timisoara. Data on 15 chemical and microbiological parameters needs to be extracted from PDFs ‡ ‡ .

The Chatbot
The notification module is built on the Facebook Messenger Developers API [13], using Python on the server-side. The chatbot can be accessed through the Timisoara City Alerts Facebook page. All communication is currently done in Romanian, because this is the primary targeted market.
After answering these two questions, the citizen is subscribed for that particular type of notification. They will receive such notifications when an actual interruption or level overrun will happen (figure 2).

Figure 1
The City Alerts chatbot -Subscribing for a notification Figure 2 The City Alerts chatbot -Receiving the notification On the server side, each interaction with a citizen is identified by a unique ID that Facebook assigns to the user in the context of the City Alerts page. This ID is saved in a database, along with the options of the user (notification domain and street name).
Each time the authorities issue a new notification, it is extracted by our platform from their websites and is run through the database of subscribers. The affected street names are extracted from the public announcement and are compared with those in the database. If a match is found, the citizen will be notified immediately through Facebook Messenger.
The Messenger platform is very strict when it comes to pages sending messages to users, messages that were not preceded in the previous 24 hours by messages from the users to the page. Messenger allows for some specific categories of messages to be sent proactively by the page, one category being that of community alerts. As such, the City Alerts notifications are tagged accordingly when being sent.
The chatbot is currently in active development and will be submitted for reviewing to the Facebook Messenger team, after which it will become public on the Timisoara City Alerts page § § .

Conclusions and future work
In this paper, we report on a notification system, to be used in smart cities, which informs or alerts citizens of non-emergency issues that might affect their daily plans in the city or at home: water, gas or electricity cut-offs, changes in the schedule or route of public transportation or exceeding levels of pollutants in water or air. The notification platform works by pooling such data from public and private utility companies and distributing it to interested citizens through messages on the Facebook Messenger platform. The interested user can currently engage in a conversation with the City Alerts chatbot and request to be notified of selected domain-specific notifications, after providing the information that is necessary for efficient delivery of messages (usually the targeted street name).
As future work, we aim to enhance the current workflow of the chatbot and add new features. As such, we wish to implement:  The option to unsubscribe from all notifications or just some;  The option to change the street one is interested in or even add more than one street;  The option for the user to choose a street name from the official list of street names in the city (to avoid the user submitting a street name that slightly differs from the official version and, therefore, would impede the match process with the public announcements);  The possibility for the user to specify some other information, besides the street name (in the case of public transportation, it is even more important for the user to provide the names of the trams/buses they are interested in);  More sources of data (as they become available from the municipality).