-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks_overdue.py
66 lines (50 loc) · 1.32 KB
/
tasks_overdue.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# by Dr. Torben Menke https://entorb.net
# https://github.com/entorb/rememberthemilk
"""
RTM tasks overdue.
by Dr. Torben Menke https://entorb.net
"""
from pandas import DataFrame
from helper import (
df_name_url_to_html,
df_to_html,
get_lists_dict,
get_tasks_as_df,
)
FILTER_OVERDUE = """
dueBefore:Today
AND NOT status:completed
AND NOT list:Taschengeld
"""
def get_tasks_overdue() -> DataFrame: # noqa: D103
lists_dict = get_lists_dict()
df = get_tasks_as_df(
my_filter=FILTER_OVERDUE,
lists_dict=lists_dict,
)
df = df.sort_values(by=["overdue_prio"], ascending=False)
df = df.reset_index()
cols = ["name", "list", "due", "overdue", "prio", "overdue_prio", "estimate", "url"]
df = df[cols]
return df
def group_by_list(df: DataFrame) -> DataFrame: # noqa: D103
df = (
df.groupby(["list"])
.agg(
count=("list", "count"),
sum_prio=("prio", "sum"),
sum_overdue_prio=("overdue_prio", "sum"),
sum_estimate=("estimate", "sum"),
)
.sort_values(by=["list"], ascending=[True])
)
return df
if __name__ == "__main__":
print("# RTM tasks overdue")
df = get_tasks_overdue()
print(df)
df = df_name_url_to_html(df)
df_to_html(
df,
"out-overdue.html",
)