Commit
•
5293bd7
1
Parent(s):
65b1963
Update app.py
Browse files
app.py
CHANGED
@@ -261,66 +261,113 @@ def home_page():
|
|
261 |
st.write("Please enter employee details in the sidebar and click 'Submit' to view the performance report.")
|
262 |
else:
|
263 |
# After submission, show the report
|
264 |
-
|
265 |
-
|
266 |
-
with
|
267 |
-
st.
|
268 |
-
|
269 |
-
|
270 |
-
st.
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
'
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
st.subheader("Performance Trend")
|
314 |
-
# Placeholder for performance trend
|
315 |
dates = pd.date_range(start="2023-01-01", end="2023-12-31", freq="M")
|
316 |
performance = np.random.randint(70, 100, size=len(dates))
|
317 |
trend_data = pd.DataFrame({"Date": dates, "Performance": performance})
|
318 |
fig = px.line(trend_data, x="Date", y="Performance",
|
319 |
line_shape="spline", render_mode="svg")
|
320 |
fig.update_traces(line_color='#1E88E5')
|
321 |
-
fig.update_layout(height=
|
322 |
st.plotly_chart(fig, use_container_width=True)
|
323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
# Logout button
|
325 |
if st.button("Logout"):
|
326 |
st.session_state.login_successful = False
|
@@ -329,6 +376,7 @@ def home_page():
|
|
329 |
st.experimental_rerun()
|
330 |
|
331 |
|
|
|
332 |
# Main app logic
|
333 |
if st.session_state.current_page == 'login':
|
334 |
login()
|
|
|
261 |
st.write("Please enter employee details in the sidebar and click 'Submit' to view the performance report.")
|
262 |
else:
|
263 |
# After submission, show the report
|
264 |
+
tab1, tab2 = st.tabs(["Performance Report", "Performance Insights"])
|
265 |
+
|
266 |
+
with tab1:
|
267 |
+
st.markdown("## Employee Performance Report")
|
268 |
+
st.markdown(f"**Employee Name:** {employee_name}")
|
269 |
+
st.markdown(f"**Employee ID:** {employee_id}")
|
270 |
+
st.markdown(f"**Age:** {employee_age}")
|
271 |
+
st.markdown(f"**Joining Date:** {employee_joining_date}")
|
272 |
+
st.markdown(f"**Last Appraisal Date:** {employee_last_appraisal_date}")
|
273 |
+
st.markdown("---")
|
274 |
+
|
275 |
+
col1, col2 = st.columns(2)
|
276 |
+
|
277 |
+
with col1:
|
278 |
+
performance_score = np.random.randint(60, 100)
|
279 |
+
st.metric("Predicted Performance", f"{performance_score}%", "4%")
|
280 |
+
|
281 |
+
def create_stylized_gauge_chart(performance_score):
|
282 |
+
colors = ['#FF4B4B', '#FFA14B', '#FFE74B', '#8DED8E', '#4BFF4B']
|
283 |
+
|
284 |
+
fig = go.Figure(go.Indicator(
|
285 |
+
mode="gauge+number",
|
286 |
+
value=performance_score,
|
287 |
+
domain={'x': [0, 1], 'y': [0, 1]},
|
288 |
+
title={'text': "Employee Performance", 'font': {'size': 24}},
|
289 |
+
gauge={
|
290 |
+
'axis': {'range': [None, 100], 'tickwidth': 1, 'tickcolor': "darkblue"},
|
291 |
+
'bar': {'color': "darkblue"},
|
292 |
+
'bgcolor': "white",
|
293 |
+
'borderwidth': 2,
|
294 |
+
'bordercolor': "gray",
|
295 |
+
'steps': [
|
296 |
+
{'range': [0, 20], 'color': colors[0]},
|
297 |
+
{'range': [20, 40], 'color': colors[1]},
|
298 |
+
{'range': [40, 60], 'color': colors[2]},
|
299 |
+
{'range': [60, 80], 'color': colors[3]},
|
300 |
+
{'range': [80, 100], 'color': colors[4]}
|
301 |
+
],
|
302 |
+
'threshold': {
|
303 |
+
'line': {'color': "red", 'width': 4},
|
304 |
+
'thickness': 0.75,
|
305 |
+
'value': performance_score
|
306 |
+
}
|
307 |
+
}
|
308 |
+
))
|
309 |
+
|
310 |
+
fig.update_layout(
|
311 |
+
font={'color': "darkblue", 'family': "Arial"},
|
312 |
+
height=300,
|
313 |
+
width=300,
|
314 |
+
margin=dict(l=20, r=20, t=30, b=20),
|
315 |
+
paper_bgcolor="white",
|
316 |
+
plot_bgcolor='rgba(0,0,0,0)'
|
317 |
+
)
|
318 |
+
|
319 |
+
return fig
|
320 |
+
|
321 |
+
fig = create_stylized_gauge_chart(performance_score)
|
322 |
+
st.plotly_chart(fig, use_container_width=True)
|
323 |
+
|
324 |
+
with col2:
|
325 |
+
st.subheader("Key Factors Influencing Performance")
|
326 |
+
factors = pd.DataFrame({
|
327 |
+
'Factor': ['Experience', 'Training', 'Projects', 'Teamwork'],
|
328 |
+
'Impact': [0.3, 0.25, 0.28, 0.17]
|
329 |
+
})
|
330 |
+
fig = px.bar(factors, x='Impact', y='Factor', orientation='h',
|
331 |
+
color='Impact', color_continuous_scale='Viridis')
|
332 |
+
fig.update_layout(height=300, margin=dict(l=20, r=20, t=30, b=20))
|
333 |
+
st.plotly_chart(fig, use_container_width=True)
|
334 |
+
|
335 |
+
st.markdown("---")
|
336 |
st.subheader("Performance Trend")
|
|
|
337 |
dates = pd.date_range(start="2023-01-01", end="2023-12-31", freq="M")
|
338 |
performance = np.random.randint(70, 100, size=len(dates))
|
339 |
trend_data = pd.DataFrame({"Date": dates, "Performance": performance})
|
340 |
fig = px.line(trend_data, x="Date", y="Performance",
|
341 |
line_shape="spline", render_mode="svg")
|
342 |
fig.update_traces(line_color='#1E88E5')
|
343 |
+
fig.update_layout(height=300, margin=dict(l=20, r=20, t=30, b=20))
|
344 |
st.plotly_chart(fig, use_container_width=True)
|
345 |
|
346 |
+
with tab2:
|
347 |
+
st.markdown("## Performance Insights")
|
348 |
+
st.write(f"Based on the analysis for Employee ID {employee_id}:")
|
349 |
+
st.write(f"- Current performance is {'above' if performance_score > 80 else 'below'} average")
|
350 |
+
st.write(f"- Key area for improvement: {'Training' if performance_score < 80 else 'Project Management'}")
|
351 |
+
st.write(f"- Recommended action: {'Enroll in advanced skills program' if performance_score < 80 else 'Take on leadership role in upcoming project'}")
|
352 |
+
|
353 |
+
st.markdown("### Detailed Analysis")
|
354 |
+
st.write("1. **Performance Trend:**")
|
355 |
+
st.write(" The employee's performance has shown a steady increase over the past year, with notable improvements in the last quarter.")
|
356 |
+
|
357 |
+
st.write("2. **Strengths:**")
|
358 |
+
st.write(" - Strong project management skills")
|
359 |
+
st.write(" - Excellent team collaboration")
|
360 |
+
st.write(" - High adaptability to new technologies")
|
361 |
+
|
362 |
+
st.write("3. **Areas for Improvement:**")
|
363 |
+
st.write(" - Time management in high-pressure situations")
|
364 |
+
st.write(" - Technical documentation skills")
|
365 |
+
|
366 |
+
st.write("4. **Recommendations:**")
|
367 |
+
st.write(" - Enroll in an advanced project management certification course")
|
368 |
+
st.write(" - Assign as a mentor for junior team members to further develop leadership skills")
|
369 |
+
st.write(" - Provide opportunities to lead cross-functional projects")
|
370 |
+
|
371 |
# Logout button
|
372 |
if st.button("Logout"):
|
373 |
st.session_state.login_successful = False
|
|
|
376 |
st.experimental_rerun()
|
377 |
|
378 |
|
379 |
+
|
380 |
# Main app logic
|
381 |
if st.session_state.current_page == 'login':
|
382 |
login()
|