Skip to content

Commit eec44d0

Browse files
authored
Merge pull request #26 from UBC-MDS/feature/project_structure
Update project structure
2 parents d2f8aa7 + a8f139a commit eec44d0

File tree

10 files changed

+3074
-0
lines changed

10 files changed

+3074
-0
lines changed

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: gunicorn src.app:server

data/processed/placeholder.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
TODO: delete this file after adding cleaned data file.

data/raw/tsunami-events.tsv

Lines changed: 2769 additions & 0 deletions
Large diffs are not rendered by default.
File renamed without changes.

reports/data-analysis.ipynb

Lines changed: 276 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,276 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"import pandas as pd"
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": 2,
15+
"metadata": {},
16+
"outputs": [
17+
{
18+
"data": {
19+
"text/html": [
20+
"<div>\n",
21+
"<style scoped>\n",
22+
" .dataframe tbody tr th:only-of-type {\n",
23+
" vertical-align: middle;\n",
24+
" }\n",
25+
"\n",
26+
" .dataframe tbody tr th {\n",
27+
" vertical-align: top;\n",
28+
" }\n",
29+
"\n",
30+
" .dataframe thead th {\n",
31+
" text-align: right;\n",
32+
" }\n",
33+
"</style>\n",
34+
"<table border=\"1\" class=\"dataframe\">\n",
35+
" <thead>\n",
36+
" <tr style=\"text-align: right;\">\n",
37+
" <th></th>\n",
38+
" <th>Search Parameters</th>\n",
39+
" <th>Year</th>\n",
40+
" <th>Mo</th>\n",
41+
" <th>Dy</th>\n",
42+
" <th>Hr</th>\n",
43+
" <th>Mn</th>\n",
44+
" <th>Sec</th>\n",
45+
" <th>Tsunami Event Validity</th>\n",
46+
" <th>Tsunami Cause Code</th>\n",
47+
" <th>Earthquake Magnitude</th>\n",
48+
" <th>...</th>\n",
49+
" <th>Total Missing</th>\n",
50+
" <th>Total Missing Description</th>\n",
51+
" <th>Total Injuries</th>\n",
52+
" <th>Total Injuries Description</th>\n",
53+
" <th>Total Damage ($Mil)</th>\n",
54+
" <th>Total Damage Description</th>\n",
55+
" <th>Total Houses Destroyed</th>\n",
56+
" <th>Total Houses Destroyed Description</th>\n",
57+
" <th>Total Houses Damaged</th>\n",
58+
" <th>Total Houses Damaged Description</th>\n",
59+
" </tr>\n",
60+
" </thead>\n",
61+
" <tbody>\n",
62+
" <tr>\n",
63+
" <th>0</th>\n",
64+
" <td>[]</td>\n",
65+
" <td>NaN</td>\n",
66+
" <td>NaN</td>\n",
67+
" <td>NaN</td>\n",
68+
" <td>NaN</td>\n",
69+
" <td>NaN</td>\n",
70+
" <td>NaN</td>\n",
71+
" <td>NaN</td>\n",
72+
" <td>NaN</td>\n",
73+
" <td>NaN</td>\n",
74+
" <td>...</td>\n",
75+
" <td>NaN</td>\n",
76+
" <td>NaN</td>\n",
77+
" <td>NaN</td>\n",
78+
" <td>NaN</td>\n",
79+
" <td>NaN</td>\n",
80+
" <td>NaN</td>\n",
81+
" <td>NaN</td>\n",
82+
" <td>NaN</td>\n",
83+
" <td>NaN</td>\n",
84+
" <td>NaN</td>\n",
85+
" </tr>\n",
86+
" <tr>\n",
87+
" <th>1</th>\n",
88+
" <td>NaN</td>\n",
89+
" <td>-2000.0</td>\n",
90+
" <td>NaN</td>\n",
91+
" <td>NaN</td>\n",
92+
" <td>NaN</td>\n",
93+
" <td>NaN</td>\n",
94+
" <td>NaN</td>\n",
95+
" <td>1.0</td>\n",
96+
" <td>1.0</td>\n",
97+
" <td>NaN</td>\n",
98+
" <td>...</td>\n",
99+
" <td>NaN</td>\n",
100+
" <td>NaN</td>\n",
101+
" <td>NaN</td>\n",
102+
" <td>NaN</td>\n",
103+
" <td>NaN</td>\n",
104+
" <td>4.0</td>\n",
105+
" <td>NaN</td>\n",
106+
" <td>NaN</td>\n",
107+
" <td>NaN</td>\n",
108+
" <td>NaN</td>\n",
109+
" </tr>\n",
110+
" <tr>\n",
111+
" <th>2</th>\n",
112+
" <td>NaN</td>\n",
113+
" <td>-1610.0</td>\n",
114+
" <td>NaN</td>\n",
115+
" <td>NaN</td>\n",
116+
" <td>NaN</td>\n",
117+
" <td>NaN</td>\n",
118+
" <td>NaN</td>\n",
119+
" <td>4.0</td>\n",
120+
" <td>6.0</td>\n",
121+
" <td>NaN</td>\n",
122+
" <td>...</td>\n",
123+
" <td>NaN</td>\n",
124+
" <td>NaN</td>\n",
125+
" <td>NaN</td>\n",
126+
" <td>NaN</td>\n",
127+
" <td>NaN</td>\n",
128+
" <td>3.0</td>\n",
129+
" <td>NaN</td>\n",
130+
" <td>NaN</td>\n",
131+
" <td>NaN</td>\n",
132+
" <td>NaN</td>\n",
133+
" </tr>\n",
134+
" <tr>\n",
135+
" <th>3</th>\n",
136+
" <td>NaN</td>\n",
137+
" <td>-1365.0</td>\n",
138+
" <td>NaN</td>\n",
139+
" <td>NaN</td>\n",
140+
" <td>NaN</td>\n",
141+
" <td>NaN</td>\n",
142+
" <td>NaN</td>\n",
143+
" <td>1.0</td>\n",
144+
" <td>1.0</td>\n",
145+
" <td>NaN</td>\n",
146+
" <td>...</td>\n",
147+
" <td>NaN</td>\n",
148+
" <td>NaN</td>\n",
149+
" <td>NaN</td>\n",
150+
" <td>NaN</td>\n",
151+
" <td>NaN</td>\n",
152+
" <td>3.0</td>\n",
153+
" <td>NaN</td>\n",
154+
" <td>NaN</td>\n",
155+
" <td>NaN</td>\n",
156+
" <td>NaN</td>\n",
157+
" </tr>\n",
158+
" <tr>\n",
159+
" <th>4</th>\n",
160+
" <td>NaN</td>\n",
161+
" <td>-1300.0</td>\n",
162+
" <td>NaN</td>\n",
163+
" <td>NaN</td>\n",
164+
" <td>NaN</td>\n",
165+
" <td>NaN</td>\n",
166+
" <td>NaN</td>\n",
167+
" <td>2.0</td>\n",
168+
" <td>0.0</td>\n",
169+
" <td>6.0</td>\n",
170+
" <td>...</td>\n",
171+
" <td>NaN</td>\n",
172+
" <td>NaN</td>\n",
173+
" <td>NaN</td>\n",
174+
" <td>NaN</td>\n",
175+
" <td>NaN</td>\n",
176+
" <td>NaN</td>\n",
177+
" <td>NaN</td>\n",
178+
" <td>NaN</td>\n",
179+
" <td>NaN</td>\n",
180+
" <td>NaN</td>\n",
181+
" </tr>\n",
182+
" </tbody>\n",
183+
"</table>\n",
184+
"<p>5 rows × 46 columns</p>\n",
185+
"</div>"
186+
],
187+
"text/plain": [
188+
" Search Parameters Year Mo Dy Hr Mn Sec Tsunami Event Validity \\\n",
189+
"0 [] NaN NaN NaN NaN NaN NaN NaN \n",
190+
"1 NaN -2000.0 NaN NaN NaN NaN NaN 1.0 \n",
191+
"2 NaN -1610.0 NaN NaN NaN NaN NaN 4.0 \n",
192+
"3 NaN -1365.0 NaN NaN NaN NaN NaN 1.0 \n",
193+
"4 NaN -1300.0 NaN NaN NaN NaN NaN 2.0 \n",
194+
"\n",
195+
" Tsunami Cause Code Earthquake Magnitude ... Total Missing \\\n",
196+
"0 NaN NaN ... NaN \n",
197+
"1 1.0 NaN ... NaN \n",
198+
"2 6.0 NaN ... NaN \n",
199+
"3 1.0 NaN ... NaN \n",
200+
"4 0.0 6.0 ... NaN \n",
201+
"\n",
202+
" Total Missing Description Total Injuries Total Injuries Description \\\n",
203+
"0 NaN NaN NaN \n",
204+
"1 NaN NaN NaN \n",
205+
"2 NaN NaN NaN \n",
206+
"3 NaN NaN NaN \n",
207+
"4 NaN NaN NaN \n",
208+
"\n",
209+
" Total Damage ($Mil) Total Damage Description Total Houses Destroyed \\\n",
210+
"0 NaN NaN NaN \n",
211+
"1 NaN 4.0 NaN \n",
212+
"2 NaN 3.0 NaN \n",
213+
"3 NaN 3.0 NaN \n",
214+
"4 NaN NaN NaN \n",
215+
"\n",
216+
" Total Houses Destroyed Description Total Houses Damaged \\\n",
217+
"0 NaN NaN \n",
218+
"1 NaN NaN \n",
219+
"2 NaN NaN \n",
220+
"3 NaN NaN \n",
221+
"4 NaN NaN \n",
222+
"\n",
223+
" Total Houses Damaged Description \n",
224+
"0 NaN \n",
225+
"1 NaN \n",
226+
"2 NaN \n",
227+
"3 NaN \n",
228+
"4 NaN \n",
229+
"\n",
230+
"[5 rows x 46 columns]"
231+
]
232+
},
233+
"execution_count": 2,
234+
"metadata": {},
235+
"output_type": "execute_result"
236+
}
237+
],
238+
"source": [
239+
"tsunami_df = pd.read_csv(\"../data/raw/tsunami-events.tsv\", sep=\"\\t\")\n",
240+
"tsunami_df.head()"
241+
]
242+
},
243+
{
244+
"cell_type": "code",
245+
"execution_count": null,
246+
"metadata": {},
247+
"outputs": [],
248+
"source": []
249+
}
250+
],
251+
"metadata": {
252+
"interpreter": {
253+
"hash": "9cf86d0032c8e6952af4744e4377bec25a132416a1bc37aa0ea1dd7e4c795237"
254+
},
255+
"kernelspec": {
256+
"display_name": "Python 3.10.2 ('532')",
257+
"language": "python",
258+
"name": "python3"
259+
},
260+
"language_info": {
261+
"codemirror_mode": {
262+
"name": "ipython",
263+
"version": 3
264+
},
265+
"file_extension": ".py",
266+
"mimetype": "text/x-python",
267+
"name": "python",
268+
"nbconvert_exporter": "python",
269+
"pygments_lexer": "ipython3",
270+
"version": "3.10.2"
271+
},
272+
"orig_nbformat": 4
273+
},
274+
"nbformat": 4,
275+
"nbformat_minor": 2
276+
}

requirements.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pandas
2+
gunicorn
3+
altair
4+
dash
5+
dash_bootstrap_components
6+
plotly

src/app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from dash import Dash, html
2+
3+
app = Dash()
4+
server = app.server
5+
6+
app.layout = html.Div("Hello world!")
7+
8+
app.run_server()

src/components/__init__.py

Whitespace-only changes.

src/util/__init__.py

Whitespace-only changes.

src/util/clean_data.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pandas as pd
2+
3+
def read_data(path):
4+
"""
5+
TODO: add docstring
6+
"""
7+
8+
if not path:
9+
raise ValueError("Path of raw data file is required")
10+
11+
# TODO: additional path validation required
12+
13+
return pd.read_csv(path, sep="\t")

0 commit comments

Comments
 (0)