An ActivityWatch watcher to pose questions to the user and record her answers.

Overview

aw-watcher-ask

An ActivityWatch watcher to pose questions to the user and record her answers.

This watcher uses Zenity to present dialog boxes to the user, and stores her answers in a locally running instance of ActivityWatch. This can be useful to poll all sorts of information on a periodical or random basis. The inspiration comes from the experience sampling method (ESM) used in psychological studies, as well as from the quantified self movement.

Table of Contents

Install

Using pip/pipx

Create a virtual environment, activate it and run:

$ python3 -m pip install git+https://github.com/bcbernardo/aw-watcher-ask.git
Collecting git+https://github.com/bcbernardo/aw-watcher-ask.git
... ...
Installing collected packages: aw-watcher-ask
Successfully installed aw-watcher-ask-0.1.0

Alternatively, you may use pipx to abstract away the creation of the virtual environment, and make sure the package is globally available:

$ pipx install git+https://github.com/bcbernardo/aw-watcher-ask.git
  installed package aw-watcher-ask 0.1.0, Python 3.9.6
  These apps are now globally available
    - aw-watcher-ask
done! ✨ 🌟 ✨

From source

To install the watcher, clone the repository to your local filesystem and install it with poetry:

$ git clone https://github.com/bcbernardo/aw-watcher-ask.git
$ cd aw-watcher-ask
$ poetry install
... ...
Installing the current project: aw-watcher-ask (0.1.0)
$ poetry shell  # alternatively, add `poetry run` before every command in the examples below

Usage

Before you start using aw-watcher-input, make sure you have ActivityWatch installed and running.

CLI

The following command will show the dialog box below each hour at 00 minutes and 00 seconds, wait up to 120 seconds for the user's response, and save it to a bucket in the local ActivityWatcher instance.

$ aw-watcher-ask run --question-id "happiness.level" --question-type="question" --title="My happiness level" --text="Are you feeling happy right now?" --timeout=120 --schedule "0 */1 * * * 0"
... ...

Example dialog asking if the user is happy

Check aw-watcher-ask run --help to see all required and optional control parameters.

The --question-id is used to identify this particular question in the ActivityWatcher a aw-watcher-input bucket, and is therefore mandatory.

The question-type parameters is also required and should be one of Zenity's supported dialog types (complex types such as forms, file-selection and list have not been implemented yet). All options supported by these dialog types are accepted by aw-watcher-ask run as extra parameters, and passed unaltered to Zenity under the hood.

Accessing the data

All data gathered is stored under aw-watcher-ask_localhost.localdomain bucket (or test-aw-watcher-ask_localhost.localdomain, when running with the --testing flag) in the local ActivityWatch endpoint. Check ActivityWatch REST API documentation to learn how to get the stored events programatically, so that you can apply some custom analysis.

Security

As other ActivityWatcher watchers, aw-watcher-ask communicates solely with the locally running AW server instance. All data collected is stored in your machine.

Limitations and Roadmap

aw-watcher-ask is in a very early development stage. Expect bugs and strange behaviors when using it.

This package uses zenity utility, which must be installed in the system and globally accessible through the command line. Zenity comes pre-installed with most Linux installations, and can be installed from all major package repositories (apt, dnf, pacman, brew etc.).

Porting Zenity to Windows is not trivial. If you use Windows, you may give @ncruces' Go port a shot, as it is supposed to be cross-platform. It have not been tested with aw-watcher-ask though, and may therefore behave unexpectedly.

aw-watcher-ask does not currently have a way of storing the questions made, and scheduling them every time the system restarts. We want to implement this eventually, but for now you should wrap all questions you want to schedule in a (shell) script and configure your system to execute it at every startup.

Maintainers

Contributing

PRs accepted. Please open an issue if you have an idea for enhancement or have spotted a bug.

License

MIT License

Copyright (c) 2021 Bernardo Chrispim Baron

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
An easy to use, user-friendly and efficient code for extracting OpenAI CLIP (Global/Grid) features from image and text respectively.

Extracting OpenAI CLIP (Global/Grid) Features from Image and Text This repo aims at providing an easy to use and efficient code for extracting image &

A python script that will use hydra to get user and password to login to ssh, ftp, and telnet

Hydra-Auto-Hack A python script that will use hydra to get user and password to login to ssh, ftp, and telnet Project Description This python script w

This script just scrapes the most recent Nepali news from Kathmandu Post and notifies the user about current events at regular intervals.It sends out the most recent news at random!

Nepali-news-notifier This script just scrapes the most recent Nepali news from Kathmandu Post and notifies the user about current events at regular in

A machine learning model for analyzing text for user sentiment and determine whether its a positive, neutral, or negative review.
A machine learning model for analyzing text for user sentiment and determine whether its a positive, neutral, or negative review.

Sentiment Analysis on Yelp's Dataset Author: Roberto Sanchez, Talent Path: D1 Group Docker Deployment: Deployment of this application can be found her

An IVR Chatbot which can exponentially reduce the burden of companies as well as can improve the consumer/end user experience.
An IVR Chatbot which can exponentially reduce the burden of companies as well as can improve the consumer/end user experience.

IVR-Chatbot Achievements 🏆 Team Uhtred won the Maverick 2.0 Bot-a-thon 2021 organized by AbInbev India. ❓ Problem Statement As we all know that, lot

Graphical user interface for Argos Translate
Graphical user interface for Argos Translate

Argos Translate GUI Website | GitHub | PyPI Graphical user interface for Argos Translate. Install pip3 install argostranslategui

Bot to connect a real Telegram user, simulating responses with OpenAI's davinci GPT-3 model.

AI-BOT Bot to connect a real Telegram user, simulating responses with OpenAI's davinci GPT-3 model.

Comments
  • Windows support (use go port zenity in python)

    Windows support (use go port zenity in python)

    zenity in python using a UNIX version of zenity instead of the zenity go port. I am wondering if you have any suggestions how to use go zenity in python?

    > python
    Python 3.10.0 | packaged by conda-forge | (default, Nov 10 2021, 13:20:59) [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import zenity
    >>> zenity.show()
    'sudo' is not recognized as an internal or external command,
    operable program or batch file.
    False
    

    Also copy @ncruces for any possible advice :)

    Steps to set up

    In powershell:

    choco install -y golang
    go get github.com/ncruces/zenity
    python -m pip install git+https://github.com/bcbernardo/aw-watcher-ask.git
    aw-watcher-ask run --question-id "happiness.level" --question-type="question" --title="My happiness level" --text="Are you feeling happy right now?" --timeout=120 --schedule "29 */1 * * * 30"
    

    Traceback

    Details aw-watcher-ask run --question-id "happiness.level" --question-type="question" --title="My happiness level" --text="Are you feeling happy right now?" --timeout=120 --schedule "29 */1 * * * 30" 2021-12-19 10:29:05.364 | INFO | aw_watcher_ask.core:main:132 - Starting new watcher... 2021-12-19T10:29:05.364228+0000 : INFO - Starting new watcher... 2021-12-19 10:29:05.383 | INFO | aw_watcher_ask.core:main:149 - Client created and connected to server at http://127.0.0.1:5600. 2021-12-19T10:29:05.383193+0000 : INFO - Client created and connected to server at http://127.0.0.1:5600. 2021-12-19 10:29:05.400 | INFO | aw_watcher_ask.core:main:161 - Next execution scheduled to 2021-12-19T10:29:30+00:00. 2021-12-19T10:29:05.400224+0000 : INFO - Next execution scheduled to 2021-12-19T10:29:30+00:00. 2021-12-19 10:29:29.411 | INFO | aw_watcher_ask.core:main:167 - New prompt fired. Waiting for user input... 2021-12-19T10:29:29.411130+0000 : INFO - New prompt fired. Waiting for user input... 'sudo' is not recognized as an internal or external command, operable program or batch file. Traceback (most recent call last): File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\timing\anaconda3\envs\aw-watcher\Scripts\aw-watcher-ask.exe\__main__.py", line 7, in File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\typer\main.py", line 214, in __call__ return get_command(self)(*args, **kwargs) File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\click\core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\click\core.py", line 1053, in main rv = self.invoke(ctx) File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\click\core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\click\core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\click\core.py", line 754, in invoke return __callback(*args, **kwargs) File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\typer\main.py", line 500, in wrapper return callback(**use_params) # type: ignore File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\aw_watcher_ask\cli.py", line 135, in run main(**params) File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\aw_watcher_ask\core.py", line 180, in main answer = _ask_one( File "C:\Users\timing\anaconda3\envs\aw-watcher\lib\site-packages\aw_watcher_ask\core.py", line 50, in _ask_one success, content = zenity.show( TypeError: cannot unpack non-iterable bool object
    opened by liutiming 5
  • click._bashcomplete

    click._bashcomplete

    Thanks for this awesome watcher!

    I have got issues running the watcher with the following traceback and potentially related issues https://github.com/celery/celery/issues/6511 https://github.com/click-contrib/click-repl/issues/72:

    I wonder what we can do about this?

    aw-watcher-ask run --help
    Traceback (most recent call last):
      File "/home/timing/.local/bin/aw-watcher-ask", line 5, in <module>
        from aw_watcher_ask.cli import app
      File "/home/timing/.local/lib/python3.8/site-packages/aw_watcher_ask/cli.py", line 12, in <module>
        import typer
      File "/home/timing/.local/lib/python3.8/site-packages/typer/__init__.py", line 29, in <module>
        from .main import Typer as Typer
      File "/home/timing/.local/lib/python3.8/site-packages/typer/main.py", line 11, in <module>
        from .completion import get_completion_inspect_parameters
      File "/home/timing/.local/lib/python3.8/site-packages/typer/completion.py", line 10, in <module>
        import click._bashcomplete
    ModuleNotFoundError: No module named 'click._bashcomplete'
    
    opened by liutiming 3
  • Support for cocoaDialog?

    Support for cocoaDialog?

    Hi, this looks like a great utility. I was wondering if you were planning on feature support in MacOS, mainly in using cocoaDialog to launch the modal?

    opened by blackwood 2
  • Fix bug in extra_args iteration.

    Fix bug in extra_args iteration.

    In the current implementation, the extra_args list is modified in-place, so when the iteration over it continues, throws an IndexError here:

      File "[...]python3.9/site-packages/aw_watcher_ask/cli.py", line 41, in _parse_extra_args
        if extra_args[ix].startswith("-"):
    IndexError: list index out of range
    

    It looks like there is no need to actually remove the parsed arguments, so the changes to fix are minimal. Happy to revise if I'm missing something.

    opened by neuralgraffiti 0
Releases(v0.1.0)
  • v0.1.0(Aug 8, 2021)

    Allows the user to schedule a question to be posed using Zenity dialog boxes at regular intervals. Results are stored to a locally running ActivityWatch server instance.

    Source code(tar.gz)
    Source code(zip)
Owner
Bernardo Chrispim Baron
Data Science, Open Government and Geotechnologies
Bernardo Chrispim Baron
Text Classification Using LSTM

Text classification is the task of assigning a set of predefined categories to free text. Text classifiers can be used to organize, structure, and categorize pretty much anything. For example, new ar

KrishArul26 3 Jan 03, 2023
This repository contains all the source code that is needed for the project : An Efficient Pipeline For Bloom’s Taxonomy Using Natural Language Processing and Deep Learning

Pipeline For NLP with Bloom's Taxonomy Using Improved Question Classification and Question Generation using Deep Learning This repository contains all

Rohan Mathur 9 Jul 17, 2021
Multi-Task Pre-Training for Plug-and-Play Task-Oriented Dialogue System

Multi-Task Pre-Training for Plug-and-Play Task-Oriented Dialogue System Authors: Yixuan Su, Lei Shu, Elman Mansimov, Arshit Gupta, Deng Cai, Yi-An Lai

Amazon Web Services - Labs 124 Jan 03, 2023
Задания КЕГЭ по информатике 2021 на Python

КЕГЭ 2021 на Python В этом репозитории мои решения типовых заданий КЕГЭ по информатике в 2021 году, БЕСПЛАТНО! Задания Взяты с https://inf-ege.sdamgia

8 Oct 13, 2022
Python SDK for working with Voicegain Speech-to-Text

Voicegain Speech-to-Text Python SDK Python SDK for the Voicegain Speech-to-Text API. This API allows for large vocabulary speech-to-text transcription

Voicegain 3 Dec 14, 2022
A fast and lightweight python-based CTC beam search decoder for speech recognition.

pyctcdecode A fast and feature-rich CTC beam search decoder for speech recognition written in Python, providing n-gram (kenlm) language model support

Kensho 315 Dec 21, 2022
Translators - is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python

Translators - is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python

UlionTse 907 Dec 27, 2022
Train BPE with fastBPE, and load to Huggingface Tokenizer.

BPEer Train BPE with fastBPE, and load to Huggingface Tokenizer. Description The BPETrainer of Huggingface consumes a lot of memory when I am training

Lizhuo 1 Dec 23, 2021
Python bindings to the dutch NLP tool Frog (pos tagger, lemmatiser, NER tagger, morphological analysis, shallow parser, dependency parser)

Frog for Python This is a Python binding to the Natural Language Processing suite Frog. Frog is intended for Dutch and performs part-of-speech tagging

Maarten van Gompel 46 Dec 14, 2022
Control the classic General Instrument SP0256-AL2 speech chip and AY-3-8910 sound generator with a Raspberry Pi and this Python library.

GI-Pi Control the classic General Instrument SP0256-AL2 speech chip and AY-3-8910 sound generator with a Raspberry Pi and this Python library. The SP0

Nick Bild 8 Dec 15, 2021
Client library to download and publish models and other files on the huggingface.co hub

huggingface_hub Client library to download and publish models and other files on the huggingface.co hub Do you have an open source ML library? We're l

Hugging Face 644 Jan 01, 2023
Automatically search Stack Overflow for the command you want to run

stackshell Automatically search Stack Overflow (and other Stack Exchange sites) for the command you want to ru Use the up and down arrows to change be

circuit10 22 Oct 27, 2021
Simple Speech to Text, Text to Speech

Simple Speech to Text, Text to Speech 1. Download Repository Opsi 1 Download repository ini, extract di lokasi yang diinginkan Opsi 2 Jika sudah famil

Habib Abdurrasyid 5 Dec 28, 2021
Share constant definitions between programming languages and make your constants constant again

Introduction Reconstant lets you share constant and enum definitions between programming languages. Constants are defined in a yaml file and converted

Natan Yellin 47 Sep 10, 2022
原神抽卡记录数据集-Genshin Impact gacha data

提要 持续收集原神抽卡记录中 可以使用抽卡记录导出工具导出抽卡记录的json,将json文件发送至[email protected],我会在清除个人信息后

117 Dec 27, 2022
Utilizing RBERT model for KLUE Relation Extraction task

RBERT for Relation Extraction task for KLUE Project Description Relation Extraction task is one of the task of Korean Language Understanding Evaluatio

snoop2head 14 Nov 15, 2022
Official code repository of the paper Linear Transformers Are Secretly Fast Weight Programmers.

Linear Transformers Are Secretly Fast Weight Programmers This repository contains the code accompanying the paper Linear Transformers Are Secretly Fas

Imanol Schlag 77 Dec 19, 2022
Search for documents in a domain through Google. The objective is to extract metadata

MetaFinder - Metadata search through Google _____ __ ___________ .__ .___ / \

Josué Encinar 85 Dec 16, 2022
Fast, general, and tested differentiable structured prediction in PyTorch

Torch-Struct: Structured Prediction Library A library of tested, GPU implementations of core structured prediction algorithms for deep learning applic

HNLP 1.1k Dec 16, 2022
Summarization, translation, sentiment-analysis, text-generation and more at blazing speed using a T5 version implemented in ONNX.

Summarization, translation, Q&A, text generation and more at blazing speed using a T5 version implemented in ONNX. This package is still in alpha stag

Abel 211 Dec 28, 2022