# RFE: Make the Pocket integration report the number of saves

**URL:** <https://forum.beeminder.com/t/rfe-make-the-pocket-integration-report-the-number-of-saves/10770>\
**Category:** Bugabee\
**Created:** [January 20, 2023, 4:59pm UTC](https://forum.beeminder.com/t/rfe-make-the-pocket-integration-report-the-number-of-saves/10770 "2023-01-20T16:59:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ianminds](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/ianminds/32/4188_2.png) [@ianminds](https://forum.beeminder.com/u/ianminds)\
**Post date:** [January 20, 2023, 4:59pm UTC](https://forum.beeminder.com/t/rfe-make-the-pocket-integration-report-the-number-of-saves/10770/1 "2023-01-20T16:59:59Z")

</div>

I’ve been using the [Pocket Autodata Integration](https://forum.beeminder.com/t/soft-launch-of-official-pocket-autodata-integration/9460) 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.

---

<div class="post-metadata">

**Author:** ![ianminds](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/ianminds/32/4188_2.png) [@ianminds](https://forum.beeminder.com/u/ianminds)\
**Post date:** [January 31, 2023, 4:29pm UTC](https://forum.beeminder.com/t/rfe-make-the-pocket-integration-report-the-number-of-saves/10770/2 "2023-01-31T16:29:53Z")

</div>

It turned out to be pretty easy to automate this, using [dance.pl](https://github.com/pjjh/bmndr/blob/master/dance.pl) + WWW::Pocket.

```auto
$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 🙂.

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]`.

---

<div class="post-metadata">

**Author:** ![ianminds](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.beeminder.com/ianminds/32/4188_2.png) [@ianminds](https://forum.beeminder.com/u/ianminds)\
**Post date:** [June 3, 2023, 12:45pm UTC](https://forum.beeminder.com/t/rfe-make-the-pocket-integration-report-the-number-of-saves/10770/3 "2023-06-03T12:45:37Z")

</div>

My only wish is I started tracking this sooner:

![comb](https://us1.discourse-cdn.com/flex019/uploads/beeminder/original/2X/7/78ccef2c4c4b26fca9d10d071b96f7345b1a1684.png)

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:

```auto
[.[] | 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).
