-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamlit_app.py
130 lines (117 loc) · 5.49 KB
/
streamlit_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import streamlit as st
import plotly.express as px
import plotly.graph_objects as go
import pandas as pd
import numpy as np
import re
import helper as hp
st.set_page_config(layout='wide')
@st.cache_data
def load_main_df():
main_df = hp.load_main_df()
# Get unique set of uni - course, only for courses with GES data in 2023
course_df = main_df[['uni', 'course', 'summary_row']].drop_duplicates()
return main_df, course_df
# Load in the main dataframe
df, course_df = load_main_df()
# List of unique universities
uni_list = ['NUS', 'NTU', 'SMU']
st.title("Singapore Degree Information Visualizer")
st.markdown(
"""
Select a degree and observe how its admission critieria, starting salaries, and employment prospects have changed over the years!
"""
)
# User selects a university
selected_uni = st.selectbox("Select a University", uni_list)
# Filter courses based on the selected university and not a summary roIt'w.
filtered_courses = course_df.loc[(course_df['uni'] == selected_uni)
& (course_df['summary_row']==0), 'course']
# User selects a course from the filtered list
selected_course = st.selectbox("Select a Course", filtered_courses)
st.markdown(
"""
Degree-level information may be inconsistent. If degree information is missing from a plot, it was likely not availble for that year for that degree.
Find out more about the rise of tech-related degrees [here](https://gesvisualizer.streamlit.app/)
"""
)
# Compute button. Only run when user wants to recompute
if st.button('Visualize'):
with st.spinner():
# ADMISSIONS CRITERIA
admissions_plot = hp.plot_admission(
selected_course=selected_course
, selected_uni=selected_uni
, input_df=df)
# Configure the plotly chart to disable zoom and resize functionality
config = {
# 'staticPlot':True,
'scrollZoom': False,
'displayModeBar': True,
'displaylogo': False,
'modeBarButtonsToRemove': ['zoom2d', 'pan2d', 'select2d', 'lasso2d', 'zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d']
}
st.subheader(f"RP Criteria for {selected_course}")
st.write(f"RP score is the 10th percentile admission score for that year")
st.plotly_chart(admissions_plot
, use_container_width=True
, theme=None
# , config=config
)
# RP VS MEDIAN INCOME
median_rp_plot = hp.plot_median_vs_RP(
selected_course=selected_course
, selected_uni=selected_uni
, input_df=df
)
st.subheader(f"RP vs Median Gross salary for 2023")
st.write(f"Each point represents a course from a university in Singapore. **Hover over** the point for more details on that course.")
# st.write(f"RP score is the 10th percentile admission score for that year")
st.plotly_chart(median_rp_plot
, use_container_width=True
, theme=None
# , config=config
)
st.markdown(
"""
With reference to the selected course (in <span style="background-color: #F587F4">pink</span>), points to the:
- **Left** and **Up** are courses with <span style='background-color:#FF9C9C'>lower</span> entry criteria and <span style='background-color:#AAF9C1'>higher</span> starting salaries
- **Left** and **Down** are courses with <span style='background-color:#FF9C9C'>lower</span> entry criteria and <span style='background-color:#FF9C9C'>lower</span> starting salaries
- **Right** and **Up** are courses with <span style='background-color:#AAF9C1'>higher</span> entry criteria and <span style='background-color:#AAF9C1'>higher</span> starting salaries
- **Right** and **Down** are courses with <span style='background-color:#AAF9C1'>higher</span> entry criteria and <span style='background-color:#FF9C9C'>lower</span> starting salaries
"""
, unsafe_allow_html=True)
# Earnings Percentiles
percentile_earnings_plot = hp.plot_percentile_earnings(
selected_course=selected_course
, selected_uni=selected_uni
, input_df=df
)
st.subheader(f"Percentile earnings for {selected_course}")
st.markdown(
"""
- Upper band indicates the 75th percentile salary
- Middle point indicates the median salary
- Lower band indicates the 25th percentile salary
"""
)
# st.write(f"RP score is the 10th percentile admission score for that year")
st.plotly_chart(percentile_earnings_plot
, use_container_width=True
, theme=None
# , config=config
)
# Employment Rates
employment_rates_plot = hp.plot_employment_rates(
selected_course=selected_course
, selected_uni=selected_uni
, input_df=df
)
st.subheader(f"Employment rates for {selected_course}")
st.write(f"FT refers to Full-Time employment. The overall figure includes contract / part-time employment.")
# st.write(f"RP score is the 10th percentile admission score for that year")
st.plotly_chart(employment_rates_plot
, use_container_width=True
, theme=None
# , config=config
)