RFE: Make the Pocket integration report the number of saves

I’ve been using the Pocket Autodata Integration to great effect. When minding a backlog, an important aspect is tuning the slope. I.e. is the backlog growing or shrinking with the current slope.

It would help if the auto-entered Pocket datapoints included the number of items in “saves” (formerly “my list”) in the comment, maybe something like this:

A Brief Introduction to Icon [243 saves; auto-entered by Pocket]

That would make it abundantly clear how the backlog is progressing and would make it easy to locally post-process the datapoints if one wanted a historical graph of the backlog size.


It turned out to be pretty easy to automate this, using dance.pl + WWW::Pocket.

$handler{'ianminds/pocket'} = sub {
       my $comment = param('comment');
       my $id      = param('id');
       my $pocket  = 'auto-entered via Pocket';
       if ($comment =~ /\[$pocket\]$/i) {
               # get the number of saves
               my @saves = qx/ pocket list /;
               my $n = @saves;
               $comment =~ s/\[$pocket\]$/[$n saves; $pocket]/i;
               system( "curl -k --silent -X PUT \"https://www.beeminder.com/api/v1/users/ianminds/goals/pocket/datapoints/${id}.json\" -H 'Content-Type: application/json' -d '{
		       \"auth_token\": \"$TOKEN\",
		       \"comment\": \"$comment\"
	       }'" );

Still would be nice to have this built-in. Like the first post if you agree :slight_smile:.

As a secondary RFE: I also have a lot of datapoints where Pocket failed to extract a useful title. These show up as [Auto-entered via Pocket] (with initial space). It would be nice if there were a fallback to using the URL, like https://blog.beeminder.com/indulge/ [Auto-entered via Pocket].


My only wish is I started tracking this sooner:


The most fun part of creating this, was crafting a jq filter to convert a road array to a list of points that can be graphed to represent the different rates during the road’s lifetime. Given here in its golfed form:

[ .[] | select(.slug == "pocket") | .fullroad[] | [.[0,2]] ] | .[0], ((range(1; length - 1) as $i | .[$i:$i + 2]) | .[0], [ .[0][0], .[1][1] ]), .[-1] | @tsv

While keeping the first and last row as-is, for each row in the middle this keeps one copy and adds another with the same date and the rate of the next row (segment). This way we also get a point at the start of each segment making up the road (red line).