Skip to content

Commit 4674802

Browse files
Merge branch 'dev' into feature/structure
2 parents 1ee60dc + 6d7cf5d commit 4674802

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Accessing the App via Heroku
44

5-
Link to Heroku app: [tsunami-events-dashboard](https://dashboard.heroku.com/apps/tsunami-events-dashboard)
5+
Link to Live App: [Tsunami Events Dashboard](https://tsunami-events-dashboard.herokuapp.com/)
66

77
## Description of the App Interface
88

docs/reflections-milestone2.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Reflections for Milestone 2
2+
3+
*By **DSCI 532 Group 11***
4+
5+
## What we have implemented
6+
In this milestone, we have attempted to create three plots.
7+
First, a map plot highlighting the intensity of earthquakes and the countries that were affected by the tsunami (underwater earthquakes).
8+
Second, a scatter plot to plot the trend of the earthquakes according to its intensity on the Richter Scale.
9+
Third, a bar chart to highlight the top 10 tsunamis with the highest tsunami intensity of a given time period. (This is different from the earthquake intensity on the Richter Scale).
10+
11+
To use this dashboard, the user will be able to toggle the specific years and countries that they will like to examine on the left sidebar.
12+
The default argument for the time period for all three plots will from 1802 to 2022.
13+
The default argument for the countries for the map plot and scatter plot will be all countries.
14+
The scatter plot will highlight the top 10 countries from 1802 to 2022.
15+
16+
The bar chart will only take in the values for the years, and not the countries as it
17+
will display the top 10 most intense tsunamis across the world based on time period specified.
18+
19+
## What could be improved
20+
The structure of the dashboard needs to be improved greatly to make it more streamlined. Moreover, we would like to increase the functionality of the sidebar where users can collapse it,
21+
such that the plot is rendered larger. Moreover, we would like to add a buttom besides the scatter plot and bar chart, to inform readers about how to interpret the 'Richter Scale' and 'Tsunami Intensity'.
22+
23+
The convention of the naming of the functions within each component can also be improved, to allow future collaborators to understand our code with ease.

src/components/dropdown.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@
66
PROCESSED_DATA_PATH = "data/processed/tsunami-events.csv"
77

88
def preprocess(year_start, year_end):
9+
"""The function to return the processed dataframe with a new index column
10+
and combination column of the country and year. Also filters the df
11+
based on the callback year slider for tsunamis occurring between
12+
specific dates, then reorders by tsunami intensity.
13+
Parameters
14+
----------
15+
year_start : int
16+
the lower bound of the range of years selected by user
17+
year_end : int
18+
the upper bound of the range of years selected by user
19+
Returns
20+
-------
21+
df:
22+
a processed dataframe with additional columns and filtered
23+
data
24+
"""
925
df = pd.read_csv(PROCESSED_DATA_PATH)
1026
df['tsunami_instance'] = range(1, len(df) + 1)
1127
df['tsunami_instance'] = df.index
@@ -17,6 +33,20 @@ def preprocess(year_start, year_end):
1733
return df
1834

1935
def create_bar_plot(year_start, year_end):
36+
"""The function to create a bar graph of the highest intensity
37+
tsunamis between the year_start and year_end.
38+
Parameters
39+
----------
40+
year_start : int
41+
the lower bound of the range of years selected by user
42+
year_end : int
43+
the upper bound of the range of years selected by user
44+
Returns
45+
-------
46+
bar plot object
47+
horizontal bar graph of greatest intensity tsunamis with tooltip
48+
to glean further information when hovering over each bar.
49+
"""
2050
df = preprocess(year_start, year_end)
2151
chart = alt.Chart(df).mark_bar().encode(
2252
x=alt.X('tsunami_intensity:Q', title = 'Tsunami Intensity', scale=alt.Scale(domain=(0, 12))),

0 commit comments

Comments
 (0)