Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions aw_research/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,12 @@ def query_complete(): # noqa
events_web_chrome = filter_period_intersect(events_web_chrome, events_browser_chrome)

events_browser_ff = filter_keyvals(events, "app", browsernames_ff)
events_web = concat(events_web_ff, filter_period_intersect(events_web_ff, events_browser_ff))
events_web_ff = filter_period_intersect(events_web_ff, events_browser_ff)

events_web = concat(events_web_ff, events_web_chrome)
events = exclude_keyvals(events, "app", browsernames_chrome)
events = exclude_keyvals(events, "app", browsernames_ff)
events = concat(events, events_web_ff)
events = concat(events, events_web)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!


# Filter away non-afk and non-audible time
events_notafk = filter_keyvals(events_afk, "status", ["not-afk"])
Expand Down Expand Up @@ -423,7 +425,7 @@ def test_union_no_overlap():
def get_events(since: datetime, end: datetime, include_smartertime='auto', include_toggl=None) -> List[Event]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to change include_smartertime='auto' to False than to pass it in the call on line 542.

awc = ActivityWatchClient("test", testing=False)

# print(query_complete)
#print(query_complete)
result = awc.query(query_complete, start=since, end=end)
events = [Event(**e) for e in result[0]]

Expand Down Expand Up @@ -529,13 +531,15 @@ def _plot_category_daily_trend(events, categories):
def _main(args):
_init_classes('category_regexes.csv')

print(args)

if args.cmd2 in ["summary", "summary_plot", "apps", "cat", "cat_plot"]:
if not args.end:
args.end = datetime.now()
if not args.start:
how_far_back = timedelta(hours=1 * 12)
how_far_back = timedelta(hours=1 * 24)
args.start = args.end - how_far_back
events = get_events(args.start, args.end, include_toggl='./data/private/Toggl_time_entries_2017-12-17_to_2018-11-11.csv')
events = get_events(args.start, args.end, False)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was the False I was referring to.

_print_summary(events)

events = classify(events, include_app=False)
Expand Down
6 changes: 0 additions & 6 deletions categories.example.csv

This file was deleted.

1 change: 1 addition & 0 deletions category_regexes_example.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
regex;sub-category;category
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep the default categories and add a comment specifying the format instead.

The file name should still be categories.example.csv, correct the filename used in the code.

3 changes: 0 additions & 3 deletions parent_categories.csv.example

This file was deleted.