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
Sample data associated with the Aurora-BP study

The Aurora-BP Study and Dataset This repository contains sample code, sample data, and explanatory information for working with the Aurora-BP dataset

Microsoft 16 Dec 12, 2022
VoiceFixer VoiceFixer is a framework for general speech restoration.

VoiceFixer VoiceFixer is a framework for general speech restoration. We aim at the restoration of severly degraded speech and historical speech. Paper

Leo 174 Jan 06, 2023
fastai ulmfit - Pretraining the Language Model, Fine-Tuning and training a Classifier

fast.ai ULMFiT with SentencePiece from pretraining to deployment Motivation: Why even bother with a non-BERT / Transformer language model? Short answe

Florian Leuerer 26 May 27, 2022
NLP tool to extract emotional phrase from tweets 🤩

Emotional phrase extractor Extract phrase in the given text that is used to express the sentiment. Capturing sentiment in language is important in the

Shahul ES 38 Oct 17, 2022
EMNLP 2021 paper "Pre-train or Annotate? Domain Adaptation with a Constrained Budget".

Pre-train or Annotate? Domain Adaptation with a Constrained Budget This repo contains code and data associated with EMNLP 2021 paper "Pre-train or Ann

Fan Bai 8 Dec 17, 2021
Training open neural machine translation models

Train Opus-MT models This package includes scripts for training NMT models using MarianNMT and OPUS data for OPUS-MT. More details are given in the Ma

Language Technology at the University of Helsinki 167 Jan 03, 2023
p-tuning for few-shot NLU task

p-tuning_NLU Overview 这个小项目是受乐于分享的苏剑林大佬这篇p-tuning 文章启发,也实现了个使用P-tuning进行NLU分类的任务, 思路是一样的,prompt实现方式有不同,这里是将[unused*]的embeddings参数抽取出用于初始化prompt_embed后

3 Dec 29, 2022
基于GRU网络的句子判断程序/A program based on GRU network for judging sentences

SentencesJudger SentencesJudger 是一个基于GRU神经网络的句子判断程序,基本的功能是判断文章中的某一句话是否为一个优美的句子。 English 如何使用SentencesJudger 确认Python运行环境 安装pyTorch与LTP python3 -m pip

8 Mar 24, 2022
Natural Language Processing Best Practices & Examples

NLP Best Practices In recent years, natural language processing (NLP) has seen quick growth in quality and usability, and this has helped to drive bus

Microsoft 6.1k Dec 31, 2022
sangha, pronounced "suhng-guh", is a social networking, booking platform where students and teachers can share their practice.

Flask React Project This is the backend for the Flask React project. Getting started Clone this repository (only this branch) git clone https://github

Courtney Newcomer 17 Sep 29, 2021
AIDynamicTextReader - A simple dynamic text reader based on Artificial intelligence

AI Dynamic Text Reader: This is a simple dynamic text reader based on Artificial

Md. Rakibul Islam 1 Jan 18, 2022
Switch spaces for knowledge graph embeddings

SwisE Switch spaces for knowledge graph embeddings. Requirements: python3 pytorch numpy tqdm Reproduce the results To reproduce the reported results,

Shuai Zhang 4 Dec 01, 2021
End-to-end MLOps pipeline of a BERT model for emotion classification.

image source EmoBERT-MLOps The goal of this repository is to build an end-to-end MLOps pipeline based on the MLOps course from Made with ML, but this

Dimitre Oliveira 4 Nov 06, 2022
Pipelines de datos, 2021.

Este repo ilustra un proceso sencillo de automatización de transformación y modelado de datos, a través de un pipeline utilizando Luigi. Stack princip

Rodolfo Ferro 8 May 19, 2022
:house_with_garden: Fast & easy transfer learning for NLP. Harvesting language models for the industry. Focus on Question Answering.

(Framework for Adapting Representation Models) What is it? FARM makes Transfer Learning with BERT & Co simple, fast and enterprise-ready. It's built u

deepset 1.6k Dec 27, 2022
This repository describes our reproducible framework for assessing self-supervised representation learning from speech

LeBenchmark: a reproducible framework for assessing SSL from speech Self-Supervised Learning (SSL) using huge unlabeled data has been successfully exp

49 Aug 24, 2022
Code for "Finetuning Pretrained Transformers into Variational Autoencoders"

transformers-into-vaes Code for Finetuning Pretrained Transformers into Variational Autoencoders (our submission to NLP Insights Workshop 2021). Gathe

Seongmin Park 22 Nov 26, 2022
Code voor mijn Master project omtrent VideoBERT

Code voor masterproef Deze repository bevat de code voor het project van mijn masterproef omtrent VideoBERT. De code in deze repository is gebaseerd o

35 Oct 18, 2021
Search with BERT vectors in Solr and Elasticsearch

Search with BERT vectors in Solr and Elasticsearch

Dmitry Kan 123 Dec 29, 2022
German Text-To-Speech Engine using Tacotron and Griffin-Lim

jotts JoTTS is a German text-to-speech engine using tacotron and griffin-lim. The synthesizer model has been trained on my voice using Tacotron1. Due

padmalcom 6 Aug 28, 2022