FantasticTony commited on
Commit
d16d6dd
·
1 Parent(s): d2916af

init commit

Browse files
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
.idea/IS_445_Final_Project_Part2.iml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="JAVA_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$" />
6
+ <orderEntry type="inheritedJdk" />
7
+ <orderEntry type="sourceFolder" forTests="false" />
8
+ </component>
9
+ </module>
.idea/encodings.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Encoding" native2AsciiForPropertiesFiles="true" />
4
+ </project>
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ </profile>
5
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="Python 3.13 (final-project-part2-u8uBTYck-py3.13)" />
5
+ </component>
6
+ <component name="GOROOT" url="file:///opt/homebrew/opt/go/libexec" />
7
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Python 3.13 (final-project-part2-u8uBTYck-py3.13)" project-jdk-type="Python SDK">
8
+ <output url="file://$PROJECT_DIR$/out" />
9
+ </component>
10
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/IS_445_Final_Project_Part2.iml" filepath="$PROJECT_DIR$/.idea/IS_445_Final_Project_Part2.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
app.py CHANGED
@@ -5,78 +5,108 @@
5
  # 4. Open a Simple Browswer with View --> Command Palette --> Simple Browser: Show
6
  # 5. use the URL from prior steps as intput into this simple browser
7
 
8
-
9
  import altair as alt
10
  import pandas as pd
11
  import streamlit as st
12
 
13
- st.title('Streamlit App for IS445: ID29724')
 
 
 
 
 
14
 
15
- st.text("The URL for this app is: https://huggingface.co/spaces/FantasticTony/is445_demo")
 
 
 
16
 
17
- licenses_data = pd.read_csv('data/licenses_fall2022.csv')
 
18
 
19
- licenses_data_filtered = licenses_data[['License Type', 'License Status', 'LastModifiedDate']]
20
- licenses_data_filtered['LastModifiedDate'] = pd.to_datetime(licenses_data_filtered['LastModifiedDate'], errors='coerce')
21
- licenses_data_filtered.dropna(subset=['LastModifiedDate'], inplace=True)
22
 
23
- # chart 1
24
- license_type_counts = licenses_data_filtered['License Type'].value_counts().head(10).reset_index()
25
- license_type_counts.columns = ['License Type', 'Count']
26
 
27
- chart1 = alt.Chart(license_type_counts).mark_bar().encode(
28
- x=alt.X('License Type:N', sort='-y', title='Top 10 License Types'),
29
- y=alt.Y('Count:Q', title='Number of Licenses'),
30
- color=alt.Color('License Type:N', legend=None)
 
 
 
 
 
 
 
 
31
  ).properties(
32
- title='Distribution of Top 10 License Types',
33
  width=600,
34
- height=400
35
- )
36
-
37
- # chart 2
38
- licenses_data_filtered.loc[:, 'Year'] = licenses_data_filtered['LastModifiedDate'].dt.year
39
- license_status_counts = licenses_data_filtered[
40
- licenses_data_filtered['License Status'].isin(['ACTIVE', 'NOT RENEWED', 'EXPIRED'])]
41
- license_status_counts = license_status_counts.groupby(['Year', 'License Status']).size().reset_index(name='Count')
42
-
43
- chart2 = alt.Chart(license_status_counts).mark_line().encode(
44
- x=alt.X('Year:O', title='Year (YYYY)'),
45
- y=alt.Y('Count:Q', title='Number of Licenses Issued'),
46
- color=alt.Color('License Status:N', title='License Status')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  ).properties(
48
- title='License Status Over Time (Filtered for Key Statuses)',
49
  width=600,
50
- height=400
51
- )
52
-
53
- # APP
54
- st.title('Licenses Data Visualization')
55
-
56
- st.write("## Introduction")
57
- st.text("""
58
- This app provides visual insights into licensing data by focusing on the distribution of license types and
59
- tracking the trends of license statuses over time. The visualizations aim to simplify the exploration
60
- of the dataset and highlight key insights into how licenses are distributed and change year over year.
61
- """)
62
- st.write("## Visualization 1: Distribution of License Types")
63
- st.altair_chart(chart1, use_container_width=True)
64
-
65
- st.text("""
66
- This bar chart shows the distribution of the top 10 license types in the dataset. I chose a bar chart
67
- because it is effective for comparing categorical data like license types. The colors help to visually
68
- differentiate each category, and focusing on the top 10 types makes the chart more readable and
69
- less cluttered. If I had more time, I would add interactive tooltips to display additional
70
- information about each license type, such as the percentage of the total.
71
- """)
72
-
73
- st.write("## Visualization 2: License Status Over Time")
74
- st.altair_chart(chart2, use_container_width=True)
75
-
76
- st.text("""
77
- This line chart shows the number of licenses by key statuses over time.
78
- The chart helps to visualize trends in the renewal and activity status of licenses. I chose different colors
79
- for each status to make it easy to distinguish between them. Filtering for key statuses allows for a clearer
80
- view of the most important trends without overwhelming the viewer. If I had more time, I would include an option
81
- to filter by license type to see how specific types have changed over time.
82
- """)
 
 
 
 
5
  # 4. Open a Simple Browswer with View --> Command Palette --> Simple Browser: Show
6
  # 5. use the URL from prior steps as intput into this simple browser
7
 
 
8
  import altair as alt
9
  import pandas as pd
10
  import streamlit as st
11
 
12
+ st.title('Group 5 Final Project - Part 2 (Dashboard)')
13
+ st.text("Group Members: Nabeel Bashir, Tony An, Devansh Kumar, Jiajun Li")
14
+
15
+ st.text("The URL for this app is: https://huggingface.co/spaces/fa24-is445-group5/Final_Project_Part2")
16
+
17
+ ev_data = pd.read_csv('data/Electric_Vehicle_Population_Data.csv')
18
 
19
+ st.title('Electric Vehicle Population Data Dashboard')
20
+ st.markdown('''Explore the electric vehicle data interactively using this dashboard.
21
+ This dashboard helps experts and stakeholders understand the distribution and characteristics of electric vehicles
22
+ in various counties and cities.''')
23
 
24
+ county_list = ev_data['County'].unique()
25
+ make_list = ev_data['Make'].unique()
26
 
27
+ selected_county = st.sidebar.selectbox('Select County', county_list)
28
+ selected_make = st.sidebar.multiselect('Select Make', make_list, default=make_list)
 
29
 
30
+ filtered_data = ev_data[(ev_data['County'] == selected_county) & (ev_data['Make'].isin(selected_make))]
 
 
31
 
32
+ st.subheader('Filtered Data')
33
+ st.write(filtered_data)
34
+
35
+ st.subheader('Distribution of Electric Vehicle Types')
36
+ ev_type_count = filtered_data['Electric Vehicle Type'].value_counts().reset_index()
37
+ ev_type_count.columns = ['Electric Vehicle Type', 'Count']
38
+
39
+ bar_chart = alt.Chart(ev_type_count).mark_bar().encode(
40
+ x=alt.X('Electric Vehicle Type', sort='-y', title='Electric Vehicle Type'),
41
+ y=alt.Y('Count', title='Number of Vehicles'),
42
+ tooltip=['Electric Vehicle Type', 'Count'],
43
+ color='Electric Vehicle Type'
44
  ).properties(
 
45
  width=600,
46
+ height=400,
47
+ title='Distribution of Electric Vehicle Types in Selected County'
48
+ ).interactive()
49
+
50
+ st.altair_chart(bar_chart)
51
+
52
+ st.subheader('Electric Range Distribution')
53
+ electric_range_chart = alt.Chart(filtered_data).mark_bar().encode(
54
+ alt.X('Electric Range', bin=alt.Bin(maxbins=30), title='Electric Range (Miles)'),
55
+ alt.Y('count()', title='Frequency'),
56
+ tooltip=['count()'],
57
+ color=alt.value('steelblue')
58
+ ).properties(
59
+ width=600,
60
+ height=400,
61
+ title='Electric Range Distribution in Selected County'
62
+ ).interactive()
63
+
64
+ st.altair_chart(electric_range_chart)
65
+
66
+ st.subheader('Vehicle Count by Model Year')
67
+ model_year_count = filtered_data['Model Year'].value_counts().reset_index()
68
+ model_year_count.columns = ['Model Year', 'Count']
69
+
70
+ year_chart = alt.Chart(model_year_count).mark_bar().encode(
71
+ x=alt.X('Model Year:N', sort='-y', title='Model Year'),
72
+ y=alt.Y('Count', title='Number of Vehicles'),
73
+ tooltip=['Model Year', 'Count'],
74
+ color='Model Year:N'
75
  ).properties(
 
76
  width=600,
77
+ height=400,
78
+ title='Number of Vehicles by Model Year'
79
+ ).interactive()
80
+
81
+ st.altair_chart(year_chart)
82
+
83
+ st.subheader('Map of Vehicle Locations')
84
+
85
+ ev_data['Latitude'] = pd.to_numeric(ev_data['Latitude'], errors='coerce')
86
+ ev_data['Longitude'] = pd.to_numeric(ev_data['Longitude'], errors='coerce')
87
+
88
+ filtered_data[['Longitude', 'Latitude']] = filtered_data['Vehicle Location'].str.extract(r'POINT \((-?\d+\.\d+) (-?\d+\.\d+)\)')
89
+ filtered_data['Latitude'] = pd.to_numeric(filtered_data['Latitude'], errors='coerce')
90
+ filtered_data['Longitude'] = pd.to_numeric(filtered_data['Longitude'], errors='coerce')
91
+
92
+ filtered_data = filtered_data.dropna(subset=['Latitude', 'Longitude'])
93
+ filtered_data.rename(columns={'Latitude': 'latitude', 'Longitude': 'longitude'}, inplace=True)
94
+ st.map(filtered_data[['latitude', 'longitude']])
95
+
96
+ st.markdown('''### How to Use This Dashboard
97
+ To explore the dataset, use the sidebar options to filter by county and make. The filtered dataset is displayed in the
98
+ table, and corresponding charts will help you explore the distribution of electric vehicle types, their electric ranges,
99
+ and model years. The map also provides a visualization of the locations of the vehicles in the selected county.
100
+
101
+ All charts are interactive. You can click on bars to highlight corresponding data points in other charts, making it easier to discover patterns and relationships.''')
102
+
103
+ st.markdown('''### Contextual Datasets
104
+ A potentially useful contextual dataset could be the [Electric Charging Stations Locations](https://afdc.energy.gov/fuels/electricity_locations.html).
105
+ This dataset will provide information about the availability of charging stations in each county, allowing for a deeper
106
+ analysis of the convenience and accessibility of electric vehicles in different regions.
107
+ ''')
108
+
109
+ st.markdown('''### Dataset Size
110
+ This dataset is not larger than the GitHub file upload limit, so there is no need to revise the plan for hosting this data.
111
+ ''')
112
+
data/Electric_Vehicle_Population_Data.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:18ee71403c210c570bbe6786e88436bc21ad7748ab1f5683d94b5bffb711072d
3
+ size 51381679
data/licenses_fall2022.csv DELETED
The diff for this file is too large to render. See raw diff
 
poetry.lock ADDED
The diff for this file is too large to render. See raw diff