aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/docs/online_duration.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/online_duration.md')
-rw-r--r--docs/online_duration.md76
1 files changed, 45 insertions, 31 deletions
diff --git a/docs/online_duration.md b/docs/online_duration.md
index d020662..7ca7c86 100644
--- a/docs/online_duration.md
+++ b/docs/online_duration.md
@@ -8,12 +8,14 @@ Usage
Run from the top-level directory using `python -m`:
- > python -m bin.online_duration -h
- usage: online_duration.py [-h] [--grouping {user,date,weekday,hour}]
- [--input-format {csv,log,null}]
- [--output-format {csv,json,plot}] [--from DATE_FROM]
- [--to DATE_TO]
- input [output]
+```
+> python -m bin.online_duration -h
+usage: online_duration.py [-h] [--grouping {user,date,weekday,hour}]
+ [--input-format {csv,log,null}]
+ [--output-format {csv,json,plot}] [--from DATE_FROM]
+ [--to DATE_TO]
+ input [output]
+```
This script additionally requires [matplotlib] to be installed.
@@ -22,9 +24,11 @@ amount of time people spent online.
For example (assuming the database in "db.csv" was generated by
[track_status.py] before):
- > python -m bin.online_duration db.csv
- 89497105,John,Smith,john.smith,0:12:31
- 3698577,Jane,Smith,jane.smith,1:34:46
+```
+> python -m bin.online_duration db.csv
+89497105,John,Smith,john.smith,0:12:31
+3698577,Jane,Smith,jane.smith,1:34:46
+```
In the example above, "John Smith" and "Jane Smith" spent approx. 13 and 95
minutes online respectively.
@@ -32,23 +36,25 @@ minutes online respectively.
The output format is CSV (comma-separated values) by default.
You can also get a JSON document:
- > python -m bin.online_duration --output-format json db.csv
- [
- {
- "uid": 89497105,
- "first_name": "John",
- "last_name": "Smith",
- "domain": "john.smith",
- "duration": "0:12:31"
- },
- {
- "uid": 3698577,
- "first_name": "Jane",
- "last_name": "Smith",
- "domain": "jane.smith",
- "duration": "1:34:46"
- }
- ]
+```
+> python -m bin.online_duration --output-format json db.csv
+[
+ {
+ "uid": 89497105,
+ "first_name": "John",
+ "last_name": "Smith",
+ "domain": "john.smith",
+ "duration": "0:12:31"
+ },
+ {
+ "uid": 3698577,
+ "first_name": "Jane",
+ "last_name": "Smith",
+ "domain": "jane.smith",
+ "duration": "1:34:46"
+ }
+]
+```
The durations are calculated on a per-user basis by default.
You can change that by supplying either `date` (to group by dates), `weekday`
@@ -106,24 +112,32 @@ Sunday,0:00:00
23:00:00,0:00:00
```
-In my opinion, the script's most useful feature is the ability to easily create
+In my opinion, the script's most useful feature is its ability to easily create
plots that represent this data (like in the examples above).
To produce a plot, pass `plot` as the `--output-format` parameter value and add
a file path to write the image to.
- > python -m bin.online_duration --output-format plot db.csv user.png
+```
+> python -m bin.online_duration --output-format plot db.csv user.png
+```
![user.png]
- > python -m bin.online_duration --output-format plot --grouping date db.csv date.png
+```
+> python -m bin.online_duration --output-format plot --grouping date db.csv date.png
+```
![date.png]
- > python -m bin.online_duration --output-format plot --grouping weekday db.csv weekday.png
+```
+> python -m bin.online_duration --output-format plot --grouping weekday db.csv weekday.png
+```
![weekday.png]
- > python -m bin.online_duration --output-format plot --grouping hour db.csv hour.png
+```
+> python -m bin.online_duration --output-format plot --grouping hour db.csv hour.png
+```
![hour.png]