In [1]:
from mdt import *
#import seaborn
%matplotlib inline
%load_ext autoreload
%autoreload
In [2]:
mp.P_T1 = r"^(.*):$"
mp.C_TITLE = ":"
cfg = yaml.load(open("mdt_config.yaml","r").read())
auth_token = cfg['auth_token']
mu.import_from_dropbox(auth_token, "tmp")
dt = mp.parse_md_files("./tmp/"+"*.taskpaper")
del dt["T2"];del dt["T3"];del dt["ID"]
In [3]:
# Filter tasks only
df = dt[dt.TXT.str.contains("^\s*- ")]
dfs = ms.add_stat(df, "done,p")
dfs.rename(columns={"Filename": "Week", "T1": "Project", "done": "Date", "p":"Time"}, inplace=True)
In [4]:
daily = dfs.groupby(['Week',"Date"]).agg({'Time': ['sum'], 'TXT':'count', 'Project':'nunique'})
daily.columns = daily.columns.map(mu.flattenCols)
daily.rename(columns={"TXT_count": "Task_done"}, inplace=True)
daily['Ratio_Time'] = daily.Time_sum / 8
daily['Ratio_Task'] = daily.Task_done / 4
daily['Ratio_Project'] = daily.Project_nunique / 3
dstat = daily.fillna(0).sort_index(0, ascending=False).round(2)
dstat.to_csv("rpt/daily_stats.tsv",sep="\t")
dstat[:10]
Out[4]:
In [9]:
plt = daily.iloc[-10:,3:].plot(kind="bar", figsize=[15,3])
plt.axhline(y=1, linewidth=1, color = 'red', linestyle = 'dotted');
In [6]:
weekly = dfs.groupby(["Week"]).agg({'Time': ['sum'], 'TXT': 'count', 'Date': 'count'})
weekly.columns = weekly.columns.map(mu.flattenCols)
weekly.rename(columns={"TXT_count": "Task_total", "Date_count": "Task_done"}, inplace=True)
weekly.fillna(0).sort_index(0, ascending=False)
weekly['Ratio_Time'] = weekly.Time_sum / 40
weekly['Ratio_Task'] = weekly.Task_done / weekly.Task_total
wstat = weekly.fillna(0).sort_index(0, ascending=False).round(2)
wstat.to_csv("rpt/weekly_stats.tsv",sep="\t")
wstat
Out[6]:
In [10]:
plt = weekly.iloc[:,3:].plot(kind="bar", figsize=[10,3])
plt.axhline(y=1, linewidth=1, color = 'red', linestyle = 'dotted');
In [8]:
# Filter journals only
dj = dt[dt.T1.str.contains("^20")]
djs = ms.add_stat(dj, "h")
djs.rename(columns={"Filename": "Week", "T1": "Date", "h":"Happiness"}, inplace=True)
In [ ]:
djsa = djs.groupby(["Date"]).agg({'TXT': ['count']})
plt = djsa[-10:].plot(kind="bar", figsize=[15,3])
plt.legend_.remove()
plt.axhline(y=5, linewidth=1, color = 'red', linestyle = 'dotted');
In [ ]:
djs[~djs.Happiness.isnull()]
In [ ]:
djsa = djs[~djs.Happiness.isnull()].groupby(["Date"]).agg({'Happiness': ['mean']})
plt = djsa.plot(kind="bar", figsize=[10,3])
plt.legend_.remove()
plt.axhline(y=3.5, linewidth=1, color = 'red', linestyle = 'dotted');