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
DensePhrases provides answers to your natural language questions from the entire Wikipedia in real-time

DensePhrases provides answers to your natural language questions from the entire Wikipedia in real-time. While it efficiently searches the answers out of 60 billion phrases in Wikipedia, it is also very accurate having competitive accuracy with state-of-the-art open-domain QA models

Jinhyuk Lee 543 Jan 8, 2023
GooAQ 🥑 : Google Answers to Google Questions!

This repository contains the code/data accompanying our recent work on long-form question answering.

AI2 112 Nov 6, 2022
:id: A python library for accurate and scalable fuzzy matching, record deduplication and entity-resolution.

Dedupe Python Library dedupe is a python library that uses machine learning to perform fuzzy matching, deduplication and entity resolution quickly on

Dedupe.io 3.6k Jan 2, 2023
:id: A python library for accurate and scalable fuzzy matching, record deduplication and entity-resolution.

Dedupe Python Library dedupe is a python library that uses machine learning to perform fuzzy matching, deduplication and entity resolution quickly on

Dedupe.io 2.9k Feb 11, 2021
:id: A python library for accurate and scalable fuzzy matching, record deduplication and entity-resolution.

Dedupe Python Library dedupe is a python library that uses machine learning to perform fuzzy matching, deduplication and entity resolution quickly on

Dedupe.io 2.9k Feb 17, 2021
FireFlyer Record file format, writer and reader for DL training samples.

FFRecord The FFRecord format is a simple format for storing a sequence of binary records developed by HFAiLab, which supports random access and Linux

null 77 Jan 4, 2023
A python framework to transform natural language questions to queries in a database query language.

__ _ _ _ ___ _ __ _ _ / _` | | | |/ _ \ '_ \| | | | | (_| | |_| | __/ |_) | |_| | \__, |\__,_|\___| .__/ \__, | |_| |_| |___/

Machinalis 1.2k Dec 18, 2022
Reading Wikipedia to Answer Open-Domain Questions

DrQA This is a PyTorch implementation of the DrQA system described in the ACL 2017 paper Reading Wikipedia to Answer Open-Domain Questions. Quick Link

Facebook Research 4.3k Jan 1, 2023
Question answering app is used to answer for a user given question from user given text.

Question answering app is used to answer for a user given question from user given text.It is created using HuggingFace's transformer pipeline and streamlit python packages.

Siva Prakash 3 Apr 5, 2022
Jarvis is a simple Chatbot with a GUI capable of chatting and retrieving information and daily news from the internet for it's user.

J.A.R.V.I.S Kindly consider starring this repository if you like the program :-) What/Who is J.A.R.V.I.S? J.A.R.V.I.S is an chatbot written that is bu

Epicalable 50 Dec 31, 2022