Niharmahesh commited on
Commit
5e21d72
·
verified ·
1 Parent(s): b114f89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -0
app.py CHANGED
@@ -189,15 +189,68 @@ def display_dashboard(df):
189
  with col4:
190
  fig = create_chart(top_job_titles, top_job_titles.index, top_job_titles.values, "Top 20 Job Titles", ['#59a14f'])
191
  st.plotly_chart(fig, use_container_width=True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  def display_about_page():
193
  st.markdown("""
194
  ## What is this application?
 
195
  The Job Listings Dashboard is a powerful tool designed to provide insights into the job market. It offers a comprehensive view of job postings, allowing users to explore trends, top companies, locations, and job titles.
 
196
  ### Key Features:
197
  - **Interactive Dashboard**: Visualize job market trends with dynamic charts and graphs.
198
  - **Data Explorer**: Dive deep into individual job listings with advanced filtering options.
199
  - **Real-time Data**: Fetch the latest job data from our Hugging Face dataset.
 
200
  ## How to use this application
 
201
  ### Dashboard
202
  1. Navigate to the Dashboard using the sidebar.
203
  2. View overall statistics such as total job postings, unique companies, and today's postings.
@@ -206,6 +259,7 @@ def display_about_page():
206
  - Job postings over time
207
  - Top locations for job opportunities
208
  - Most common job titles
 
209
  ### Data Explorer
210
  1. Switch to the Data Explorer using the sidebar.
211
  2. Choose between viewing all data or applying filters.
@@ -215,10 +269,13 @@ def display_about_page():
215
  - Job Types
216
  4. Browse the filtered job listings table.
217
  5. Click on job or company links to view more details on the original posting site.
 
218
  ## Data Source
219
  This application fetches data from my Private dataset which scrapes data from varoious job hosting portal and the data gets updated daily.
 
220
  ## Contact
221
  For questions, feedback, or collaboration opportunities, feel free to reach out:
 
222
  - LinkedIn: [Nihar Palem](https://www.linkedin.com/in/nihar-palem-1b955a183/)
223
  """)
224
 
 
189
  with col4:
190
  fig = create_chart(top_job_titles, top_job_titles.index, top_job_titles.values, "Top 20 Job Titles", ['#59a14f'])
191
  st.plotly_chart(fig, use_container_width=True)
192
+ def display_data_explorer(df):
193
+ st.subheader("Data Explorer")
194
+
195
+ show_all = st.radio("Display", ("All Data", "Filtered Data"))
196
+
197
+ if show_all == "Filtered Data":
198
+ unique_values = get_unique_values(df)
199
+ col1, col2, col3, col4,col5 = st.columns(5)
200
+ with col1:
201
+ companies = st.multiselect("Select Companies", options=unique_values['companies'])
202
+ with col2:
203
+ locations = st.multiselect("Select Locations", options=unique_values['locations'])
204
+ with col3:
205
+ job_types = st.multiselect("Select Job Types", options=unique_values['job_types'])
206
+ with col4:
207
+ Role_Name = st.multiselect("Select Role Types", options=unique_values['Role_Name'])
208
+ with col5:
209
+ Date_posted = st.multiselect("Select Date Posted", options=unique_values['Date_posted'])
210
+
211
+ filtered_df = filter_dataframe(df, companies, locations, job_types, Role_Name,Date_posted)
212
+ else:
213
+ filtered_df = df
214
+
215
+ st.write(f"Showing {len(filtered_df)} job listings")
216
+
217
+ # Pagination
218
+ items_per_page = 15
219
+ num_pages = math.ceil(len(filtered_df) / items_per_page)
220
+
221
+ col1, col2, col3 = st.columns([1, 3, 1])
222
+ with col2:
223
+ page = st.number_input("Page", min_value=1, max_value=num_pages, value=1)
224
+
225
+ start_idx = (page - 1) * items_per_page
226
+ end_idx = start_idx + items_per_page
227
+
228
+ page_df = filtered_df.iloc[start_idx:end_idx]
229
+
230
+ def make_clickable(url):
231
+ return f'<a href="{url}" target="_blank" style="color: #4e79a7;">Link</a>'
232
+
233
+ page_df['job_url'] = page_df['job_url'].apply(make_clickable)
234
+ page_df['company_url'] = page_df['company_url'].apply(make_clickable)
235
+
236
+ st.write(page_df.to_html(escape=False, index=False), unsafe_allow_html=True)
237
+
238
+ col1, col2, col3 = st.columns([1, 3, 1])
239
+ with col2:
240
+ st.write(f"Page {page} of {num_pages}")
241
  def display_about_page():
242
  st.markdown("""
243
  ## What is this application?
244
+
245
  The Job Listings Dashboard is a powerful tool designed to provide insights into the job market. It offers a comprehensive view of job postings, allowing users to explore trends, top companies, locations, and job titles.
246
+
247
  ### Key Features:
248
  - **Interactive Dashboard**: Visualize job market trends with dynamic charts and graphs.
249
  - **Data Explorer**: Dive deep into individual job listings with advanced filtering options.
250
  - **Real-time Data**: Fetch the latest job data from our Hugging Face dataset.
251
+
252
  ## How to use this application
253
+
254
  ### Dashboard
255
  1. Navigate to the Dashboard using the sidebar.
256
  2. View overall statistics such as total job postings, unique companies, and today's postings.
 
259
  - Job postings over time
260
  - Top locations for job opportunities
261
  - Most common job titles
262
+
263
  ### Data Explorer
264
  1. Switch to the Data Explorer using the sidebar.
265
  2. Choose between viewing all data or applying filters.
 
269
  - Job Types
270
  4. Browse the filtered job listings table.
271
  5. Click on job or company links to view more details on the original posting site.
272
+
273
  ## Data Source
274
  This application fetches data from my Private dataset which scrapes data from varoious job hosting portal and the data gets updated daily.
275
+
276
  ## Contact
277
  For questions, feedback, or collaboration opportunities, feel free to reach out:
278
+
279
  - LinkedIn: [Nihar Palem](https://www.linkedin.com/in/nihar-palem-1b955a183/)
280
  """)
281