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
:hot_pepper: R²SQL: "Dynamic Hybrid Relation Network for Cross-Domain Context-Dependent Semantic Parsing." (AAAI 2021)

R²SQL The PyTorch implementation of paper Dynamic Hybrid Relation Network for Cross-Domain Context-Dependent Semantic Parsing. (AAAI 2021) Requirement

huybery 60 Dec 31, 2022
Materials (slides, code, assignments) for the NYU class I teach on NLP and ML Systems (Master of Engineering).

FREE_7773 Repo containing material for the NYU class (Master of Engineering) I teach on NLP, ML Sys etc. For context on what the class is trying to ac

Jacopo Tagliabue 90 Dec 19, 2022
The official implementation of "BERT is to NLP what AlexNet is to CV: Can Pre-Trained Language Models Identify Analogies?, ACL 2021 main conference"

BERT is to NLP what AlexNet is to CV This is the official implementation of BERT is to NLP what AlexNet is to CV: Can Pre-Trained Language Models Iden

Asahi Ushio 20 Nov 03, 2022
A Lightweight NLP Data Loader for All Deep Learning Frameworks in Python

LineFlow: Framework-Agnostic NLP Data Loader in Python LineFlow is a simple text dataset loader for NLP deep learning tasks. LineFlow was designed to

TofuNLP 177 Jan 04, 2023
Deep Learning for Natural Language Processing - Lectures 2021

This repository contains slides for the course "20-00-0947: Deep Learning for Natural Language Processing" (Technical University of Darmstadt, Summer term 2021).

0 Feb 21, 2022
Prithivida 690 Jan 04, 2023
Beyond Accuracy: Behavioral Testing of NLP models with CheckList

CheckList This repository contains code for testing NLP Models as described in the following paper: Beyond Accuracy: Behavioral Testing of NLP models

Marco Tulio Correia Ribeiro 1.8k Dec 28, 2022
Unofficial PyTorch implementation of Google AI's VoiceFilter system

VoiceFilter Note from Seung-won (2020.10.25) Hi everyone! It's Seung-won from MINDs Lab, Inc. It's been a long time since I've released this open-sour

MINDs Lab 881 Jan 03, 2023
Python library for processing Chinese text

SnowNLP: Simplified Chinese Text Processing SnowNLP是一个python写的类库,可以方便的处理中文文本内容,是受到了TextBlob的启发而写的,由于现在大部分的自然语言处理库基本都是针对英文的,于是写了一个方便处理中文的类库,并且和TextBlob

Rui Wang 6k Jan 02, 2023
Unsupervised text tokenizer focused on computational efficiency

YouTokenToMe YouTokenToMe is an unsupervised text tokenizer focused on computational efficiency. It currently implements fast Byte Pair Encoding (BPE)

VK.com 847 Dec 19, 2022
Maix Speech AI lib, including ASR, chat, TTS etc.

Maix-Speech 中文 | English Brief Now only support Chinese, See 中文 Build Clone code by: git clone https://github.com/sipeed/Maix-Speech Compile x86x64 c

Sipeed 267 Dec 25, 2022
Mkdocs + material + cool stuff

Modern-Python-Doc-Example mkdocs + material + cool stuff Doc is live here Features out of the box amazing good looking website thanks to mkdocs.org an

Francesco Saverio Zuppichini 61 Oct 26, 2022
PortaSpeech - PyTorch Implementation

PortaSpeech - PyTorch Implementation PyTorch Implementation of PortaSpeech: Portable and High-Quality Generative Text-to-Speech. Model Size Module Nor

Keon Lee 276 Dec 26, 2022
Idea is to build a model which will take keywords as inputs and generate sentences as outputs.

keytotext Idea is to build a model which will take keywords as inputs and generate sentences as outputs. Potential use case can include: Marketing Sea

Gagan Bhatia 364 Jan 03, 2023
Wind Speed Prediction using LSTMs in PyTorch

Implementation of Deep-Forecast using PyTorch Deep Forecast: Deep Learning-based Spatio-Temporal Forecasting Adapted from original implementation Setu

Onur Kaplan 151 Dec 14, 2022
Google and Stanford University released a new pre-trained model called ELECTRA

Google and Stanford University released a new pre-trained model called ELECTRA, which has a much compact model size and relatively competitive performance compared to BERT and its variants. For furth

Yiming Cui 1.2k Dec 30, 2022
PyTorch Language Model for 1-Billion Word (LM1B / GBW) Dataset

PyTorch Large-Scale Language Model A Large-Scale PyTorch Language Model trained on the 1-Billion Word (LM1B) / (GBW) dataset Latest Results 39.98 Perp

Ryan Spring 114 Nov 04, 2022
Simple text to phones converter for multiple languages

Phonemizer -- foʊnmaɪzɚ The phonemizer allows simple phonemization of words and texts in many languages. Provides both the phonemize command-line tool

CoML 762 Dec 29, 2022
A multi-lingual approach to AllenNLP CoReference Resolution along with a wrapper for spaCy.

Crosslingual Coreference Coreference is amazing but the data required for training a model is very scarce. In our case, the available training for non

Pandora Intelligence 71 Jan 04, 2023
The official implementation of VAENAR-TTS, a VAE based non-autoregressive TTS model.

VAENAR-TTS This repo contains code accompanying the paper "VAENAR-TTS: Variational Auto-Encoder based Non-AutoRegressive Text-to-Speech Synthesis". Sa

THUHCSI 138 Oct 28, 2022