Spaces:
Sleeping
Sleeping
shamimjony1000
commited on
Upload 3 files
Browse files- app.py +66 -0
- requirements.txt +2 -0
- tasks.csv +2 -0
app.py
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from components.task_operations import TaskManager
|
3 |
+
from components.task_visualization import TaskVisualizer
|
4 |
+
import pandas as pd
|
5 |
+
|
6 |
+
def main():
|
7 |
+
st.title("Jony Daily Task Tracker")
|
8 |
+
|
9 |
+
task_manager = TaskManager()
|
10 |
+
visualizer = TaskVisualizer()
|
11 |
+
|
12 |
+
task_name = st.text_input("Task Name")
|
13 |
+
task_time = st.time_input("Task Time")
|
14 |
+
task_duration_hours = st.number_input("Task Duration (Hours)", min_value=0, step=1, format="%d")
|
15 |
+
task_duration_minutes = st.number_input("Task Duration (Minutes)", min_value=0, max_value=59, step=1, format="%d")
|
16 |
+
|
17 |
+
task_category = st.selectbox("Task Category", TaskManager.CATEGORIES)
|
18 |
+
|
19 |
+
if st.button("Add Task"):
|
20 |
+
task_manager.add_task(task_name, task_time, task_duration_hours, task_duration_minutes, task_category)
|
21 |
+
st.success(f"Task '{task_name}' added!")
|
22 |
+
|
23 |
+
if st.session_state.tasks:
|
24 |
+
st.write("Today's Tasks:")
|
25 |
+
df = pd.DataFrame(st.session_state.tasks)
|
26 |
+
df['Task Duration (hours)'] = df['Task Duration (hours)'].astype(int)
|
27 |
+
df['Task Duration (minutes)'] = df['Task Duration (minutes)'].astype(int)
|
28 |
+
st.table(df[['Task Name', 'Task Time', 'Task Duration (hours)', 'Task Duration (minutes)', 'Category']])
|
29 |
+
|
30 |
+
task_to_delete = st.text_input("Enter Task Name to Delete")
|
31 |
+
if st.button("Delete Task"):
|
32 |
+
if task_manager.delete_task_by_name(task_to_delete):
|
33 |
+
st.success(f"Task '{task_to_delete}' deleted!")
|
34 |
+
else:
|
35 |
+
st.error(f"Task '{task_to_delete}' not found.")
|
36 |
+
|
37 |
+
if st.button("Daily Report"):
|
38 |
+
report = task_manager.generate_report('daily')
|
39 |
+
st.write("Daily Report:")
|
40 |
+
st.dataframe(report)
|
41 |
+
visualizer.plot_category_performance('daily', task_manager)
|
42 |
+
|
43 |
+
if st.button("Weekly Report"):
|
44 |
+
report = task_manager.generate_report('weekly')
|
45 |
+
st.write("Weekly Report:")
|
46 |
+
st.dataframe(report)
|
47 |
+
visualizer.plot_category_performance('weekly', task_manager)
|
48 |
+
|
49 |
+
if st.button("Monthly Report"):
|
50 |
+
report = task_manager.generate_report('monthly')
|
51 |
+
st.write("Monthly Report:")
|
52 |
+
st.dataframe(report)
|
53 |
+
visualizer.plot_category_performance('monthly', task_manager)
|
54 |
+
|
55 |
+
if st.button("Yearly Report"):
|
56 |
+
report = task_manager.generate_report('yearly')
|
57 |
+
st.write("Yearly Report:")
|
58 |
+
st.dataframe(report)
|
59 |
+
visualizer.plot_category_performance('yearly', task_manager)
|
60 |
+
|
61 |
+
visualizer.plot_performance()
|
62 |
+
visualizer.plot_overall_category_performance()
|
63 |
+
visualizer.download_report()
|
64 |
+
|
65 |
+
if __name__ == "__main__":
|
66 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
pandas
|
2 |
+
matplotlib
|
tasks.csv
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
Task Name,Task Time,Task Duration (hours),Task Duration (minutes),Category
|
2 |
+
ML,2024-10-08 23:07:00,1,30,Learning
|