Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import matplotlib.pyplot as plt
|
4 |
+
|
5 |
+
def process_data(df):
|
6 |
+
# Convert dates and filter relevant period
|
7 |
+
df['Start Date'] = pd.to_datetime(df['Date'].str.split(' to ').str[0], format='%d/%b/%y')
|
8 |
+
df['End Date'] = pd.to_datetime(df['Date'].str.split(' to ').str[1], format='%d/%b/%y')
|
9 |
+
|
10 |
+
# Categorize into weeks
|
11 |
+
df['Week'] = df['Start Date'].apply(lambda x: 1 if x <= pd.Timestamp('2025-01-05') else 2)
|
12 |
+
|
13 |
+
return df
|
14 |
+
|
15 |
+
def create_utilization_chart(week_data, week_number):
|
16 |
+
fig, ax = plt.subplots()
|
17 |
+
wedges, texts, autotexts = ax.pie(
|
18 |
+
week_data[['Billable', 'Non-Billable', 'Leaves']].values[0],
|
19 |
+
labels=['Billable', 'Non-Billable', 'Leaves'],
|
20 |
+
autopct='%1.1f%%',
|
21 |
+
colors=['#4CAF50', '#FFC107', '#9E9E9E']
|
22 |
+
)
|
23 |
+
plt.setp(autotexts, size=10, weight="bold", color='white')
|
24 |
+
ax.set_title(f'Week {week_number} Utilization', pad=20)
|
25 |
+
return fig
|
26 |
+
|
27 |
+
def create_non_billable_breakdown(df):
|
28 |
+
non_billable = df[df['Project Category'] == 'Non-Billable']
|
29 |
+
breakdown = non_billable.groupby('Epic')['Logged'].sum().reset_index()
|
30 |
+
breakdown = breakdown[breakdown['Epic'] != 'No Epic']
|
31 |
+
|
32 |
+
fig, ax = plt.subplots()
|
33 |
+
breakdown.plot(kind='bar', x='Epic', y='Logged', ax=ax, legend=False)
|
34 |
+
ax.set_title('Non-Billable Time Breakdown')
|
35 |
+
ax.set_ylabel('Hours')
|
36 |
+
plt.xticks(rotation=45)
|
37 |
+
return fig
|
38 |
+
|
39 |
+
def main():
|
40 |
+
st.title('QA Team Utilization Dashboard')
|
41 |
+
|
42 |
+
uploaded_file = st.file_uploader("Upload Tempo Timesheet", type=['xls', 'xlsx'])
|
43 |
+
|
44 |
+
if uploaded_file:
|
45 |
+
df = pd.read_excel(uploaded_file, sheet_name='Report')
|
46 |
+
df = process_data(df)
|
47 |
+
|
48 |
+
# Page 4 Visualization
|
49 |
+
st.header("Bi-Weekly Utilization Report")
|
50 |
+
col1, col2 = st.columns(2)
|
51 |
+
|
52 |
+
with col1:
|
53 |
+
week1 = df[df['Week'] == 1]
|
54 |
+
st.pyplot(create_utilization_chart(week1, 1))
|
55 |
+
|
56 |
+
with col2:
|
57 |
+
week2 = df[df['Week'] == 2]
|
58 |
+
st.pyplot(create_utilization_chart(week2, 2))
|
59 |
+
|
60 |
+
# Page 5 Visualization
|
61 |
+
st.header("Non-Billable Time Breakdown")
|
62 |
+
st.pyplot(create_non_billable_breakdown(df))
|
63 |
+
|
64 |
+
# Page 6 Visualization
|
65 |
+
st.header("Solution Accelerators Progress")
|
66 |
+
accelerators = df[(df['Project Category'] == 'Non-Billable') &
|
67 |
+
(df['Epic'] == 'Solution Accelerators')]
|
68 |
+
|
69 |
+
st.dataframe(
|
70 |
+
accelerators[['Project', 'Logged', 'Key']].rename(columns={
|
71 |
+
'Project': 'Initiative',
|
72 |
+
'Logged': 'Hours',
|
73 |
+
'Key': 'Status'
|
74 |
+
}),
|
75 |
+
hide_index=True
|
76 |
+
)
|
77 |
+
|
78 |
+
if __name__ == "__main__":
|
79 |
+
main()
|