1212
1313# cache of previously seen user information, keyed on email
1414USER_INFO = files .JsonFileCache ("TOGGL_USER_INFO" )
15- NOT_FOUND = "NOT FOUND"
1615
17- # input CSV columns needed for conversion
18- INPUT_COLUMNS = ["Email" , "Project" , "Client" , "Start date" , "Start time" , "Duration" , "Description" ]
16+ # input columns needed for conversion
17+ TOGGL_COLUMNS = ["Email" , "Project" , "Client" , "Start date" , "Start time" , "Duration" , "Description" ]
1918
20- # default output CSV columns
21- OUTPUT_COLUMNS = ["Date" , "Client" , "Project" , "Task" , "Notes" , "Hours" , "First name" , "Last name" ]
19+ # default output CSV columns for Harvest
20+ HARVEST_COLUMNS = ["Date" , "Client" , "Project" , "Task" , "Notes" , "Hours" , "First name" , "Last name" ]
2221
2322
2423def _get_first_name (email : str ) -> str :
@@ -59,7 +58,7 @@ def convert_to_harvest(
5958 source_path : str | TextIO = sys .stdin ,
6059 output_path : str | TextIO = sys .stdout ,
6160 client_name : str = None ,
62- output_cols : list [str ] = OUTPUT_COLUMNS ,
61+ output_cols : list [str ] = HARVEST_COLUMNS ,
6362):
6463 """Convert Toggl formatted entries in source_path to equivalent Harvest formatted entries.
6564
@@ -79,7 +78,7 @@ def convert_to_harvest(
7978 client_name = os .environ .get ("HARVEST_CLIENT_NAME" )
8079
8180 # read CSV file, parsing dates and times
82- source = files .read_csv (source_path , usecols = INPUT_COLUMNS , parse_dates = ["Start date" ], cache_dates = True )
81+ source = files .read_csv (source_path , usecols = TOGGL_COLUMNS , parse_dates = ["Start date" ], cache_dates = True )
8382 source ["Start time" ] = source ["Start time" ].apply (_str_timedelta )
8483 source ["Duration" ] = source ["Duration" ].apply (_str_timedelta )
8584 source .sort_values (["Start date" , "Start time" , "Email" ], inplace = True )
@@ -109,7 +108,7 @@ def download_time_entries(
109108 start_date : datetime ,
110109 end_date : datetime ,
111110 output_path : str | TextIO = sys .stdout ,
112- output_cols : list [str ] | None = INPUT_COLUMNS ,
111+ output_cols : list [str ] | None = TOGGL_COLUMNS ,
113112 ** kwargs ,
114113):
115114 """Download a CSV report from Toggl of detailed time entries for the given date range.
0 commit comments