Step 1: Data Preparation & Cleanup
The data set consisted of key elements to allow us to dig deeper in to global earthquake trends dating back to 1600 though it was noted that the level of detail was limited prior to 1930. In an effort to better analyze the data, we modified the “Name” column which provides earthquake location information using Python and decided to only keep the location name prior to the “:” which most often is the country in this dataset, although in some instances it refers to the state.
Step 2: Database & Server Setup
Python Flask powered RESTful API, HTML/CSS, Javascript, and MongoDB were utilized for the visualization. In our first python file (datacleanup.py), preparation of data occurred including: cleansing of the data, renaming a column and exporting the CSV file into a JSON file to be utilized by MongoDB. Within the second Python file (app.py), one route pulls all of the data from MongoDB to send to Javascript upon the call to the route and the second route applies filters to the data based on user selections. When a user selects one or more filters on the HTML page, Javascript pulls those values and sends them in a request to Python. In Python, using MongoDB the filters are applied and the filtered data is then returned to Javascript. Regardless if the user selects one or multiple filters, the logic can pull the data and send the filtered data set to Javascript.
Step 3: HTML & CSS
While the logic.js file helps us pull the information filtered by the user, our HTML file renders it on the web. The CSS file, in addition to Bootstrap, helps with the styling of the website and dashboard.
Step 4: FINAL TOUCHES
We created 4 different types of visualizations (heatmap, scatter plot, histogram, and stacked bar chart) to better showcase earthquake occurrences and magnitudes from 1600 - 2020 around the world.