MansoorSarookh commited on
Commit
e0bfd1b
·
verified ·
1 Parent(s): 8a43a3c

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +1324 -0
app.py ADDED
@@ -0,0 +1,1324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from datetime import date, datetime
4
+ import os
5
+ import altair as alt
6
+ import smtplib
7
+ from email.mime.text import MIMEText
8
+ import base64
9
+
10
+ from docx import Document
11
+ from email.mime.multipart import MIMEMultipart
12
+ from email import encoders
13
+ import os
14
+ from email.mime.multipart import MIMEMultipart
15
+
16
+ # File to store project data
17
+ PROJECT_DATA_FILE = 'projects.csv'
18
+ TASK_DATA_FILE = 'tasks.csv'
19
+ TEAM_DATA_FILE = 'team_members.csv'
20
+
21
+ st.title("Projects Management Tool")
22
+ # st.title("Developed By Mansoor Sarookh, CS Student at GPGC Swabi")
23
+
24
+ # Load project data
25
+ def load_projects():
26
+ try:
27
+ return pd.read_csv(PROJECT_DATA_FILE)
28
+ except FileNotFoundError:
29
+ return pd.DataFrame(columns=["Project Name", "Description", "Start Date", "End Date", "Priority", "Status", "Progress", "Budget", "Tags"])
30
+
31
+ # Save project data
32
+ def save_projects(df):
33
+ df.to_csv(PROJECT_DATA_FILE, index=False)
34
+
35
+ # Load tasks
36
+ def load_tasks():
37
+ try:
38
+ return pd.read_csv(TASK_DATA_FILE)
39
+ except FileNotFoundError:
40
+ return pd.DataFrame(columns=["Project Name", "Task Name", "Deadline", "Status", "Assigned To"])
41
+
42
+ # Save tasks
43
+ def save_tasks(df):
44
+ df.to_csv(TASK_DATA_FILE, index=False)
45
+
46
+ # Load team members
47
+ def load_team():
48
+ try:
49
+ return pd.read_csv(TEAM_DATA_FILE)
50
+ except FileNotFoundError:
51
+ return pd.DataFrame(columns=["Project Name", "Member Name", "Role"])
52
+
53
+ # Save team members
54
+ def save_team(df):
55
+ df.to_csv(TEAM_DATA_FILE, index=False)
56
+
57
+
58
+
59
+
60
+
61
+ import streamlit as st
62
+
63
+ def home():
64
+ st.title("Welcome to the Project Management Tool")
65
+ st.markdown("""
66
+ ## About the Tool
67
+ The **Project Management Tool** is a comprehensive solution built specifically for **Admins** and **Project Managers** in small computer science companies. It streamlines workflows, enhances productivity, and ensures smooth project execution.
68
+
69
+ ### Key Features:
70
+ - **Add, Edit, and Delete Projects:** Easily create, modify, or remove projects.
71
+ - **Task Management:** Assign and organize tasks efficiently.
72
+ - **High Priority & Deadlines:** Focus on critical tasks to meet deadlines.
73
+ - **Project Progress Tracking:** Monitor project progress in real-time.
74
+ - **Team Collaboration:** Facilitate communication and teamwork.
75
+ - **Analytics & Reports:** Generate performance and resource utilization reports.
76
+ - **Calendar View:** Plan schedules with an intuitive calendar format.
77
+ - **Search and Filter Projects:** Quickly find projects using advanced search tools.
78
+ - **Budget Tracking:** Manage budgets effectively to avoid overspending.
79
+ - **Comments and Notes:** Document critical details and discussions.
80
+ - **Prioritization Metrics:** Focus on the most impactful tasks.
81
+ - **Gantt Chart Visualization:** Gain a clear view of timelines with Gantt charts.
82
+ - **Resource Management:** Allocate resources optimally across projects.
83
+ - **Risk Management:** Identify and mitigate potential risks proactively.
84
+
85
+ ### Why Choose This Tool?
86
+ - Specifically designed for **Admins** and **Project Managers**.
87
+ - Tailored for small computer science companies.
88
+ - Focused on streamlining project workflows and improving efficiency.
89
+ """)
90
+
91
+
92
+
93
+ # Add new project with suggestions and technology selection
94
+ def add_project():
95
+ st.header("Add New Project")
96
+
97
+ # Project name input with suggestions
98
+ project_suggestions = [
99
+ "Machine Learning Model",
100
+ "Web Development App",
101
+ "Mobile App Development",
102
+ "Data Science Pipeline",
103
+ "API Development",
104
+ "Game Development",
105
+ ]
106
+ project_name = st.selectbox("Select or type a project name:", project_suggestions)
107
+
108
+ # Description based on project name
109
+ description_placeholder = {
110
+ "Machine Learning Model": "Enter a brief description of your machine learning model project.",
111
+ "Web Development App": "Enter a brief description of your web development app project.",
112
+ "Mobile App Development": "Enter a brief description of your mobile app development project.",
113
+ "Data Science Pipeline": "Enter a brief description of your data science pipeline project.",
114
+ "API Development": "Enter a brief description of your API development project.",
115
+ "Game Development": "Enter a brief description of your game development project."
116
+ }
117
+ description = st.text_area("Project Description", placeholder=description_placeholder.get(project_name, ""))
118
+
119
+ # Technology selection dynamically based on project name
120
+ technologies = {
121
+ "Machine Learning Model": ["Python", "TensorFlow", "PyTorch", "Scikit-learn"],
122
+ "Web Development App": ["HTML", "CSS", "JavaScript", "Django", "Flask"],
123
+ "Mobile App Development": ["Flutter", "React Native", "Swift", "Kotlin"],
124
+ "Data Science Pipeline": ["Python", "Pandas", "NumPy", "Matplotlib"],
125
+ "API Development": ["FastAPI", "Flask", "Express.js", "Django Rest Framework"],
126
+ "Game Development": ["Unity", "Unreal Engine", "C#", "Godot"],
127
+ }
128
+
129
+ if project_name in technologies:
130
+ tech_options = technologies[project_name]
131
+ else:
132
+ tech_options = []
133
+
134
+ technology_used = st.multiselect("Select technologies used in the project:", tech_options)
135
+
136
+ # Additional project details
137
+ start_date = st.date_input("Start Date", date.today())
138
+ end_date = st.date_input("End Date")
139
+ priority = st.selectbox("Priority", ["Low", "Medium", "High"])
140
+ budget = st.number_input("Budget", min_value=0.0)
141
+
142
+ # Submit button
143
+ if st.button("Create Project"):
144
+ if project_name and description:
145
+ new_project = pd.DataFrame({
146
+ "Project Name": [project_name],
147
+ "Description": [description],
148
+ "Start Date": [start_date],
149
+ "End Date": [end_date],
150
+ "Priority": [priority],
151
+ "Status": ["Uncompleted"],
152
+ "Progress": [0],
153
+ "Budget": [budget],
154
+ "Technologies": [", ".join(technology_used)] # Store selected technologies as a comma-separated string
155
+ })
156
+ df = load_projects()
157
+ df = pd.concat([df, new_project], ignore_index=True)
158
+ save_projects(df)
159
+ st.success(f"Project '{project_name}' has been added!")
160
+ else:
161
+ st.error("Please fill in all fields")
162
+
163
+
164
+
165
+ # Edit project with suggestions and technology update
166
+ def edit_project():
167
+ st.header("Edit Project")
168
+ df = load_projects()
169
+ if df.empty:
170
+ st.info("No projects to edit.")
171
+ return
172
+
173
+ project_names = df["Project Name"].tolist()
174
+ project = st.selectbox("Select Project", project_names)
175
+
176
+ if project:
177
+ row = df[df["Project Name"] == project].iloc[0]
178
+
179
+ # Project name input with suggestions
180
+ project_suggestions = [
181
+ "Machine Learning Model",
182
+ "Web Development App",
183
+ "Mobile App Development",
184
+ "Data Science Pipeline",
185
+ "API Development",
186
+ "Game Development",
187
+ ]
188
+ new_name = st.selectbox("Select or type a project name:", project_suggestions, index=project_suggestions.index(row["Project Name"]) if row["Project Name"] in project_suggestions else 0)
189
+
190
+ # Description based on project name
191
+ description_placeholder = {
192
+ "Machine Learning Model": "Enter a brief description of your machine learning model project.",
193
+ "Web Development App": "Enter a brief description of your web development app project.",
194
+ "Mobile App Development": "Enter a brief description of your mobile app development project.",
195
+ "Data Science Pipeline": "Enter a brief description of your data science pipeline project.",
196
+ "API Development": "Enter a brief description of your API development project.",
197
+ "Game Development": "Enter a brief description of your game development project."
198
+ }
199
+ description = st.text_area("Project Description", placeholder=description_placeholder.get(new_name, ""), value=row["Description"])
200
+
201
+ # Technology selection dynamically based on project name
202
+ technologies = {
203
+ "Machine Learning Model": ["Python", "TensorFlow", "PyTorch", "Scikit-learn"],
204
+ "Web Development App": ["HTML", "CSS", "JavaScript", "Django", "Flask"],
205
+ "Mobile App Development": ["Flutter", "React Native", "Swift", "Kotlin"],
206
+ "Data Science Pipeline": ["Python", "Pandas", "NumPy", "Matplotlib"],
207
+ "API Development": ["FastAPI", "Flask", "Express.js", "Django Rest Framework"],
208
+ "Game Development": ["Unity", "Unreal Engine", "C#", "Godot"],
209
+ }
210
+
211
+ tech_options = technologies.get(new_name, [])
212
+ technology_used = st.multiselect("Select technologies used in the project:", tech_options, default=row["Technologies"].split(", "))
213
+
214
+ # Additional project details
215
+ start_date = st.date_input("Start Date", row["Start Date"])
216
+ end_date = st.date_input("End Date", row["End Date"])
217
+ priority = st.selectbox("Priority", ["Low", "Medium", "High"], index=["Low", "Medium", "High"].index(row["Priority"]))
218
+ budget = st.number_input("Budget", min_value=0.0, value=row["Budget"])
219
+
220
+ # Submit button
221
+ if st.button("Update Project"):
222
+ # Update the project data
223
+ df.loc[df["Project Name"] == project, ["Project Name", "Description", "Start Date", "End Date", "Priority", "Budget", "Technologies"]] = new_name, description, start_date, end_date, priority, budget, ", ".join(technology_used)
224
+ save_projects(df)
225
+ st.success(f"Project '{new_name}' has been updated.")
226
+
227
+ # Delete project
228
+ def delete_project():
229
+ st.header("Delete Project")
230
+ df = load_projects()
231
+ if df.empty:
232
+ st.info("No projects to delete.")
233
+ return
234
+
235
+ project = st.selectbox("Select Project to Delete", df["Project Name"])
236
+ if st.button("Delete Project"):
237
+ df = df[df["Project Name"] != project]
238
+ save_projects(df)
239
+ st.success(f"Project '{project}' has been deleted.")
240
+
241
+
242
+ # for notifications purpose
243
+
244
+
245
+
246
+ # Function to send email
247
+ def send_email(to_email, subject, body):
248
+ from_email = "your_email@gmail.com" # Replace with your email
249
+ password = "your_password" # Replace with your email app password
250
+ try:
251
+ server = smtplib.SMTP('smtp.gmail.com', 587)
252
+ server.starttls()
253
+ server.login(from_email, password)
254
+ msg = MIMEText(body)
255
+ msg['Subject'] = subject
256
+ msg['From'] = from_email
257
+ msg['To'] = to_email
258
+ server.sendmail(from_email, to_email, msg.as_string())
259
+ server.quit()
260
+ except Exception as e:
261
+ print(f"Failed to send email: {e}")
262
+
263
+
264
+ # Task management within each project
265
+ def manage_tasks():
266
+ st.header("Task Management")
267
+
268
+ # Load projects and tasks
269
+ projects = load_projects()
270
+ tasks_df = load_tasks()
271
+
272
+ if projects.empty:
273
+ st.info("No projects available.")
274
+ return
275
+
276
+ # Select a project
277
+ project = st.selectbox("Select Project", projects["Project Name"])
278
+
279
+ # Define team members
280
+ team_members = {
281
+ "Machine Learning Model": ["Ahmed", "Omar", "Faisal"],
282
+ "Web Development App": ["Zaid", "Salman", "Yusuf"],
283
+ "Mobile App Development": ["Hassan", "Bilal", "Ibrahim"],
284
+ "Data Science Pipeline": ["Suleiman", "Imran", "Farhan"],
285
+ "API Development": ["Adeel", "Hamza", "Mustafa"],
286
+ "Game Development": ["Ali", "Khalid", "Tariq"]
287
+ }
288
+
289
+ # Task details
290
+ st.subheader("Add a New Task")
291
+ title = st.text_input("Task Title")
292
+ description = st.text_area("Task Description")
293
+ priority = st.selectbox("Priority", ["Low", "Medium", "High", "Custom"])
294
+ custom_priority = None
295
+ if priority == "Custom":
296
+ custom_priority = st.text_input("Enter Custom Priority")
297
+
298
+ tags = st.multiselect("Tags/Labels", ["Design", "Development", "Testing", "Research", "Bug Fixing"])
299
+ team_leader = st.selectbox("Team Leader", team_members.get(project, []))
300
+ assigned_to = st.multiselect("Assigned Team Members", team_members.get(project, []))
301
+ deadline = st.date_input("Deadline")
302
+
303
+ # Email details (before clicking Add Task)
304
+ email_send_to = st.text_input("Email Recipient (Team Member)", "") # Email field
305
+ if email_send_to:
306
+ email_subject = f"New Task Assigned: {title}"
307
+ email_body = f"Task '{title}' has been assigned to you by {team_leader}.\n\nDetails:\n" \
308
+ f"Description: {description}\nPriority: {priority}\nDeadline: {deadline}\n" \
309
+ f"Tags: {', '.join(tags)}\nTeam Leader: {team_leader}"
310
+
311
+ if st.button(f"Send Email to {email_send_to}"):
312
+ send_email(email_send_to, email_subject, email_body)
313
+ st.success(f"Email sent to {email_send_to}!")
314
+
315
+ # Add task button
316
+ if st.button("Add Task"):
317
+ if project and title and team_leader and assigned_to:
318
+ new_task = pd.DataFrame({
319
+ "Project Name": [project],
320
+ "Task Title": [title],
321
+ "Description": [description],
322
+ "Priority": [priority if priority != "Custom" else custom_priority],
323
+ "Tags": [", ".join(tags)],
324
+ "Team Leader": [team_leader],
325
+ "Assigned To": [", ".join(assigned_to)],
326
+ "Deadline": [deadline],
327
+ "Status": ["Uncompleted"]
328
+ })
329
+ tasks_df = pd.concat([tasks_df, new_task], ignore_index=True)
330
+ save_tasks(tasks_df)
331
+ st.success(f"Task '{title}' has been added to project '{project}'.")
332
+
333
+ # Send email notification to each assigned member after adding the task
334
+ for member in assigned_to:
335
+ member_email = f"{member}@gmail.com" # Assuming team members use gmail
336
+ subject = f"New Task Assigned: {title}"
337
+ body = f"You have been assigned a new task '{title}' in project '{project}'."
338
+ send_email(member_email, subject, body)
339
+
340
+ else:
341
+ st.error("Please fill in all required fields.")
342
+
343
+
344
+ # View project deadlines and high-priority projects
345
+ def view_high_priority():
346
+ st.header("Upcoming Deadlines & High Priority Projects")
347
+ df = load_projects()
348
+ if df.empty:
349
+ st.info("No projects available.")
350
+ return
351
+
352
+ today = date.today()
353
+ upcoming_deadlines = df[df["End Date"] >= str(today)].sort_values("End Date")
354
+ high_priority = upcoming_deadlines[upcoming_deadlines["Priority"] == "High"]
355
+
356
+ if not high_priority.empty:
357
+ st.subheader("High Priority Projects")
358
+ for i, row in high_priority.iterrows():
359
+ st.text(f"{row['Project Name']} - Deadline: {row['End Date']}")
360
+
361
+ st.subheader("Upcoming Deadlines")
362
+ for i, row in upcoming_deadlines.iterrows():
363
+ st.text(f"{row['Project Name']} - Deadline: {row['End Date']}")
364
+
365
+ # Team collaboration and management
366
+ def manage_team():
367
+ st.header("Team Management")
368
+ df = load_team()
369
+ project = st.selectbox("Assign Team Member to Project", load_projects()["Project Name"])
370
+ member_name = st.text_input("Team Member Name")
371
+ role = st.selectbox("Role", ["Project Manager", "Developer", "Designer", "Quality Assurance Specialist QA"])
372
+
373
+ if st.button("Add Member"):
374
+ if project and member_name:
375
+ new_member = pd.DataFrame({
376
+ "Project Name": [project],
377
+ "Member Name": [member_name],
378
+ "Role": [role]
379
+ })
380
+ df = pd.concat([df, new_member], ignore_index=True)
381
+ save_team(df)
382
+ st.success(f"Team member '{member_name}' assigned to project '{project}'.")
383
+
384
+ if not df.empty:
385
+ st.subheader("Team Members")
386
+ for i, member in df.iterrows():
387
+ st.text(f"Member: {member['Member Name']} | Role: {member['Role']} | Project: {member['Project Name']}")
388
+
389
+
390
+
391
+
392
+
393
+ # MODIFIED PROJECT PROGRESS
394
+
395
+ # Predefined Data
396
+ project_suggestions = [
397
+ "Machine Learning Model",
398
+ "Web Development App",
399
+ "Mobile App Development",
400
+ "Data Science Pipeline",
401
+ "API Development",
402
+ "Game Development",
403
+ ]
404
+
405
+ technologies = {
406
+ "Machine Learning Model": ["Python", "TensorFlow", "PyTorch", "Scikit-learn"],
407
+ "Web Development App": ["HTML", "CSS", "JavaScript", "Django", "Flask"],
408
+ "Mobile App Development": ["Flutter", "React Native", "Swift", "Kotlin"],
409
+ "Data Science Pipeline": ["Python", "Pandas", "NumPy", "Matplotlib"],
410
+ "API Development": ["FastAPI", "Flask", "Express.js", "Django Rest Framework"],
411
+ "Game Development": ["Unity", "Unreal Engine", "C#", "Godot"],
412
+ }
413
+
414
+ # Function to generate project report
415
+ def generate_report(project_name, deadline, progress_data, overall_progress):
416
+ doc = Document()
417
+ doc.add_heading("Project Report", level=1)
418
+
419
+ # Project Details
420
+ doc.add_heading("Project Details", level=2)
421
+ doc.add_paragraph(f"Project Name: {project_name}")
422
+ doc.add_paragraph(f"Deadline: {deadline}")
423
+ doc.add_paragraph(f"Overall Progress: {overall_progress:.2f}%")
424
+
425
+ # Team Progress
426
+ doc.add_heading("Team Progress", level=2)
427
+ table = doc.add_table(rows=1, cols=2)
428
+ table.style = "Table Grid"
429
+ hdr_cells = table.rows[0].cells
430
+ hdr_cells[0].text = "Team Member"
431
+ hdr_cells[1].text = "Progress (%)"
432
+ for progress in progress_data:
433
+ row_cells = table.add_row().cells
434
+ row_cells[0].text = progress["Member"]
435
+ row_cells[1].text = f"{progress['Progress (%)']}%"
436
+
437
+ # Save Report
438
+ file_name = f"{project_name.replace(' ', '_')}_Report.docx"
439
+ doc.save(file_name)
440
+ return file_name
441
+
442
+ # Function to allow downloading the file
443
+ def create_download_link(file_path):
444
+ with open(file_path, "rb") as file:
445
+ file_bytes = file.read()
446
+ b64 = base64.b64encode(file_bytes).decode()
447
+ href = f'<a href="data:application/octet-stream;base64,{b64}" download="{os.path.basename(file_path)}">Download Report</a>'
448
+ return href
449
+
450
+ # Function to send email with the report
451
+ def send_email_with_report(receiver_email, subject, body, file_path):
452
+ sender_email = "your_email@example.com" # Replace with your email
453
+ msg = MIMEMultipart()
454
+ msg["From"] = sender_email
455
+ msg["To"] = receiver_email
456
+ msg["Subject"] = subject
457
+
458
+ # Email body
459
+ msg.attach(MIMEText(body, "plain"))
460
+
461
+ # Attach the document
462
+ with open(file_path, "rb") as attachment:
463
+ part = MIMEBase("application", "octet-stream")
464
+ part.set_payload(attachment.read())
465
+ encoders.encode_base64(part)
466
+ part.add_header(
467
+ "Content-Disposition",
468
+ f"attachment; filename= {os.path.basename(file_path)}",
469
+ )
470
+ msg.attach(part)
471
+
472
+ # Send email
473
+ try:
474
+ with smtplib.SMTP("smtp.gmail.com", 587) as server:
475
+ server.starttls()
476
+ server.sendmail(sender_email, receiver_email, msg.as_string())
477
+ return f"Email sent successfully to {receiver_email}!"
478
+ except Exception as e:
479
+ return f"Failed to send email: {e}"
480
+
481
+ # Function to track project progress
482
+ def project_progress():
483
+ st.title("Project Progress Tracking")
484
+
485
+ # Select a project
486
+ project = st.selectbox("Select a Project", project_suggestions)
487
+ technologies_used = ", ".join(technologies[project])
488
+ st.write(f"Technologies: {technologies_used}")
489
+
490
+ # Input for deadline and progress
491
+ deadline = st.date_input(f"Set a deadline for {project}")
492
+ progress_data = []
493
+ team_size = st.number_input(f"Enter number of team members for {project}", min_value=1, step=1)
494
+ for i in range(team_size):
495
+ member = st.text_input(f"Enter team member {i+1} name")
496
+ progress = st.slider(f"Progress by {member} (%)", 0, 100, 0)
497
+ email = st.text_input(f"Email for {member}")
498
+ progress_data.append({"Member": member, "Progress (%)": progress, "Email": email})
499
+
500
+ # Calculate overall progress
501
+ progress_df = pd.DataFrame(progress_data)
502
+ overall_progress = progress_df["Progress (%)"].mean()
503
+ st.progress(overall_progress / 100)
504
+ st.write(f"Overall Progress: {overall_progress:.2f}%")
505
+
506
+ # Generate and download project report
507
+ if st.button("Generate Report"):
508
+ report_file = generate_report(project, deadline, progress_data, overall_progress)
509
+ st.success(f"Report saved as {report_file}")
510
+ st.markdown(create_download_link(report_file), unsafe_allow_html=True)
511
+
512
+ # Send the report via email
513
+ st.subheader("Send Report via Email")
514
+ recipient_emails = st.text_area("Enter recipient emails (comma-separated)")
515
+ if st.button("Send Report"):
516
+ if report_file:
517
+ for email in recipient_emails.split(","):
518
+ email_status = send_email_with_report(
519
+ email.strip(),
520
+ f"Project Report: {project}",
521
+ f"Dear Team,\n\nPlease find attached the latest project report for {project}.\n\nBest regards,\nProject Management Team",
522
+ report_file,
523
+ )
524
+ st.write(email_status)
525
+ else:
526
+ st.error("Please generate the report first!")
527
+
528
+ # Call the function to display in the app
529
+ # project_progress()
530
+
531
+
532
+
533
+
534
+
535
+ # Set milestones for each project
536
+ def set_milestones():
537
+ st.header("Set Milestones")
538
+ df = load_projects()
539
+ if df.empty:
540
+ st.info("No projects available.")
541
+ return
542
+
543
+ project = st.selectbox("Select Project for Milestone", df["Project Name"])
544
+ milestone = st.text_input("Milestone Name")
545
+ milestone_date = st.date_input("Milestone Date")
546
+
547
+ if st.button("Add Milestone"):
548
+ if project and milestone:
549
+ st.success(f"Milestone '{milestone}' added to project '{project}' for {milestone_date}.")
550
+ else:
551
+ st.error("Please complete the milestone details.")
552
+
553
+ # Time tracking for projects
554
+ def time_tracking():
555
+ st.header("Time Tracking")
556
+ project = st.selectbox("Select Project", load_projects()["Project Name"])
557
+ hours_logged = st.number_input("Hours Worked", min_value=0)
558
+
559
+ if st.button("Log Time"):
560
+ if project:
561
+ st.success(f"{hours_logged} hours logged for project '{project}'.")
562
+
563
+ # Document uploads
564
+ def document_upload():
565
+ st.header("Document Upload")
566
+ project = st.selectbox("Select Project for Document Upload", load_projects()["Project Name"])
567
+ uploaded_file = st.file_uploader("Upload Document", type=["pdf", "docx", "txt"])
568
+
569
+ if uploaded_file is not None:
570
+ st.success(f"Document uploaded to project '{project}'.")
571
+
572
+ # Project tags and categorization
573
+ def project_tags():
574
+ st.header("Project Tags & Categories")
575
+ df = load_projects()
576
+ if df.empty:
577
+ st.info("No projects available.")
578
+ return
579
+
580
+ project = st.selectbox("Select Project for Tagging", df["Project Name"])
581
+ tags = st.text_input("Tags (comma-separated)")
582
+
583
+ if st.button("Add Tags"):
584
+ if tags:
585
+ df.loc[df["Project Name"] == project, "Tags"] = tags
586
+ save_projects(df)
587
+ st.success(f"Tags updated for project '{project}'.")
588
+
589
+ # Analytics and reports
590
+ def analytics():
591
+ st.header("Project Analytics and Reports")
592
+ df = load_projects()
593
+ if df.empty:
594
+ st.info("No data available.")
595
+ return
596
+
597
+ st.subheader("Projects by Priority")
598
+ priority_counts = df["Priority"].value_counts()
599
+ st.bar_chart(priority_counts)
600
+
601
+ st.subheader("Project Progress Overview")
602
+ st.line_chart(df["Progress"])
603
+
604
+ # Calendar view
605
+ def calendar_view():
606
+ st.header("Project Calendar View")
607
+ df = load_projects()
608
+ if df.empty:
609
+ st.info("No projects to display on the calendar.")
610
+ return
611
+
612
+ st.subheader("Upcoming Deadlines")
613
+ for i, row in df.iterrows():
614
+ st.text(f"{row['Project Name']} - End Date: {row['End Date']}")
615
+ # Automated notifications for approaching deadlines or high-priority tasks
616
+ def automated_notifications():
617
+ st.header("Automated Notifications")
618
+ df = load_projects()
619
+ if df.empty:
620
+ st.info("No projects available.")
621
+ return
622
+
623
+ today = date.today()
624
+ notification_list = []
625
+
626
+ # Identify upcoming deadlines and high-priority projects
627
+ for _, row in df.iterrows():
628
+ days_left = (pd.to_datetime(row['End Date']) - pd.to_datetime(today)).days
629
+ if days_left <= 7 or row['Priority'] == 'High':
630
+ notification_list.append(f"{row['Project Name']} - {days_left} days remaining")
631
+
632
+ if notification_list:
633
+ st.subheader("Notifications")
634
+ for notification in notification_list:
635
+ st.warning(notification)
636
+ else:
637
+ st.info("No upcoming deadlines or high-priority tasks.")
638
+
639
+
640
+ # Project search and advanced filtering
641
+ def search_and_filter_projects():
642
+ st.header("Search and Filter Projects")
643
+ df = load_projects()
644
+ if df.empty:
645
+ st.info("No projects available.")
646
+ return
647
+
648
+ # Search bar
649
+ search_query = st.text_input("Search by Project Name or Description")
650
+
651
+ # Advanced filters
652
+ filter_priority = st.selectbox("Filter by Priority", ["All", "Low", "Medium", "High"])
653
+ filter_status = st.selectbox("Filter by Status", ["All", "Completed", "Uncompleted"])
654
+
655
+ # Apply filters and search
656
+ if search_query:
657
+ df = df[df["Project Name"].str.contains(search_query, case=False) | df["Description"].str.contains(search_query, case=False)]
658
+ if filter_priority != "All":
659
+ df = df[df["Priority"] == filter_priority]
660
+ if filter_status != "All":
661
+ df = df[df["Status"] == filter_status]
662
+
663
+ if df.empty:
664
+ st.info("No projects matched the search criteria.")
665
+ else:
666
+ st.write(df)
667
+
668
+ # Backup and restore project data
669
+ def backup_and_restore():
670
+ st.header("Backup and Restore")
671
+
672
+ # Backup functionality
673
+ if st.button("Backup Data"):
674
+ df = load_projects()
675
+ if not df.empty:
676
+ df.to_csv('project_backup.csv', index=False)
677
+ st.success("Project data backed up successfully.")
678
+ else:
679
+ st.info("No data to back up.")
680
+
681
+ # Restore functionality
682
+ uploaded_file = st.file_uploader("Upload Backup File", type=["csv"])
683
+ if uploaded_file is not None:
684
+ restored_df = pd.read_csv(uploaded_file)
685
+ save_projects(restored_df)
686
+ st.success("Project data restored successfully.")
687
+
688
+ # Customizable status options
689
+ def customize_status():
690
+ st.header("Customizable Project Status Options")
691
+ df = load_projects()
692
+ if df.empty:
693
+ st.info("No projects available.")
694
+ return
695
+
696
+ project = st.selectbox("Select Project to Change Status", df["Project Name"])
697
+ new_status = st.text_input("Enter New Status (e.g., In Progress, Pending, On Hold)")
698
+
699
+ if st.button("Update Status"):
700
+ if project and new_status:
701
+ df.loc[df["Project Name"] == project, "Status"] = new_status
702
+ save_projects(df)
703
+ st.success(f"Status updated for project '{project}' to '{new_status}'.")
704
+
705
+ # Project templates
706
+ def project_templates():
707
+ st.header("Project Templates")
708
+ templates = {
709
+ "Software Development": {
710
+ "Description": "Developing a software application.",
711
+ "Start Date": date.today(),
712
+ "End Date": date.today(),
713
+ "Priority": "High",
714
+ "Status": "Uncompleted"
715
+ },
716
+ "Marketing Campaign": {
717
+ "Description": "Executing a marketing strategy.",
718
+ "Start Date": date.today(),
719
+ "End Date": date.today(),
720
+ "Priority": "Medium",
721
+ "Status": "Uncompleted"
722
+ }
723
+ }
724
+
725
+ selected_template = st.selectbox("Choose a Template", list(templates.keys()))
726
+ template_data = templates[selected_template]
727
+
728
+ if st.button("Create Project from Template"):
729
+ df = load_projects()
730
+ new_project = pd.DataFrame(template_data, index=[0])
731
+ df = pd.concat([df, new_project], ignore_index=True)
732
+ save_projects(df)
733
+ st.success(f"Project created from template: {selected_template}")
734
+ # Budget Tracking
735
+ def budget_tracking():
736
+ st.header("Budget Tracking")
737
+ df = load_projects()
738
+ if df.empty:
739
+ st.info("No projects available.")
740
+ return
741
+
742
+ project = st.selectbox("Select Project for Budget Tracking", df["Project Name"])
743
+ budget = st.number_input("Set Budget (in USD)", min_value=0)
744
+ expenses = st.number_input("Enter Expenses (in USD)", min_value=0)
745
+
746
+ if st.button("Update Budget"):
747
+ df.loc[df["Project Name"] == project, "Budget"] = budget
748
+ df.loc[df["Project Name"] == project, "Expenses"] = expenses
749
+ save_projects(df)
750
+ st.success(f"Budget and expenses updated for project '{project}'.")
751
+
752
+ # Display budget status
753
+ st.subheader("Project Budgets")
754
+ for _, row in df.iterrows():
755
+ budget = row.get("Budget", 0)
756
+ expenses = row.get("Expenses", 0)
757
+ remaining_budget = budget - expenses
758
+ st.write(f"{row['Project Name']} - Budget: ${budget}, Expenses: ${expenses}, Remaining: ${remaining_budget}")
759
+
760
+ # Comments and Notes
761
+ def comments_and_notes():
762
+ st.header("Comments and Notes")
763
+ df = load_projects()
764
+ if df.empty:
765
+ st.info("No projects available.")
766
+ return
767
+
768
+ project = st.selectbox("Select Project to Comment On", df["Project Name"])
769
+ comment = st.text_area("Add Comment/Note")
770
+
771
+ if st.button("Add Comment"):
772
+ df.loc[df["Project Name"] == project, "Comments"] = df.loc[df["Project Name"] == project, "Comments"].fillna("") + comment + "\n"
773
+ save_projects(df)
774
+ st.success(f"Comment added to project '{project}'.")
775
+
776
+ # Display comments for each project
777
+ st.subheader("Project Comments")
778
+ for _, row in df.iterrows():
779
+ comments = row.get("Comments", "No comments yet.")
780
+ st.write(f"{row['Project Name']} - Comments:\n{comments}")
781
+
782
+ # Prioritization Metrics
783
+ def prioritization_metrics():
784
+ st.header("Prioritization Metrics")
785
+ df = load_projects()
786
+ if df.empty:
787
+ st.info("No projects available.")
788
+ return
789
+
790
+ project = st.selectbox("Select Project for Prioritization", df["Project Name"])
791
+ impact = st.slider("Impact", min_value=1, max_value=10)
792
+ cost = st.slider("Cost", min_value=1, max_value=10)
793
+ urgency = st.slider("Urgency", min_value=1, max_value=10)
794
+ overall_priority = (impact * 0.5) + (urgency * 0.3) + (10 - cost) * 0.2
795
+
796
+ if st.button("Set Prioritization Metrics"):
797
+ df.loc[df["Project Name"] == project, "Impact"] = impact
798
+ df.loc[df["Project Name"] == project, "Cost"] = cost
799
+ df.loc[df["Project Name"] == project, "Urgency"] = urgency
800
+ df.loc[df["Project Name"] == project, "Priority Score"] = overall_priority
801
+ save_projects(df)
802
+ st.success(f"Prioritization metrics set for project '{project}'.")
803
+
804
+ # Display prioritization summary
805
+ st.subheader("Project Prioritization Scores")
806
+ for _, row in df.iterrows():
807
+ priority_score = row.get("Priority Score", "Not set")
808
+ st.write(f"{row['Project Name']} - Priority Score: {priority_score}")
809
+
810
+ # Calendar View (visualization of deadlines using a calendar layout)
811
+ def calendar_view():
812
+ st.header("Calendar View")
813
+ import plotly.express as px
814
+ df = load_projects()
815
+ if df.empty:
816
+ st.info("No projects available.")
817
+ return
818
+
819
+ # Convert date columns to datetime
820
+ df["Start Date"] = pd.to_datetime(df["Start Date"])
821
+ df["End Date"] = pd.to_datetime(df["End Date"])
822
+
823
+ # Create a Gantt chart to visualize project timelines
824
+ fig = px.timeline(df, x_start="Start Date", x_end="End Date", y="Project Name", color="Priority",
825
+ title="Project Calendar View", labels={"Priority": "Priority Level"})
826
+ fig.update_yaxes(categoryorder="total ascending")
827
+ st.plotly_chart(fig)
828
+ # Automated Notifications for approaching deadlines and task assignments
829
+ def automated_notifications():
830
+ st.header("Automated Notifications")
831
+ df = load_projects()
832
+ if df.empty:
833
+ st.info("No projects available.")
834
+ return
835
+
836
+ today = date.today()
837
+ notifications = []
838
+
839
+ # Check for projects with approaching deadlines
840
+ for _, row in df.iterrows():
841
+ end_date = pd.to_datetime(row["End Date"])
842
+ days_to_deadline = (end_date - today).days
843
+ if days_to_deadline == 7:
844
+ notifications.append(f"Project '{row['Project Name']}' is due in 7 days!")
845
+ elif days_to_deadline == 1:
846
+ notifications.append(f"Project '{row['Project Name']}' is due tomorrow!")
847
+ elif days_to_deadline == 0:
848
+ notifications.append(f"Project '{row['Project Name']}' is due today!")
849
+
850
+ # Display notifications
851
+ if notifications:
852
+ st.subheader("Notifications")
853
+ for notification in notifications:
854
+ st.warning(notification)
855
+ else:
856
+ st.info("No notifications for upcoming deadlines.")
857
+
858
+ # Project Search and Filter by various criteria
859
+ def search_and_filter_projects():
860
+ st.header("Search and Filter Projects")
861
+ df = load_projects()
862
+ if df.empty:
863
+ st.info("No projects available.")
864
+ return
865
+
866
+ search_term = st.text_input("Search by Project Name or Description")
867
+ priority_filter = st.selectbox("Filter by Priority", ["All", "Low", "Medium", "High"])
868
+ status_filter = st.selectbox("Filter by Status", ["All", "Completed", "Uncompleted"])
869
+
870
+ if search_term:
871
+ df = df[df["Project Name"].str.contains(search_term, case=False) | df["Description"].str.contains(search_term, case=False)]
872
+
873
+ if priority_filter != "All":
874
+ df = df[df["Priority"] == priority_filter]
875
+
876
+ if status_filter != "All":
877
+ df = df[df["Status"] == status_filter]
878
+
879
+ if df.empty:
880
+ st.info("No projects match the search criteria.")
881
+ else:
882
+ st.subheader("Search Results")
883
+ for _, row in df.iterrows():
884
+ st.write(f"**{row['Project Name']}** - Priority: {row['Priority']}, Status: {row['Status']}")
885
+
886
+ # Backup and Restore project data
887
+ def backup_and_restore():
888
+ st.header("Backup and Restore")
889
+ df = load_projects()
890
+
891
+ if st.button("Backup Project Data"):
892
+ backup_file = PROJECT_DATA_FILE.replace(".csv", "_backup.csv")
893
+ df.to_csv(backup_file, index=False)
894
+ st.success(f"Backup created as {backup_file}")
895
+
896
+ uploaded_file = st.file_uploader("Restore from Backup", type=["csv"])
897
+ if uploaded_file:
898
+ df_backup = pd.read_csv(uploaded_file)
899
+ save_projects(df_backup)
900
+ st.success("Project data restored from backup.")
901
+
902
+ # Customizable Status Options
903
+ def customize_status():
904
+ st.header("Customize Project Status Options")
905
+ df = load_projects()
906
+ if df.empty:
907
+ st.info("No projects available.")
908
+ return
909
+
910
+ project = st.selectbox("Select Project to Update Status", df["Project Name"])
911
+ status_options = ["In Progress", "Pending", "On Hold", "Completed", "Uncompleted"]
912
+ custom_status = st.selectbox("Set Custom Status", status_options)
913
+
914
+ if st.button("Update Status"):
915
+ df.loc[df["Project Name"] == project, "Status"] = custom_status
916
+ save_projects(df)
917
+ st.success(f"Status of '{project}' updated to '{custom_status}'")
918
+
919
+ # Project Templates for frequently used project types
920
+ def project_templates():
921
+ st.header("Project Templates")
922
+ template_name = st.selectbox("Select Template", ["Software Development", "Marketing Campaign", "Research Project", "Event Planning", "Custom"])
923
+
924
+ if template_name != "Custom":
925
+ template_description = {
926
+ "Software Development": "Developing a software application with multiple phases, from requirements gathering to deployment.",
927
+ "Marketing Campaign": "Organizing and launching a marketing campaign, including content creation and social media promotion.",
928
+ "Research Project": "Conducting research, including literature review, data collection, analysis, and reporting.",
929
+ "Event Planning": "Planning and organizing an event, including venue booking, logistics, and promotions."
930
+ }.get(template_name, "A general project template.")
931
+ else:
932
+ template_description = st.text_area("Custom Project Description")
933
+
934
+ if st.button("Create Project from Template"):
935
+ new_project = pd.DataFrame({
936
+ "Project Name": [template_name + " Project"],
937
+ "Description": [template_description],
938
+ "Start Date": [date.today()],
939
+ "End Date": [date.today()],
940
+ "Priority": ["Medium"],
941
+ "Status": ["Uncompleted"]
942
+ })
943
+
944
+ df = load_projects()
945
+ df = pd.concat([df, new_project], ignore_index=True)
946
+ save_projects(df)
947
+ st.success(f"Project '{template_name} Project' created from template.")
948
+ # Budget Tracking: Set and track budgets for projects
949
+ def budget_tracking():
950
+ st.header("Budget Tracking")
951
+ df = load_projects()
952
+ if df.empty:
953
+ st.info("No projects available.")
954
+ return
955
+
956
+ project = st.selectbox("Select Project", df["Project Name"])
957
+ budget = st.number_input("Set Project Budget", min_value=0.0, step=100.0)
958
+ expenses = st.number_input("Record Project Expenses", min_value=0.0, step=100.0)
959
+
960
+ if st.button("Update Budget and Expenses"):
961
+ df.loc[df["Project Name"] == project, "Budget"] = budget
962
+ df.loc[df["Project Name"] == project, "Expenses"] = expenses
963
+ save_projects(df)
964
+ st.success(f"Budget and expenses for '{project}' updated successfully.")
965
+
966
+ st.subheader("Current Budgets and Expenses")
967
+ for i, row in df.iterrows():
968
+ st.write(f"**{row['Project Name']}** - Budget: ${row.get('Budget', 'N/A')}, Expenses: ${row.get('Expenses', 'N/A')}")
969
+
970
+ # Comments and Notes for team collaboration
971
+ def comments_and_notes():
972
+ st.header("Project Comments & Notes")
973
+ df = load_projects()
974
+ if df.empty:
975
+ st.info("No projects available.")
976
+ return
977
+
978
+ project = st.selectbox("Select Project", df["Project Name"])
979
+ note = st.text_area("Add a Comment or Note")
980
+
981
+ if st.button("Add Note"):
982
+ df.loc[df["Project Name"] == project, "Notes"] = df.loc[df["Project Name"] == project].get("Notes", "") + "\n" + note
983
+ save_projects(df)
984
+ st.success(f"Note added to '{project}'")
985
+
986
+ st.subheader("Project Notes")
987
+ for i, row in df.iterrows():
988
+ if "Notes" in row and row["Notes"]:
989
+ st.write(f"**{row['Project Name']}** Notes:\n{row['Notes']}")
990
+
991
+ # Calendar View for visual project timelines and deadlines
992
+ def calendar_view():
993
+ st.header("Project Calendar View")
994
+ df = load_projects()
995
+ if df.empty:
996
+ st.info("No projects available.")
997
+ return
998
+
999
+ st.write("**Project Deadlines and Timelines**")
1000
+ for i, row in df.iterrows():
1001
+ st.write(f"{row['Project Name']} - **Start:** {row['Start Date']} **End:** {row['End Date']}")
1002
+
1003
+
1004
+ # Prioritization Metrics for automated prioritization
1005
+ def prioritization_metrics():
1006
+ st.header("Prioritization Metrics")
1007
+ df = load_projects()
1008
+ if df.empty:
1009
+ st.info("No projects available.")
1010
+ return
1011
+
1012
+ priority_metric = st.selectbox("Set Prioritization Criteria", ["Impact", "Cost", "Deadline"])
1013
+ st.write(f"Projects prioritized by {priority_metric}")
1014
+
1015
+ # Example: prioritize by impact or cost (placeholder logic)
1016
+ if priority_metric == "Impact":
1017
+ df = df.sort_values("Priority", ascending=False) # Assuming high = more impact
1018
+ elif priority_metric == "Cost":
1019
+ df = df.sort_values("Budget", ascending=True)
1020
+ elif priority_metric == "Deadline":
1021
+ df = df.sort_values("End Date")
1022
+
1023
+ for i, row in df.iterrows():
1024
+ st.write(f"{row['Project Name']} - Priority: {row['Priority']} - Deadline: {row['End Date']}")
1025
+ # Customizable Status Options: Allows users to create custom project statuses
1026
+ def customizable_status_options():
1027
+ st.header("Customizable Status Options")
1028
+ df = load_projects()
1029
+
1030
+ if df.empty:
1031
+ st.info("No projects available.")
1032
+ return
1033
+
1034
+ # Allow users to select a project and choose a custom status
1035
+ project = st.selectbox("Select Project", df["Project Name"].unique())
1036
+ custom_status = st.text_input("Enter New Status (e.g., In Progress, On Hold)")
1037
+
1038
+ if st.button("Update Status"):
1039
+ if custom_status:
1040
+ df.loc[df["Project Name"] == project, "Status"] = custom_status
1041
+ save_projects(df)
1042
+ st.success(f"Status for '{project}' updated to '{custom_status}'.")
1043
+ else:
1044
+ st.warning("Please enter a valid status.")
1045
+
1046
+ # Comments and Notes: Add a comment section to each project
1047
+ def comments_and_notes():
1048
+ st.header("Comments and Notes")
1049
+ df = load_projects()
1050
+
1051
+ if df.empty:
1052
+ st.info("No projects available.")
1053
+ return
1054
+
1055
+ project = st.selectbox("Select Project for Comments", df["Project Name"].unique())
1056
+ comment = st.text_area("Add Comment or Note")
1057
+
1058
+ if st.button("Submit Comment"):
1059
+ if comment:
1060
+ comments_file = f"{project}_comments.txt"
1061
+ with open(comments_file, "a") as file:
1062
+ file.write(f"{comment}\n")
1063
+ st.success("Comment added successfully!")
1064
+ else:
1065
+ st.warning("Please enter a comment.")
1066
+
1067
+ # Display existing comments
1068
+ if os.path.exists(f"{project}_comments.txt"):
1069
+ st.subheader("Existing Comments")
1070
+ with open(f"{project}_comments.txt", "r") as file:
1071
+ comments = file.readlines()
1072
+ for c in comments:
1073
+ st.text(c.strip())
1074
+
1075
+ # Automated Notifications for project deadlines and updates
1076
+ def automated_notifications():
1077
+ st.header("Automated Notifications")
1078
+ df = load_projects()
1079
+
1080
+ if df.empty:
1081
+ st.info("No projects available.")
1082
+ return
1083
+
1084
+ today = date.today()
1085
+ upcoming_deadlines = df[(pd.to_datetime(df['End Date']) >= today) & (pd.to_datetime(df['End Date']) <= today + pd.Timedelta(days=7))]
1086
+
1087
+ if not upcoming_deadlines.empty:
1088
+ st.warning("Upcoming Deadlines:")
1089
+ for i, row in upcoming_deadlines.iterrows():
1090
+ st.text(f"{row['Project Name']} - Due on {row['End Date']}")
1091
+
1092
+ st.success("Notifications are enabled for approaching deadlines and updates.")
1093
+
1094
+ # Team Collaboration: Add team members and assign roles to projects
1095
+ def team_collaboration():
1096
+ st.header("Team Collaboration")
1097
+ df = load_projects()
1098
+
1099
+ if df.empty:
1100
+ st.info("No projects available.")
1101
+ return
1102
+
1103
+ project = st.selectbox("Select Project for Team Collaboration", df["Project Name"].unique())
1104
+ member_name = st.text_input("Team Member Name")
1105
+ role = st.selectbox("Role", ["Team Member", "Project Manager", "Viewer"])
1106
+
1107
+ if st.button("Add Team Member"):
1108
+ if member_name:
1109
+ team_file = f"{project}_team.csv"
1110
+ if os.path.exists(team_file):
1111
+ team_df = pd.read_csv(team_file)
1112
+ else:
1113
+ team_df = pd.DataFrame(columns=["Member Name", "Role"])
1114
+
1115
+ new_member = pd.DataFrame({"Member Name": [member_name], "Role": [role]})
1116
+ team_df = pd.concat([team_df, new_member], ignore_index=True)
1117
+ team_df.to_csv(team_file, index=False)
1118
+ st.success(f"{member_name} added to the project as {role}!")
1119
+ else:
1120
+ st.warning("Please enter a team member's name.")
1121
+
1122
+ # Display current team members
1123
+ if os.path.exists(f"{project}_team.csv"):
1124
+ st.subheader("Current Team Members")
1125
+ team_df = pd.read_csv(f"{project}_team.csv")
1126
+ st.dataframe(team_df)
1127
+ # Gantt Chart Visualization
1128
+ def gantt_chart_visualization():
1129
+ st.header("Gantt Chart Visualization")
1130
+ df = load_projects()
1131
+
1132
+ if df.empty:
1133
+ st.info("No projects available to display in Gantt chart.")
1134
+ return
1135
+
1136
+ # Prepare data for Gantt chart
1137
+ df['Start Date'] = pd.to_datetime(df['Start Date'])
1138
+ df['End Date'] = pd.to_datetime(df['End Date'])
1139
+ df['Duration'] = (df['End Date'] - df['Start Date']).dt.days
1140
+
1141
+ chart = alt.Chart(df).mark_bar().encode(
1142
+ x='Start Date:T',
1143
+ x2='End Date:T',
1144
+ y=alt.Y('Project Name', sort=alt.SortField("Start Date", order="ascending")),
1145
+ color='Priority'
1146
+ ).properties(width=600, height=400)
1147
+
1148
+ st.altair_chart(chart)
1149
+
1150
+ # Task Dependencies and Sequencing
1151
+ def manage_task_dependencies():
1152
+ st.header("Manage Task Dependencies")
1153
+ project_name = st.selectbox("Select Project", load_projects()["Project Name"].unique())
1154
+ task_name = st.text_input("Task Name")
1155
+ dependency_task = st.selectbox("Select Prerequisite Task", load_projects()["Project Name"].unique())
1156
+
1157
+ if st.button("Set Dependency"):
1158
+ if task_name and dependency_task:
1159
+ dependencies_file = f"{project_name}_dependencies.csv"
1160
+ if os.path.exists(dependencies_file):
1161
+ dependencies_df = pd.read_csv(dependencies_file)
1162
+ else:
1163
+ dependencies_df = pd.DataFrame(columns=["Task", "Dependency"])
1164
+
1165
+ new_dependency = pd.DataFrame({"Task": [task_name], "Dependency": [dependency_task]})
1166
+ dependencies_df = pd.concat([dependencies_df, new_dependency], ignore_index=True)
1167
+ dependencies_df.to_csv(dependencies_file, index=False)
1168
+ st.success("Dependency added successfully!")
1169
+ else:
1170
+ st.warning("Please enter both the task name and prerequisite task.")
1171
+
1172
+ if os.path.exists(f"{project_name}_dependencies.csv"):
1173
+ st.subheader("Existing Dependencies")
1174
+ dependencies_df = pd.read_csv(f"{project_name}_dependencies.csv")
1175
+ st.dataframe(dependencies_df)
1176
+
1177
+ # Resource Management
1178
+ def resource_management():
1179
+ st.header("Resource Management")
1180
+ df = load_projects()
1181
+ if df.empty:
1182
+ st.info("No projects available.")
1183
+ return
1184
+
1185
+ project = st.selectbox("Select Project for Resource Allocation", df["Project Name"].unique())
1186
+ resource_name = st.text_input("Resource Name")
1187
+ allocation_percentage = st.slider("Resource Allocation Percentage", 0, 100, 50)
1188
+
1189
+ if st.button("Allocate Resource"):
1190
+ if resource_name:
1191
+ resource_file = f"{project}_resources.csv"
1192
+ if os.path.exists(resource_file):
1193
+ resource_df = pd.read_csv(resource_file)
1194
+ else:
1195
+ resource_df = pd.DataFrame(columns=["Resource Name", "Allocation (%)"])
1196
+
1197
+ new_resource = pd.DataFrame({"Resource Name": [resource_name], "Allocation (%)": [allocation_percentage]})
1198
+ resource_df = pd.concat([resource_df, new_resource], ignore_index=True)
1199
+ resource_df.to_csv(resource_file, index=False)
1200
+ st.success(f"{resource_name} allocated to '{project}'!")
1201
+ else:
1202
+ st.warning("Please enter the resource name.")
1203
+
1204
+ if os.path.exists(f"{project}_resources.csv"):
1205
+ st.subheader("Allocated Resources")
1206
+ resource_df = pd.read_csv(f"{project}_resources.csv")
1207
+ st.dataframe(resource_df)
1208
+
1209
+ # Risk Management and Mitigation Tracking
1210
+ def risk_management():
1211
+ st.header("Risk Management and Mitigation Tracking")
1212
+ df = load_projects()
1213
+
1214
+ if df.empty:
1215
+ st.info("No projects available.")
1216
+ return
1217
+
1218
+ project = st.selectbox("Select Project for Risk Management", df["Project Name"].unique())
1219
+ risk_description = st.text_input("Risk Description")
1220
+ risk_level = st.selectbox("Risk Level", ["Low", "Medium", "High"])
1221
+ mitigation_strategy = st.text_area("Mitigation Strategy")
1222
+
1223
+ if st.button("Log Risk"):
1224
+ if risk_description and mitigation_strategy:
1225
+ risk_file = f"{project}_risks.csv"
1226
+ if os.path.exists(risk_file):
1227
+ risk_df = pd.read_csv(risk_file)
1228
+ else:
1229
+ risk_df = pd.DataFrame(columns=["Risk Description", "Risk Level", "Mitigation Strategy"])
1230
+
1231
+ new_risk = pd.DataFrame({
1232
+ "Risk Description": [risk_description],
1233
+ "Risk Level": [risk_level],
1234
+ "Mitigation Strategy": [mitigation_strategy]
1235
+ })
1236
+ risk_df = pd.concat([risk_df, new_risk], ignore_index=True)
1237
+ risk_df.to_csv(risk_file, index=False)
1238
+ st.success(f"Risk added to '{project}'!")
1239
+ else:
1240
+ st.warning("Please complete all fields to log a risk.")
1241
+
1242
+ if os.path.exists(f"{project}_risks.csv"):
1243
+ st.subheader("Logged Risks")
1244
+ risk_df = pd.read_csv(f"{project}_risks.csv")
1245
+ st.dataframe(risk_df)
1246
+
1247
+ # Integration with Third-Party Tools (Simulated example)
1248
+ def integration_with_third_party_tools():
1249
+ st.header("Integration with Third-Party Tools")
1250
+ st.info("Here, you can integrate with various third-party tools like Slack, Trello, or Google Workspace.")
1251
+
1252
+ tool = st.selectbox("Select Tool to Integrate", ["Slack", "GitHub", "Trello", "Google Workspace"])
1253
+ if st.button("Integrate"):
1254
+ st.success(f"{tool} has been integrated successfully! (Simulated)")
1255
+
1256
+ # Add your other function definitions here, like add_project(), edit_project(), etc.
1257
+
1258
+ # Sidebar menu using radio buttons
1259
+ menu = st.sidebar.radio(
1260
+ "Menu", [
1261
+ "Home", "Add Project", "Edit Project", "Delete Project",
1262
+ "Task Management", "High Priority & Deadlines",
1263
+ "Project Progress Tracking",
1264
+
1265
+ "Analytics & Reports", "Calendar View",
1266
+ "Search and Filter", "Budget Tracking",
1267
+ "Comments and Notes", "Prioritization Metrics",
1268
+ "Gantt Chart Visualization",
1269
+ "Resource Management", "Risk Management"
1270
+ ]
1271
+ )
1272
+
1273
+ # Linking each radio button option to the corresponding function
1274
+ if menu == "Home":
1275
+ home()
1276
+ elif menu == "Add Project":
1277
+ add_project()
1278
+ elif menu == "Edit Project":
1279
+ edit_project()
1280
+ elif menu == "Delete Project":
1281
+ delete_project()
1282
+ elif menu == "Task Management":
1283
+ manage_tasks() # Calling your manage_tasks function here
1284
+ elif menu == "High Priority & Deadlines":
1285
+ view_high_priority()
1286
+ # elif menu == "Team Collaboration":
1287
+ # manage_team()
1288
+ elif menu == "Project Progress Tracking":
1289
+ project_progress()
1290
+ # elif menu == "Set Milestones":
1291
+ # set_milestones()
1292
+ # elif menu == "Time Tracking":
1293
+ # time_tracking()
1294
+ # elif menu == "Document Upload":
1295
+ # document_upload()
1296
+ elif menu == "Analytics & Reports":
1297
+ analytics()
1298
+ elif menu == "Calendar View":
1299
+ calendar_view()
1300
+ elif menu == "Search and Filter":
1301
+ search_and_filter_projects()
1302
+ # elif menu == "Customizable Status":
1303
+ # customizable_status_options()
1304
+ # elif menu == "Project Templates":
1305
+ # project_templates()
1306
+ elif menu == "Budget Tracking":
1307
+ budget_tracking()
1308
+ elif menu == "Comments and Notes":
1309
+ comments_and_notes()
1310
+ elif menu == "Prioritization Metrics":
1311
+ prioritization_metrics()
1312
+ elif menu == "Gantt Chart Visualization":
1313
+ gantt_chart_visualization()
1314
+ # elif menu == "Task Dependencies and Sequencing":
1315
+ # manage_task_dependencies()
1316
+ elif menu == "Resource Management":
1317
+ resource_management()
1318
+ elif menu == "Risk Management":
1319
+ risk_management()
1320
+
1321
+
1322
+
1323
+ # "Team Collaboration", "Set Milestones", "Time Tracking", "Document Upload", "Customizable Status",
1324
+ # "Project Templates", "Task Dependencies and Sequencing",