Inspiration

According to the World Health Organization, 4.2 million deaths every year occur due to outdoor air pollution. Exposure to air pollution can result in significant health problems such as decreased lung function, aggravated asthma, and increased respiratory symptoms.

Additionally, UV radiation exposure is a risk factor for skin cancer, cataracts, and other ill-ness. The incidence of skin cancer, including melanoma, has increased due to excess exposure to UV radiation. To alert individuals of both air quality and UV index outdoors, along with several other weather conditions, we created Zeus the weather bot.

What it does

Zeus alerts individuals via call or text about weather conditions. After the user messages the number with ‘start’ and enters their location, they have 3 options for interacting with Zeus. The first option allows them to receive current weather condition data which includes temperature, the chance of precipitation, cloud coverage, wind speed, UV index, visibility, humidity, and air quality.

The second option allows them to receive daily reminders - at a time of their choosing - of any selection of the weather conditions outlined above. A user might, for example, decide to receive a UV index reminder every morning to determine how much sunlight exposure is safe.

The third option allows users to set up alerts that will continue for the following 24 hours. These alerts will notify users of certain weather conditions, such as when the air quality increases to possibly hazardous levels. A user may set up an alert for the UV index on a day they go outside in order to warn them from experiencing UV radiation.

The user is always able to access the help menu with the command “help me”. From here, the user can access the menu, delete their reminders, and change their location. The service is currently functional for the entire U.S. subcontinent.

How we built it

We developed the backend for the chatbot using Twilio API and Python Flask to deliver automated SMS messages and phone calls. The Twilio API uses a webhook to redirect SMS messages to the Flask backend which houses Zeus’s implementation. This Flask backend is hosted on an AWS EC2 instance. After the user initially messages the Zeus phone number, they are prompted to enter their location. This phone number and location data is then sent to our Google Cloud Firestore database.

When the user requests for weather data pertaining to their current location, our Flask backend calls the WeatherBit API using the stored location data. When the user wants to create a reminder or alert, the Flask backend creates and stores reminder objects in an SQLite database. This database is accessed by the reminder system which ensures that reminders and alerts are being sent out periodically as necessary.

Challenges we ran into

We were having trouble handling phone numbers who wanted multiple reminders at different times. So if someone wanted an alert at both 9 am and 9 pm, the program had difficulty determining when to send the alert. Our solution was accessing the reminders SQLite database using the hour parameter in order to be able to distinguish between different reminders created by the same phone number. Additionally, using the 24-hour time method made it much easier to store and manipulate time values.

There was initial difficulty in figuring out how to get the weather API to work for our uses. We had some difficulty accessing the API with a key and figuring out what the API could offer for our project ideas. In the end, we became more familiar with the methods and made our project idea more flexible to create our product.

Given our unfamiliarity with Twilio, we had some trouble deciding how to work with contacting and receiving input from users. This meant experimenting with the API and figuring out which best fit the purposes of our project. In the end, we had a mix of texting and calling users for weather alerts and updating preferences, with a heavier emphasis on texting.

Accomplishments that we're proud of

One of our main accomplishments was being able to efficiently retrieve data from the WeatherBit API in order to ensure there was not a very large delay between the user’s texts and our Zeus bot’s responses.

For the majority of our team members, this was their first time working with the Twilio API so we are proud that we were able to use Webhooks in order to receive messages from the Twilio API to the Flask backend.

What we learned

Privacy and security are of great concern to maintain user trust in our app. We must ensure compliance and other industry best practices to protect our users’ data while offering convenient services. In order to attain this, we ensured that user’s could only affect create and delete reminders from the individual’s own phone number.

The SMS messaging and phone call notification system we developed with the Twilio API is extremely powerful and has the potential to improve the quality of life for millions of people across the globe.

What's next for Weather Bot

Currently, Zeus only supports locations within the U.S. The next step would be expanding this to include users across the globe and help millions of users.

Another feature implementation would be adding custom thresholds that users can adjust for reminders and alerts.

Share this project:

Updates