Skip to content

Commit ece1779

Browse files
committed
fixed a lot of things in the documentation
1 parent 7a548a9 commit ece1779

13 files changed

+53
-39
lines changed

api-reference.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ A lot of it currently lacks proper docstrings, but it's a start.
88
.. contents::
99

1010

11+
1112
aw_core
1213
-------
1314
.. automodule:: aw_core

architecture.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@ Server
1212

1313
Known as aw-server, it handles storage and retrieval of all activities/entries in buckets. Usually there exists one bucket per watcher.
1414

15+
The server also hosts the Web UI (aw-webui) which does all communication with the server using the REST API.
16+
1517
Clients
1618
-------
1719

18-
The server doesn't do anything interesting on its own, for that we need clients such as watchers and user interfaces.
19-
Writing these clients is something we've tried to make as easy as possible by creating client libraries with a clear API.
20+
The server doesn't do anything very interesting on its own, for that we need clients. Most specifically a certain type of client known as watchers.
21+
Writing these clients is something we've tried to make as easy as possible by creating client libraries with a clear API.
2022

2123
Currently the primary client library is written in Python (known simply as aw-client) but a client library written in JavaScript is on the way and is expected to have the same level of support in the future.
2224

2325
Client libraries:
2426

2527
- aw-client (Python)
26-
- aw-client-js (JavaScript)
28+
- aw-client-js (JavaScript, work in progress)
2729

2830
Watchers
2931
^^^^^^^^

conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
# The reST default role (used for this markup: `text`) to use for all
101101
# documents.
102102
#
103-
# default_role = None
103+
default_role = 'any'
104104

105105
# If true, '()' will be appended to :func: etc. cross-reference text.
106106
#

event-model.rst

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Event model
2+
===========
3+
4+
The ActivityWatch event model is pretty simple, here's its representation in JSON:
5+
6+
.. code-block:: js
7+
8+
{
9+
"timestamp": "2016-04-27T15:23:55Z", # ISO8601 formatted timestamp
10+
"duration": 3.14, # Duration in seconds
11+
"data": {"key": "value"} # A JSON object, the schema of this depends on the bucket type
12+
}
13+
14+
It should be noted that all timestamps are stored as UTC. Timezone information (UTC offset) is currently discarded.

faq.rst

+22-12
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ FAQ
88
How do I programmatically use ActivityWatch?
99
--------------------------------------------
1010

11-
See the documentation for :doc:`extending` or checkout the `aw-client` repository.
11+
See the documentation for :doc:`extending` or checkout the aw-client repository.
1212

1313
How do I understand the data that is stored?
1414
--------------------------------------------
@@ -26,22 +26,28 @@ Get some events with
2626
bucket_id = next(buckets.keys())
2727
events = ac.get_events(bucket_id)
2828
29-
Events from the aw-watcher-afk bucket have the fields `['timestamp']`, `['duration']`, and `['data']['status']`. The status can be one of `afk`, `not-afk`, or `hibernating`. If `e0` and `e1` are consecutive events, you should expect
30-
`e0['timestamp'] + e0['duration'] == e1['timestamp']` (within some milliseconds) and report issues when it is not the case. Actually this is only true for aw-watcher-afk, because aw-watcher-window doesn't record anything when afk or asleep.
29+
For a description of the `event-model`.
3130

32-
In principle, `afk` and `not-afk` events alternate, but there are currently many edge cases where it doesn't happen.
31+
Events from the aw-watcher-afk bucket have the fields :code:`timestamp`, :code:`duration`, and :code:`data`.
3332

34-
No two events in a bucket should cover the same moment, but right now in some cases `hibernating` events overlap entirely with some `afk` events.
33+
As an example for AFK events: The data field contains a JSON object (in Python a dict) which has one key :code:`status` which can be one of: :code:`afk`, :code:`not-afk`, :code:`hibernating`.
3534

36-
How to determine bucket name?
37-
-----------------------------
35+
..
36+
If :code:`e0` and :code:`e1` are consecutive events, you should expect :code:`e0.timestamp + e0.duration == e1.timestamp` (within some milliseconds) and report issues when it is not the case.
37+
Actually this is only true for aw-watcher-afk, because aw-watcher-window doesn't record anything when afk or asleep.
38+
In principle, `afk` and `not-afk` events alternate, but there are currently many edge cases where it doesn't happen.
39+
40+
No two events in a bucket should cover the same moment, if that happens there is an issue with the watcher that should be resolved.
3841

39-
`<name of watcher>` (one of `aw-watcher-afk` or `aw-watcher-window`) + `_` + `<name of your machine>` (how to determine? look in "Raw Data" tab of web UI)
42+
What happens if it is down or crashes?
43+
--------------------------------------
4044

41-
What happens when AW is down or crashes?
42-
----------------------------------------
45+
Since ActivityWatch consists of several modules running independently, one thing crashing will have limited impact on the rest of the system.
4346

44-
Stored data up to the crash is not corrupted (up to few seconds before). When AW is restarted, it will first register a `not-afk` event. Several `not-afk` can come one after the other if AW is interrupted in between. No data will be stored when AW is off.
47+
If the server crashes, all watchers which use the heartbeat queue should simply queue heartbeats until the server becomes available again.
48+
Since heartbeats are currently sent immediately to the server for storage, all data before the crash should be untouched.
49+
50+
If a watcher crashes, its bucket will simply remain untouched until it is restarted.
4551

4652
What happens when my computer is off or asleep?
4753
-----------------------------------------------
@@ -51,4 +57,8 @@ When asleep, aw-watcher-afk will record a "hibernating" event (this might change
5157
Some events have 0 duration. What does this mean?
5258
-------------------------------------------------
5359

54-
It's a glitch (caused by 3 consecutive heartbeats having different data?).
60+
Watchers most commonly use a polling method called heartbeats in order to store information on the server.
61+
Heartbeats are received regularly with some data, and when two consecutive heartbeats have identical data they get merged and the duration of the new one becomes the time difference between the previous two.
62+
Sometimes, a single heartbeat doesn't get a following event with identical data. It is then impossible to know the duration of that event.
63+
64+
The assumption could be made to consider all zero-duration events actually have a duration equal to the time of the next event, but all such assumptions are left to the analysis stage.

features.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Features
44
Here we will document a few features.
55

66
.. toctree::
7-
user-interface
8-
pausing-logging
9-
filtering-data
7+
features/user-interface
8+
features/pausing-logging
9+
features/filtering-data
File renamed without changes.
File renamed without changes.
File renamed without changes.

getting-started.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ First, grab the `latest release from GitHub <https://github.com/ActivityWatch/ac
1515

1616
To install from a zip-file, simply unextract it into an appropriate directory.
1717

18-
If you want to install from source, see `Installing from source`_.
18+
If you want to install from source, see `installing-from-source`.
1919

2020
Usage
2121
=====

index.rst

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. image:: banner.png
2+
13
Welcome to the ActivityWatch documentation!
24
===========================================
35

@@ -24,6 +26,7 @@ Welcome to the ActivityWatch documentation!
2426
:caption: Developer documentation
2527

2628
architecture
29+
event-model
2730
installing-from-source
2831
api-reference
2932
development

introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ companies have their data in hands they are forced to trust if they want to use
2929

3030
This is a significant problem, but the true reason that we decided to do something about it was that
3131
existing solutions were inadequate. They focused on short-term insight, a goal worthy in itself, but we also
32-
want long-term understanding. We made it `completely free and open source` so anyone can
33-
use, audit, improve and extend it.
32+
want long-term understanding. We made it completely free and open source so anyone can
33+
use, improve and extend it.
3434

3535

3636
Data philosophy

rest.rst

+1-17
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ Clients might in the future be able to have read-only or append-only access to b
2424
All clients will probably also encrypt data in transit.
2525

2626

27-
Event model
28-
-----------
29-
30-
The ActivityWatch event model is pretty simple, here's its representation in JSON:
31-
32-
.. code-block:: js
33-
34-
{
35-
"timestamp": "2016-04-27T15:23:55Z", # ISO8601 formatted timestamp
36-
"duration": 3.14, # Duration in seconds
37-
"data": {"key": "value"} # A JSON object, the schema of this depends on the bucket type
38-
}
39-
40-
It should be noted that all timestamps are stored as UTC. Timezone information (UTC offset) is currently discarded.
41-
42-
4327
API Reference
4428
-------------
4529

@@ -77,7 +61,7 @@ Create
7761
Events API
7862
~~~~~~~~~~
7963

80-
The most common API used by ActivityWatch clients is the API providing read and append access buckets.
64+
The most common API used by ActivityWatch clients is the API providing read and append `Events <event-model>` to buckets.
8165
Buckets are data containers used to group data together which shares some metadata (such as client type, hostname or location).
8266

8367
Get events

0 commit comments

Comments
 (0)