This project will takes message data stored in csv files and process it using an ETL and ML pipeline. The result will then be accessible through a webapp running locally. The data has been provided by figure-eight and it is comprised of real messages that were sent during disaster events, that have been categorized based on the nature of the message: e.g. aid, earthquake, shelter, water, etc. The application will determine to which category any new message belongs to.
This project was developed using:
- pandas 0.24.1
- sqlalchemy 1.2.17
- nltk 3.4
- scikit-learn 0.20.2
- plotly 3.5.0
- flask 1.0.2
- joblib 0.13.1
The project has the following file structure:
workspace
├── README.md
├── app
| ├── run.py
| └── templates
| ├──go.html
| └──master.html
├── data
| ├── disaster_categories.csv
| ├── disaster_messages.csv
| └── process_data.py
└── models
└── train_classifier.py
- app: Folder containing the webapp. Html templates are stored in the subfolder
templates
. running therun.py
file will start the flask app. - data: Folder containing the raw data in csv file form as well as the
process_data.py
file which starts an ETL pipeline generating a sqlite database. - models: Folder containing
train_classifier.py
which trains and saves a model to be used in the app.
-
Run the following commands in the project's root directory to set up your database and model.
- To run ETL pipeline that cleans data and stores in database
python data/process_data.py data/disaster_messages.csv data/disaster_categories.csv data/disaster_response.db
- To run ML pipeline that trains classifier and saves
python models/train_classifier.py data/disaster_response.db models/disaster_response
- To run ETL pipeline that cleans data and stores in database
-
Run the following command in the app's directory to run your web app.
python run.py
.Note that for run.py to run properly the database needs to be called
disaster_response.db
and the modeldisaster_response.joblib
-
Go to http://0.0.0.0:3001/