COVID-19 Update: Text me the latest COVID-19 stats from a location
Tags: twiliohackathon
Published: 2020-04-17 02:00:08

[See Github.](https://github.com/ShreyRavi/covid-19-sms)

## What I Built
In these tough times, I found myself being worried not just for my own family, but for the families of my friends all around the US. Thus, I ventured to create a Twilio-powered SMS service that returns COVID-19 stats for zip-code, state, and city, powered by my favorite thing ever, Flask (minimalist engineer's dream) at +1(231) 774-2545. Coded for the [Twilio Hackathon](https://dev.to/devteam/announcing-the-twilio-hackathon-on-dev-2lh8). 

<p align="center"><img src="https://raw.githubusercontent.com/ShreyRavi/covid-19-sms/master/covid-19-sms-screenshot.png" height="93%" width="93%">Screenshots of the COVID-19 SMS Update Service in action.</p>

## Usage/Live Demo at +1(231) 774-2545!
The COVID-19 SMS Update Service can be used by texting [+1(231) 774-2545](sms://+12317742545) with a zip-code, a City, State Code (such as Chicago, IL), or a state (such as IL or Ohio) to get the latest COVID-19 updates for that area. One can call [+1(231) 774-2545](tel://+12317742545) to get these instructions read out loud.

## Link to Code
[GitHub Repo](https://github.com/ShreyRavi/covid-19-sms)

### Examples
> Text [+1(231) 774-2545](sms://+12317742545) a zip-code

Input:
```
77001
```
Output:
```
04/13 COVID-19 SMS Update:
Harris County, Texas:
Confirmed Cases: 3629
Deaths: 44
Source: New York Times. Thanks for using COVID-19 SMS Update!
```

> Text [+1(231) 774-2545](sms://+12317742545) a City, State Code

Input:
```
Kansas City, MO
```
Output:
```
04/13 COVID-19 SMS Update for Kansas City, MO:

Platte County, Missouri:
Confirmed Cases: 25
Deaths: 0

Jackson County, Missouri:
Confirmed Cases: 213
Deaths: 7

Clay County, Missouri:
Confirmed Cases: 48
Deaths: 1

Source: New York Times. Thanks for using COVID-19 SMS Update!
```

> Text [+1(231) 774-2545](sms://+12317742545) a State

Input:
```
WA
```
Output:
```
04/13 COVID-19 SMS Update for Washington:
Confirmed Cases: 10411
Deaths: 511
Source: New York Times. Thanks for using COVID-19 SMS Update!
```

> Call [+1(231) 774-2545](tel://+12317742545)

See for yourself!

## [Live Homepage](https://covid-19-sms-update.herokuapp.com/)
The SMS and voice routes are hosted on the Heroku repo above.

## Local Setup
1. Clone Repository
```
git clone https://github.com/ShreyRavi/covid-19-sms.git
```
2. PIP install requirements
```
pip install -r requirements.txt
```
3. Run Flask app and open browser to `http://localhost:5000/`
```
python3 app.py
```
4. Use `ngrok` to expose your `http://localhost:5000/` online.
```
./ngrok 5000
```
5. Configure your Twilio web-hook fields for 'Messaging' and 'Voice' to the `ngrok` generated site on your Twilio dashboard.

## How I Built It
I'm not very adept at Twilio nor programming in general (pretty much only coded for school stuff so far!), but I decided to spend some time learning how to during this quarantine :) I learned from the excellent documentation at Twilio's website on how to set up Flask and `ngrok` to test SMS inputs, and then it was a simple program to convert requests to zip-codes to parsing online CSVs using pandas to end up here :) It may not be much, but I learned a lot and plan to improve on it much further!

## Built With
- [Flask](https://palletsprojects.com/p/flask/)
- [Twilio](https://www.twilio.com/)
- [ngrok](https://ngrok.com/)
- [zipcodes](https://pypi.org/project/zipcodes/)
- [pandas](https://pandas.pydata.org/)
- [numpy](https://numpy.org/)
- [Heroku](http://heroku.com/)
- [Gunicorn](https://gunicorn.org/)

## Data Source/Attribution
The COVID-19 data is sourced from the New York Times's public GitHub repository CSV of COVID-19 data, from [here](https://github.com/nytimes/covid-19-data).

## Future Plans
- More intelligent request handling
- Efficiency improvements
- Multiple data sources
- More granular reports
- Regular subscription to reports