Lifevisor is a quantified self-data platform designed to empower users with insights into their screentime habits. Built on top of ActivityWatch, it aggregates, analyses, and visualises screentime data to help users make informed decisions about their productivity and digital habits.
- ActivityWatch: Screentime tracking and data generation.
- PostgreSQL: Reliable database for syncing and storing activity data every 5 minutes.
- Metabase: Powerful visualization tool for creating customizable dashboards and reports.
- Go: Ensure Go is installed on your system.
- PostgreSQL: A running PostgreSQL database instance.
- ActivityWatch: Install and configure ActivityWatch to track screentime.
-
Clone the Repository:
git clone https://github.com/azaurus1/lifevisor.git cd lifevisor -
Build the CLI Application:
cd app go build -o lifevisor main.goThis will generate the
lifevisorbinary in the current directory. -
Move the Binary to Your Path: For easier usage, move the
lifevisorbinary to a directory in your system’s PATH:mv lifevisor /usr/local/bin/
Before syncing data, initialize the platform with the init command:
lifevisor init pg <activitywatch-db-path> <postgres-connection-string> <batch-size><activitywatch-db-path>: Path to your ActivityWatch SQLite database file, typically~/.local/share/activitywatch/aw-server/peewee-sqlite.v2.db.<postgres-connection-string>: Connection string for your PostgreSQL database (e.g.,postgres://username:password@host:port/dbname).<batch-size>: Number of records to process in each batch during synchronization.
Example:
lifevisor init pg ~/.local/share/activitywatch/aw-server/peewee-sqlite.v2.db postgres://postgres:postgres@192.168.0.131:30136/lifevisor 10000To keep your data up-to-date, configure a cronjob to run the sync command every 5 minutes:
-
Open your crontab editor:
crontab -e
-
Add the following entry:
*/5 * * * * /usr/local/bin/lifevisor sync pg ~/.local/share/activitywatch/aw-server/peewee-sqlite.v2.db postgres://postgres:postgres@192.168.0.131:30136/lifevisor 300
syncCommand: Updates the PostgreSQL database with the latest data from ActivityWatch.<activitywatch-db-path>: Same as above.<postgres-connection-string>: Same as above.300: Sync records within the last 300 seconds (5 minutes).
Note: Replace /usr/local/bin/lifevisor with the actual path to your lifevisor binary if it differs.
-
Run the
synccommand manually to ensure it works:lifevisor sync pg ~/.local/share/activitywatch/aw-server/peewee-sqlite.v2.db postgres://postgres:postgres@192.168.0.131:30136/lifevisor 300 -
Check your PostgreSQL database to confirm that screentime data is being updated.
-
Verify that the cronjob is running as expected by checking your system logs:
grep CRON /var/log/syslog
