From ce13e32f7daa5aa3da738567926b2e9301d2f148 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?benjamin=20melan=C3=A7on?= Date: Wed, 28 Apr 2021 11:14:39 -0400 Subject: [PATCH] Regularize project titles --- pomodoro_to_harvest.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 77af53e..bf21582 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -55,6 +55,25 @@ timelog.drop(columns=['tmp_multiplier'], inplace=True) # Clean up description again, after it has been sliced and diced. timelog['description'] = timelog['description'].str.strip() +# Replace irregular-but-known project names with ones timetracking tools use. +replacement_project_names = { + "Find It Cambridge": ["Find It", "FIC", "Cambridge"], + "The Propaganda Site": ["TPS", "Propaganda Site"], + "MASS Design Group": ["MASS"], + "Teachers with GUTS": ["TWIG", "GUTS"], + "Network engagement": ["Network Engagement", "network engagement", "Network engagment", "Social media", "Network building", "Agaric network engagement"], + "Agaric internal": ["Agaric", "Internal"], + "Agaric contrib": ["Contributing", "Contrib"], + "Leads": ["Lead", "Agaric leads", "Lead followups"], + "Learning": ["Personal learning"], + "Personal / external": ["Personal/external", "Personal", "External"], + "Near North camp": ["Near North Camp", "Near North defense", "Encampment support", "Camp support"], +} +# TODO Probably put all alternatives in lower case and do str.lower() on +# project just before the "is in" check. +for preferred, alternatives in replacement_project_names.items(): + timelog.loc[timelog.project.isin(alternatives), "project"] = preferred + # Condense duplicate entries by date, summing the minutes spent, and listing # the first started and last recorded times for each task. tl = timelog.groupby(["date", timelog.project.fillna(""), "description"]).agg({"time": 'sum', "started": 'min', "recorded": 'max'}).reset_index()