A script for converting basic timelogs to the formats for timetracking import. Initially for [Pomodoro Prompt](https://gitlab.com/agaric/python/pomodoroprompt) to Harvest and [Business Tracker](https://gitlab.com/novawebdevelopment/business-tracker)
Find a file
mlncn 206530b235 Use .apply rather than np.where for easier/better/not-randomly-failing individual parsing
+# On some systems, using np.where worked but others failed.  Why it worked is
+# unknown but why it failed is because numpy where evaluates all parts, even
+# the parts that will never get used because the where clause does not apply!
+# This caused the chained strings to fail because— no string.

This worked fine on the System76 and didn't on Bridget's computer, even after
updating the version of python, but anyway, .apply() is better for what i am
trying to do here.

TODO convert other np.where uses to .apply

See #4 in https://datatofish.com/if-condition-in-pandas-dataframe/
2021-05-02 22:38:54 -04:00
.gitignore Add git ignore 2021-05-02 18:43:18 -04:00
pomodoro_to_harvest.py Use .apply rather than np.where for easier/better/not-randomly-failing individual parsing 2021-05-02 22:38:54 -04:00
README.md Update install instructions 2021-05-02 20:30:14 -04:00
requirements.txt Add requirements (python) file 2021-05-02 18:39:37 -04:00
settings.py Update install instructions 2021-05-02 20:30:14 -04:00

Parse timelogs for upload

A script for converting basic timelogs to the formats for timetracking import.

Initially for Pomodoro Prompt to Harvest and Business Tracker

Pmodoro Prompt is extremely simplistic, and only has a description field and automatically saves the date. The time unit for each entry is half an hour.

Installation

mkdir -p ~/Projects/agaric/python                                                                              
git clone git@gitlab.com:agaric/python/parse-timelogs-for-upload.git
cd parse-timelogs-for-upload
python3 -m pip install --user -r requirements.txt

Usage

python3 pomodoro_to_harvest.py

Background notes

To import into a timetracking system of any sophistication, we need to parse our description and

Harvest allows CSV import, with a bunch of annoying fields.

If project doesn't exist it will create a new project.

Learning from this script and continuing development

Rather than having to type out all 40 plus lines of data processing, you can also run the whole script in the interactive shell and play with it:

After typing python3 to get the interactive Python shell in this directory, you can do this line:

exec(open('pomodoro_to_harvest.py').read())

And now you can interact with the resulting timelog DataFrame:

timelog.query("time>30").loc[:100,["description","time","orig_desc"]].tail(50)

Or the slightly more processed tl DataFrame, for example to get the hours worked per project:

tl.groupby("project").agg({"time": "sum"})["time"]/60

And yeah you can just sort of tack on the column you want to mess with and do an operation like that!